Combined 2 steps checkout and get-git-sha into one
This commit is contained in:
parent
7a411a7148
commit
7b12088952
@ -36,8 +36,6 @@ spec:
|
|||||||
value: "{{workflow.parameters.repo}}"
|
value: "{{workflow.parameters.repo}}"
|
||||||
- name: branch
|
- name: branch
|
||||||
value: "{{workflow.parameters.branch}}"
|
value: "{{workflow.parameters.branch}}"
|
||||||
- - name: get-git-sha
|
|
||||||
template: get-git-sha
|
|
||||||
- - name: tests
|
- - name: tests
|
||||||
template: tests
|
template: tests
|
||||||
- - name: build-test-and-push-image
|
- - name: build-test-and-push-image
|
||||||
@ -45,7 +43,7 @@ spec:
|
|||||||
arguments:
|
arguments:
|
||||||
parameters:
|
parameters:
|
||||||
- name: git-sha
|
- name: git-sha
|
||||||
value: "{{steps.get-git-sha.outputs.parameters.git-sha}}"
|
value: "{{steps.checkout.outputs.parameters.git-sha}}"
|
||||||
|
|
||||||
# 📦 GIT CHECKOUT
|
# 📦 GIT CHECKOUT
|
||||||
- name: checkout
|
- name: checkout
|
||||||
@ -55,28 +53,13 @@ spec:
|
|||||||
- name: branch
|
- name: branch
|
||||||
container:
|
container:
|
||||||
image: alpine/git
|
image: alpine/git
|
||||||
|
command: [sh,-c]
|
||||||
workingDir: /workspace
|
workingDir: /workspace
|
||||||
args:
|
args:
|
||||||
- clone
|
- |
|
||||||
- --depth
|
git clone --depth 1 --branch "{{inputs.parameters.branch}}" --single-branch "{{inputs.parameters.repo}}" repo
|
||||||
- "1"
|
cd repo
|
||||||
- --branch
|
git rev-parse HEAD > /tmp/gitsha.txt
|
||||||
- "{{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
|
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: workspace
|
- name: workspace
|
||||||
mountPath: /workspace
|
mountPath: /workspace
|
||||||
|
Loading…
x
Reference in New Issue
Block a user