This commit is contained in:
병준 박 2025-04-15 09:42:18 +00:00
parent 3f213642c9
commit f90d7ee523

View File

@ -57,7 +57,7 @@ spec:
- name: deleteExisting
type: string
default: "false"
default: "true"
description: Clean out the contents of the destination directory if it already exists before cloning.
- name: httpProxy
@ -166,12 +166,16 @@ spec:
if [ "$(params.deleteExisting)" = "true" ] && [ -d "$CLONE_DIR" ]; then
echo "[INFO] Deleting existing directory $CLONE_DIR"
rm -rf "$CLONE_DIR"
echo "[INFO] Cloning repository..."
git clone --depth=$(params.depth) $(params.url) "$CLONE_DIR"
cd "$CLONE_DIR"
else
cd "$CLONE_DIR"
git init
git remote add origin $(params.url)
git pull --depth=$(params.depth) origin master --allow-unrelated-histories
fi
echo "[INFO] Cloning repository..."
git clone --depth=$(params.depth) $(params.url) "$CLONE_DIR"
cd "$CLONE_DIR"
if [ -n "$(params.refspec)" ]; then
git fetch origin $(params.refspec)
fi