mirror of
https://github.com/vlang/v.git
synced 2025-09-12 08:57:09 -04:00
ci: add logging to .github/workflows/retry.sh
This commit is contained in:
parent
423c39ccb4
commit
2a651396cf
20
.github/workflows/retry.sh
vendored
20
.github/workflows/retry.sh
vendored
@ -1,4 +1,22 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
while ! $@; do "command failed, retrying ..."; sleep 1; done
|
cmd=$@
|
||||||
|
|
||||||
|
function elog() {
|
||||||
|
message=$1
|
||||||
|
printf "%(%Y/%m/%d %H:%M:%S)T | retry.sh $1\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
declare -i iteration=0
|
||||||
|
declare -i max_iterations=9
|
||||||
|
for((iteration=1;iteration<=max_iterations;iteration++)); do
|
||||||
|
elog "iteration: $iteration/$max_iterations, cmd: $cmd"
|
||||||
|
if $cmd; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
elog "command failed, retrying ...";
|
||||||
|
sleep 1;
|
||||||
|
done;
|
||||||
|
|
||||||
|
elog "failed doing $max_iterations iterations of command: $cmd"
|
||||||
|
exit 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user