Skip to content

Commit 25b7ece

Browse files
committed
test with REVISION
1 parent 45f222b commit 25b7ece

File tree

1 file changed

+6
-24
lines changed

1 file changed

+6
-24
lines changed

start.sh

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22

33
exit_trap () {
44
local lc="$BASH_COMMAND" rc=$?
5-
echo "Exit trap triggered with command: [$lc] and exit code [$rc]"
65
if [ "$rc" = 0 ]; then
76
return
87
fi
98
if [ "$CLEAN_GIT_LOCK_FILES" = "true" ] && [ "$IS_RETRY" != "true" ]; then
10-
echo "Cleaning git lock files and retrying the script..."
119
retry_script
1210
exit $?
1311
fi
@@ -19,13 +17,11 @@ retry_script () {
1917
cd ../
2018
rm -rf $CLONE_DIR
2119
export IS_RETRY=true
22-
echo "Re-executing script with arguments: $@"
23-
$0 "$@"
20+
$0 $@
2421
}
2522

2623
git_retry () {
2724
# Retry git on exit code 128
28-
echo "Executing git command with retry logic: $@"
2925
(
3026
set +e
3127
RETRY_ON_SIGNAL=128
@@ -34,31 +30,18 @@ echo "Executing git command with retry logic: $@"
3430
until [[ "$TRY_NUM" -ge "$MAX_TRIES" ]]; do
3531
"${COMMAND[@]}" # Use "${COMMAND[@]}" to preserve arguments with quotes
3632
EXIT_CODE=$?
37-
38-
# Log the command output and error messages
39-
echo "Command output (stdout):"
40-
cat "$OUTPUT_LOG"
41-
echo "Command error (stderr):"
42-
cat "$ERROR_LOG"
43-
4433
if [[ $EXIT_CODE == 0 ]]; then
45-
echo "Command succeeded on attempt $TRY_NUM."
4634
break
4735
elif [[ $EXIT_CODE == "$RETRY_ON_SIGNAL" ]]; then
4836
echo "Failed with Exit Code $EXIT_CODE - try $TRY_NUM "
4937
TRY_NUM=$(( ${TRY_NUM} + 1 ))
5038
sleep $RETRY_WAIT
5139
else
52-
echo "Command failed with exit code $EXIT_CODE. No retry configured for this code."
53-
echo "Failed command: ${COMMAND[*]}"
54-
echo "Exit Code: $EXIT_CODE"
55-
echo "Output Log: $OUTPUT_LOG"
56-
echo "Error Log: $ERROR_LOG"
5740
break
5841
fi
59-
done
60-
return $EXIT_CODE
61-
)
42+
done
43+
return $EXIT_CODE
44+
)
6245
}
6346

6447
upsert_remote_alias () {
@@ -220,9 +203,8 @@ if [ -d "$CLONE_DIR" ]; then
220203
echo "Fetching updates from origin${DEPTH:+ with depth $DEPTH}, skipping tags"
221204
git_retry git fetch origin ${REVISION:+$REVISION} --no-tags ${DEPTH:+ --depth=$DEPTH}
222205
else
223-
echo "Fetching updates from origin"
224-
git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" ${DEPTH:+ --depth=$DEPTH}
225-
echo "DONE Fetching updates from origin"
206+
echo "Fetching updates from origin${DEPTH:+ with depth $DEPTH}"
207+
git_retry git fetch origin ${REVISION:+$REVISION} --tags --prune "+refs/tags/*:refs/tags/*" ${DEPTH:+ --depth=$DEPTH}
226208
fi
227209

228210
git remote set-head origin --auto

0 commit comments

Comments
 (0)