From ecabd60b540206750839939f3940bb27e68c3103 Mon Sep 17 00:00:00 2001 From: Andrii Panasiuk Date: Tue, 5 Sep 2023 21:07:12 +0300 Subject: [PATCH] fix(ci): add retry mechanism Sometimes cirrus is not able to download files from the first attempt --- .cirrus.yml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index e6202199..802bb63d 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -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"