Skip to content

Commit

Permalink
Add basic resilience against failed builds (#72)
Browse files Browse the repository at this point in the history
* Add basic resilience against failed builds due to source changes or wrong cache

* Add basic resilience against failed builds due to source changes or wrong cache, part 2

* Don't loop forever if cleaning doesn't fix the issue

* Revert last commit

* Log what we are doing

Signed-off-by: dr460nf1r3 <root@dr460nf1r3.org>

---------

Signed-off-by: dr460nf1r3 <root@dr460nf1r3.org>
  • Loading branch information
dr460nf1r3 committed Feb 18, 2023
1 parent 0cb52d3 commit 15cb300
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/lib/package-makedir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,17 @@ function pipepkg() {

echo "Starting making ${_pkg}"
({ time makepkg "${_pkg}" --noconfirm; } 2>&1 | tee "${_pkg}.log") \
|| if grep -qP "is not a clone of" "${_pkg}.log"; then
echo 'The cached git repo is invalid, clearing source and retrying.'
clean-srccache "${_pkg}" # To fight failed builds due to changed git source
({ time makepkg "${_pkg}" --noconfirm; } 2>&1 | tee "${_pkg}.log") \
|| true
elif grep -qP "One or more files did not pass the validity check!" "${_pkg}.log"; then
echo 'The cached file did not pass validity check, clearing source and retrying.'
clean-srccache "${_pkg}" # To fight failed builds due to wrong cached files
({ time makepkg "${_pkg}" --noconfirm; } 2>&1 | tee "${_pkg}.log") \
|| true
fi \
|| true # we want to cleanup even if it failed

(deploy "${_pkg}" && db-bump 2>&1 | tee -a "${_pkg}.log") || true
Expand Down

0 comments on commit 15cb300

Please sign in to comment.