fix: harden rm -rf with retry loop and existence check in CI build

This commit is contained in:
russell@unturf.com 2026-03-04 14:42:29 -05:00
parent 17079bd0a8
commit e2f57e9abb

View file

@ -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.