From c49137a5dcb09c1cc718bca123c1c850a141d441 Mon Sep 17 00:00:00 2001 From: Michael Ferguson Date: Thu, 28 Sep 2023 14:14:44 -0400 Subject: [PATCH 1/2] Check files exist before removing them in tryit.py --- Signed-off-by: Michael Ferguson --- util/devel/test/apptainer/tryit.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/util/devel/test/apptainer/tryit.py b/util/devel/test/apptainer/tryit.py index 8b7d2ae32ae4..2b813a3cb304 100755 --- a/util/devel/test/apptainer/tryit.py +++ b/util/devel/test/apptainer/tryit.py @@ -135,10 +135,12 @@ def main(): status[name] = statusline if args.cleanup: - printAndLog(log, "Removing {}/image.sif".format(d)); - os.remove("image.sif") - printAndLog(log, "Removing {}/chapel".format(d)); - shutil.rmtree("chapel") + if os.path.exists("image.sif"): + printAndLog(log, "Removing {}/image.sif".format(d)); + os.remove("image.sif") + if os.path.exists("chapel"): + printAndLog(log, "Removing {}/chapel".format(d)); + shutil.rmtree("chapel") printAndLog(log, "") os.chdir(startDir) From 24e4c42c0c15cbfe002295c71e4b19c3fe1c8cdb Mon Sep 17 00:00:00 2001 From: Michael Ferguson Date: Thu, 28 Sep 2023 14:15:06 -0400 Subject: [PATCH 2/2] Add retry logic to git clone/update in container --- Signed-off-by: Michael Ferguson --- .../provision-scripts/chapel-update.sh | 38 +++++++++++++++---- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/util/devel/test/vagrant/provision-scripts/chapel-update.sh b/util/devel/test/vagrant/provision-scripts/chapel-update.sh index 704d2e8f3cab..b8f7b288a08c 100755 --- a/util/devel/test/vagrant/provision-scripts/chapel-update.sh +++ b/util/devel/test/vagrant/provision-scripts/chapel-update.sh @@ -1,10 +1,32 @@ #!/usr/bin/env bash -if [ -d chapel ] -then - echo chapel directory already exists - updating - cd chapel && git checkout main && git pull --ff-only && cd .. && echo UPDATED -else - echo cloning chapel - git clone https://github.com/chapel-lang/chapel && echo CLONED -fi +for try in 1 2 3 4 5 +do + + if [ -d chapel ] + then + echo chapel directory already exists - updating + cd chapel && git checkout main && git pull --ff-only && cd .. && echo UPDATED + else + echo cloning chapel + git clone https://github.com/chapel-lang/chapel && echo CLONED + fi + + if [ $? -eq 0 ] + then + # OK, all done, exit with success + exit 0 + else + echo "Error with git. Pausing for 30s." + sleep 30 + if [ -d chapel ] + then + echo "Deleting the chapel directory that failed update" + rm -rf chapel + fi + fi + +done + +# if we got here, there was an error +exit 1