diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e9b3be1..4eaf8b7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -38,4 +38,9 @@ clean-job: # This job runs in the build stage, which runs first. script: - rm -rf /home/gitlab-runner/builds/* rules: - - if: '$CI_COMMIT_MESSAGE =~ /build/' \ No newline at end of file + - if: '$CI_COMMIT_MESSAGE =~ /build/' +cleanup_on_failure_job: + stage: clean # Should be in a later stage than the job that might fail + when: on_failure # <-- This is the key keyword + script: + - rm -rf /home/gitlab-runner/builds/* \ No newline at end of file