Skip to content

Commit

Permalink
fix(ci): add retry mechanism
Browse files Browse the repository at this point in the history
Sometimes cirrus is not able to download files from the first attempt
  • Loading branch information
truelecter committed Sep 5, 2023
1 parent 411bd00 commit ecabd60
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,25 @@ linux_aarch64_task:

<< : *COMMON_SCRIPTS_TEMPLATE

build_system_script:
- $NIX build ".#nixosConfigurations.nixos-$NIXOS_HOST.config.system.build.toplevel"
build_system_script: |
max_attempts=5
attempt_num=1
success=false
while [ $success = false ] && [ $attempt_num -le $max_attempts ]; do
$NIX build ".#nixosConfigurations.nixos-$NIXOS_HOST.config.system.build.toplevel"
if [ $? -eq 0 ]; then
success=true
else
echo "Attempt $attempt_num failed. Trying again..."
attempt_num=$(( attempt_num + 1 ))
fi
done
if [ $success = false ]; then
exit 1
fi
# build_devshell_script:
# - $NIX develop --command "menu"
Expand Down

0 comments on commit ecabd60

Please sign in to comment.