Runner policy enforceable job cleanup for all executor types
Summary
User wants to be be able to configure specific runners to clean up job work dir before/after job in that way that it cannot be overridden in the project config. Whether we do this with a FF or some other mechanism is up for discussion.
Proposal
-
FF_ENABLE_JOB_CLEANUPfeature flag (disabled by default) should always run when set totrue. Regardless whether the job succeeds, is canceled or fails. - The FF should run the same for all Runner executors
- The FF behavior should remain as described in the related issue
I.e. being able to:
- Force
FF_ENABLE_JOB_CLEANUP - Override the default OS cleanup command for Linux and Windows
This is currently only possible when:
- The
FF_ENABLE_JOB_CLEANUPFF is enabled in the Runnerconfig.toml -
GIT_STRATEGY: cloneis set- In the project Settings -> CI/CD -> General pipelines
- In the
.gitlab-ci.ymlor included pipeline template file as a CI variable
NOTE: FF FF_USE_WINDOWS_LEGACY_PROCESS_STRATEGY does not have an effect on the outcome and was used for testing different scenarios. Only GIT_STRATEGY: clone allows CI_PROJECT_DIR cleanup BEFORE and AFTER the job. Without it set NO cleanup occurs.
Happy medium solution
Current behavior
When only configuring the FF_ENABLE_JOB_CLEANUP FF in the Runner config.toml, w/ Git strategy set to fetch (as default), the outcome is no folders cleaned
CI_PROJECT_DIR
CI_PROJECT_DIR files
Expected behavior
The FF_ENABLE_JOB_CLEANUP FF cleans/removes the CI_PROJECT_DIR after the job, regardless whether Git strategy is set to fetch or clone.
CI_PROJECT_DIR .tmp folder remaining file (without Git data or any secrets)


