From 4c00956930f6323cf484860e528aac714b9361dc Mon Sep 17 00:00:00 2001 From: BAK BYEONG JUN Date: Tue, 8 Apr 2025 14:56:51 +0000 Subject: [PATCH] bug fixed --- tasks/git/task.yaml | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/tasks/git/task.yaml b/tasks/git/task.yaml index 45312b0..e175924 100644 --- a/tasks/git/task.yaml +++ b/tasks/git/task.yaml @@ -94,32 +94,25 @@ spec: - name: git image: $(params.BASE_IMAGE) 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: | #!/usr/bin/env sh set -eu - if [ "${PARAM_VERBOSE}" = "true" ] ; then + if [ "$(params.VERBOSE)" = "true" ]; then set -x fi 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)/.gitconfig" "${PARAM_USER_HOME}/.gitconfig" - chmod 400 "${PARAM_USER_HOME}/.git-credentials" - chmod 400 "${PARAM_USER_HOME}/.gitconfig" + cp "$(workspaces.basic-auth.path)/.git-credentials" "$(params.USER_HOME)/.git-credentials" + cp "$(workspaces.basic-auth.path)/.gitconfig" "$(params.USER_HOME)/.gitconfig" + chmod 400 "$(params.USER_HOME)/.git-credentials" + chmod 400 "$(params.USER_HOME)/.gitconfig" fi - if [ -f "$(workspaces.ssh-directory.path)" ]; then - cp -R "$(workspaces.ssh-directory.path)" "${PARAM_USER_HOME}/.ssh" - chmod 700 "${PARAM_USER_HOME}/.ssh" - chmod -R 400 "${PARAM_USER_HOME}/.ssh/*" + if [ -d "$(workspaces.ssh-directory.path)" ]; then + cp -R "$(workspaces.ssh-directory.path)" "$(params.USER_HOME)/.ssh" + chmod 700 "$(params.USER_HOME)/.ssh" + chmod -R 400 "$(params.USER_HOME)/.ssh/*" fi if [ -n "$(params.GIT_USER_NAME)" ] && [ -n "$(params.GIT_USER_EMAIL)" ]; then @@ -130,10 +123,4 @@ spec: eval '$(params.GIT_SCRIPT)' 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)" \ No newline at end of file