1
0
Fork 0
forgejo-build/.ci-verify.sh

27 lines
608 B
Bash
Executable File

#!/bin/sh
RETRY_COUNT=30
RETRY_TIME=120
RETRY_LOOPS=0
while [ $RETRY_LOOPS -le $RETRY_COUNT ] ;do
RETRY_LOOPS=$(($RETRY_LOOPS + 1))
CURRENT_COMMIT=$(git submodule status forgejo/ | cut -d ' ' -f2)
CI_VERIFY=$(curl https://sc.cryxtal.org/api/v1/repos/crystal/forgejo/commits/$CURRENT_COMMIT/status | jq --jsonargs .state)
case "$CI_VERIFY" in
'"success"')
echo "CI pipeline passed!"
exit 0
;;
'"pending"')
echo "CI pipeline still pending, checking again in 2 minutes..."
sleep $RETRY_TIME
;;
*)
echo "ERROR: Bad pipeline status $CI_VERIFY"
exit 1
;;
esac
done
exit 255