1
0
mirror of https://github.com/lineageos4microg/docker-lineage-cicd synced 2024-11-09 10:09:56 +01:00

Fix #685 Handle repo sync better

Check the returncode. In case of failure call post-build.sh and exit
This commit is contained in:
Pete Fotheringham 2024-09-21 16:40:39 +01:00
parent eeeeaf3717
commit 412c13d0fd

@ -246,13 +246,28 @@ for codename in ${devices//,/ }; do
fi fi
# `repo sync` # `repo sync`
repo_sync_returncode=0
if [ "$CALL_REPO_SYNC" = true ]; then if [ "$CALL_REPO_SYNC" = true ]; then
set +eu
echo ">> [$(date)] Syncing branch repository" | tee -a "$repo_log" echo ">> [$(date)] Syncing branch repository" | tee -a "$repo_log"
repo sync "${jobs_arg[@]}" "${retry_fetches_arg[@]}" --current-branch --force-sync &>> "$repo_log" repo sync "${jobs_arg[@]}" "${retry_fetches_arg[@]}" --current-branch --force-sync &>> "$repo_log"
repo_sync_returncode=$?
set -eu
else else
echo ">> [$(date)] Syncing branch repository disabled" | tee -a "$repo_log" echo ">> [$(date)] Syncing branch repository disabled" | tee -a "$repo_log"
fi fi
if [ $repo_sync_returncode -ne 0 ]; then
echo ">> [$(date)] repo sync failed for $codename, $branch branch" | tee -a "$DEBUG_LOG"
# call post-build.sh so the failure is logged in a way that is more visible
if [ -f /root/userscripts/post-build.sh ]; then
echo ">> [$(date)] Running post-build.sh for $codename" >> "$DEBUG_LOG"
/root/userscripts/post-build.sh "$codename" false "$branch" &>> "$DEBUG_LOG" || echo ">> [$(date)] Warning: post-build.sh failed!"
fi
do_cleanup
continue
fi
if [ "$CALL_GIT_LFS_PULL" = true ]; then if [ "$CALL_GIT_LFS_PULL" = true ]; then
echo ">> [$(date)] Calling git lfs pull" | tee -a "$repo_log" echo ">> [$(date)] Calling git lfs pull" | tee -a "$repo_log"
repo forall -v -c git lfs pull &>> "$repo_log" repo forall -v -c git lfs pull &>> "$repo_log"