bug fixed

This commit is contained in:
병준 박 2025-04-08 14:56:51 +00:00
parent 2c3cd1a258
commit 4c00956930

View File

@ -94,32 +94,25 @@ spec:
- name: git - name: git
image: $(params.BASE_IMAGE) image: $(params.BASE_IMAGE)
workingDir: $(workspaces.source.path) workingDir: $(workspaces.source.path)
env:
- name: HOME
value: $(params.USER_HOME)
- name: PARAM_VERBOSE
value: $(params.VERBOSE)
- name: PARAM_USER_HOME
value: $(params.USER_HOME)
script: | script: |
#!/usr/bin/env sh #!/usr/bin/env sh
set -eu set -eu
if [ "${PARAM_VERBOSE}" = "true" ] ; then if [ "$(params.VERBOSE)" = "true" ]; then
set -x set -x
fi fi
if [ -f "$(workspaces.basic-auth.path)/.git-credentials" ]; then if [ -f "$(workspaces.basic-auth.path)/.git-credentials" ]; then
cp "$(workspaces.basic-auth.path)/.git-credentials" "${PARAM_USER_HOME}/.git-credentials" cp "$(workspaces.basic-auth.path)/.git-credentials" "$(params.USER_HOME)/.git-credentials"
cp "$(workspaces.basic-auth.path)/.gitconfig" "${PARAM_USER_HOME}/.gitconfig" cp "$(workspaces.basic-auth.path)/.gitconfig" "$(params.USER_HOME)/.gitconfig"
chmod 400 "${PARAM_USER_HOME}/.git-credentials" chmod 400 "$(params.USER_HOME)/.git-credentials"
chmod 400 "${PARAM_USER_HOME}/.gitconfig" chmod 400 "$(params.USER_HOME)/.gitconfig"
fi fi
if [ -f "$(workspaces.ssh-directory.path)" ]; then if [ -d "$(workspaces.ssh-directory.path)" ]; then
cp -R "$(workspaces.ssh-directory.path)" "${PARAM_USER_HOME}/.ssh" cp -R "$(workspaces.ssh-directory.path)" "$(params.USER_HOME)/.ssh"
chmod 700 "${PARAM_USER_HOME}/.ssh" chmod 700 "$(params.USER_HOME)/.ssh"
chmod -R 400 "${PARAM_USER_HOME}/.ssh/*" chmod -R 400 "$(params.USER_HOME)/.ssh/*"
fi fi
if [ -n "$(params.GIT_USER_NAME)" ] && [ -n "$(params.GIT_USER_EMAIL)" ]; then if [ -n "$(params.GIT_USER_NAME)" ] && [ -n "$(params.GIT_USER_EMAIL)" ]; then
@ -130,10 +123,4 @@ spec:
eval '$(params.GIT_SCRIPT)' eval '$(params.GIT_SCRIPT)'
RESULT_SHA="$(git rev-parse HEAD | tr -d '\n')" RESULT_SHA="$(git rev-parse HEAD | tr -d '\n')"
EXIT_CODE="$?"
if [ "$EXIT_CODE" != 0 ]
then
exit $EXIT_CODE
fi
# Make sure we don't add a trailing newline to the result!
printf "%s" "$RESULT_SHA" > "$(results.commit.path)" printf "%s" "$RESULT_SHA" > "$(results.commit.path)"