Skip to content

Commit

Permalink
Use env var for short commit length parameter and quote the value to …
Browse files Browse the repository at this point in the history
…avoid word splitting
  • Loading branch information
samdoran committed Sep 20, 2024
1 parent 0df3e38 commit c676f13
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion task/git-clone-oci-ta/0.1/git-clone-oci-ta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ spec:
value: $(params.submodules)
- name: PARAM_DEPTH
value: $(params.depth)
- name: PARAM_SHORT_COMMIT_LENGTH
value: $(params.shortCommitLength)
- name: PARAM_SSL_VERIFY
value: $(params.sslVerify)
- name: PARAM_HTTP_PROXY
Expand Down Expand Up @@ -238,7 +240,7 @@ spec:
-sparseCheckoutDirectories="${PARAM_SPARSE_CHECKOUT_DIRECTORIES}"
cd "${CHECKOUT_DIR}"
RESULT_SHA="$(git rev-parse HEAD)"
RESULT_SHA_SHORT="$(get rev-parse --short=$(params.shortCommitLength) HEAD)"
RESULT_SHA_SHORT="$(get rev-parse --short="${PARAM_SHORT_COMMIT_LENGTH}" HEAD)"
EXIT_CODE="$?"
if [ "${EXIT_CODE}" != 0 ]; then
exit "${EXIT_CODE}"
Expand Down
4 changes: 3 additions & 1 deletion task/git-clone/0.1/git-clone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ spec:
value: $(params.submodules)
- name: PARAM_DEPTH
value: $(params.depth)
- name: PARAM_SHORT_COMMIT_LENGTH
value: $(params.shortCommitLength)
- name: PARAM_SSL_VERIFY
value: $(params.sslVerify)
- name: PARAM_SUBDIRECTORY
Expand Down Expand Up @@ -237,7 +239,7 @@ spec:
-sparseCheckoutDirectories="${PARAM_SPARSE_CHECKOUT_DIRECTORIES}"
cd "${CHECKOUT_DIR}"
RESULT_SHA="$(git rev-parse HEAD)"
RESULT_SHA_SHORT="$(get rev-parse --short=$(params.shortCommitLength) HEAD)"
RESULT_SHA_SHORT="$(get rev-parse --short="${PARAM_SHORT_COMMIT_LENGTH}" HEAD)"
EXIT_CODE="$?"
if [ "${EXIT_CODE}" != 0 ] ; then
exit "${EXIT_CODE}"
Expand Down

0 comments on commit c676f13

Please sign in to comment.