This commit is contained in:
병준 박 2025-04-28 12:23:34 +00:00
parent 638300cffe
commit 4cd1d81afe

View File

@ -178,6 +178,7 @@ spec:
test -z "${PARAM_NO_PROXY}" || export NO_PROXY="${PARAM_NO_PROXY}" test -z "${PARAM_NO_PROXY}" || export NO_PROXY="${PARAM_NO_PROXY}"
git config --global --add safe.directory "${WORKSPACE_BASE_PATH}/${PARAM_CONTEXT}" git config --global --add safe.directory "${WORKSPACE_BASE_PATH}/${PARAM_CONTEXT}"
/ko-app/git-init \ /ko-app/git-init \
-url="${PARAM_URL}" \ -url="${PARAM_URL}" \
-revision="${PARAM_REVISION}" \ -revision="${PARAM_REVISION}" \
@ -187,13 +188,19 @@ spec:
-submodules="${PARAM_SUBMODULES}" \ -submodules="${PARAM_SUBMODULES}" \
-depth="${PARAM_DEPTH}" \ -depth="${PARAM_DEPTH}" \
-sparseCheckoutDirectories="${PARAM_SPARSE_CHECKOUT_DIRECTORIES}" -sparseCheckoutDirectories="${PARAM_SPARSE_CHECKOUT_DIRECTORIES}"
cd "${CHECKOUT_DIR}" cd "${CHECKOUT_DIR}"
RESULT_SHA="$(git rev-parse HEAD)"
EXIT_CODE="$?" # 🔥 추가: shallow clone 문제 해결
if [ "${EXIT_CODE}" != 0 ] ; then if [ "${PARAM_DEPTH}" != "0" ] && [ "${PARAM_DEPTH}" != "" ]; then
exit "${EXIT_CODE}" # 로컬 브랜치 강제 생성
git branch --force "${PARAM_REVISION}" "origin/${PARAM_REVISION}" || true
git checkout "${PARAM_REVISION}" || git checkout -b "${PARAM_REVISION}" "origin/${PARAM_REVISION}"
fi fi
RESULT_SHA="$(git rev-parse HEAD)"
RESULT_COMMITTER_DATE="$(git log -1 --pretty=%ct)" RESULT_COMMITTER_DATE="$(git log -1 --pretty=%ct)"
printf "%s" "${RESULT_COMMITTER_DATE}" > "$(results.committer-date.path)" printf "%s" "${RESULT_COMMITTER_DATE}" > "$(results.committer-date.path)"
printf "%s" "${RESULT_SHA}" > "$(results.commit.path)" printf "%s" "${RESULT_SHA}" > "$(results.commit.path)"
printf "%s" "${PARAM_URL}" > "$(results.url.path)" printf "%s" "${PARAM_URL}" > "$(results.url.path)"