Combined 2 steps checkout and get-git-sha into one

This commit is contained in:
Marcin-Ramotowski 2025-05-12 20:06:44 +00:00
parent 7a411a7148
commit 7b12088952

View File

@ -36,8 +36,6 @@ spec:
value: "{{workflow.parameters.repo}}"
- name: branch
value: "{{workflow.parameters.branch}}"
- - name: get-git-sha
template: get-git-sha
- - name: tests
template: tests
- - name: build-test-and-push-image
@ -45,7 +43,7 @@ spec:
arguments:
parameters:
- name: git-sha
value: "{{steps.get-git-sha.outputs.parameters.git-sha}}"
value: "{{steps.checkout.outputs.parameters.git-sha}}"
# 📦 GIT CHECKOUT
- name: checkout
@ -55,28 +53,13 @@ spec:
- name: branch
container:
image: alpine/git
command: [sh,-c]
workingDir: /workspace
args:
- clone
- --depth
- "1"
- --branch
- "{{inputs.parameters.branch}}"
- --single-branch
- "{{inputs.parameters.repo}}"
- repo
volumeMounts:
- name: workspace
mountPath: /workspace
# Get sha of the latest commit
- name: get-git-sha
script:
image: alpine/git
command: [sh]
workingDir: /workspace/repo
source: |
git rev-parse HEAD > /tmp/gitsha.txt
- |
git clone --depth 1 --branch "{{inputs.parameters.branch}}" --single-branch "{{inputs.parameters.repo}}" repo
cd repo
git rev-parse HEAD > /tmp/gitsha.txt
volumeMounts:
- name: workspace
mountPath: /workspace