From e2f57e9abb9fcdf75dc6b79ff5bb7ea390c8a11a Mon Sep 17 00:00:00 2001 From: "russell@unturf.com" Date: Wed, 4 Mar 2026 14:42:29 -0500 Subject: [PATCH] fix: harden rm -rf with retry loop and existence check in CI build --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5085ca1..e6c2f10 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,8 +24,8 @@ build: - cp -pr env/static static - tar -zcf static.tar.gz static # Clean up the directory outside of the gitlab-runner filesystem. - # Retry once on failure — rm -rf can race with background processes on build runners. - - rm -rf /opt/make_post_sell/env || (sleep 2 && rm -rf /opt/make_post_sell/env) + # rm -rf can race with background processes on build runners — verify removal. + - rm -rf /opt/make_post_sell/env; for i in 1 2 3; do [ ! -d /opt/make_post_sell/env ] && break; sleep 2; rm -rf /opt/make_post_sell/env; done; [ ! -d /opt/make_post_sell/env ] # Ensure bin/python symlink exists (Python 3.12 venv may only create python3). - test -f env/bin/python || ln -sf python3 env/bin/python # Clone the virtualenv with virtualenv-clone into the desired location.