diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 93dbbfc16923c5a81e0062ec8f7500ca3a0b092e..d223947ffcd6d298e3c6164621bc879963264034 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -59,19 +59,6 @@ include: - if: '$CI_COMMIT_MESSAGE =~ /TRIGGER_JOBS=.*enable-/' - if: '$CI_COMMIT_BRANCH == "master"' -.ci_test_image_build_rules: - rules: - # Automatically rebuild the container image if this file, the Dockerfile, - # the installed requirements or the kaniko template change - - changes: - - Dockerfile - - requirements.txt - - .gitlab/ci_templates/kaniko.yml - # Also rebuild when the CI variable contain this jobs name - # or commit msg contains /TRIGGER_JOBS=.*ci-test-image-build/ - - if: '$TRIGGER_JOBS =~ /ci-test-image-build/' - - if: '$CI_COMMIT_MESSAGE =~ /TRIGGER_JOBS=.*ci-test-image-build/' - # app rules # # Define the rules when/if app specific jobs are run. @@ -241,9 +228,19 @@ ci-test-image-build: url: https://open.greenhost.net:4567/openappstack/openappstack/openappstack-ci:${CI_COMMIT_REF_SLUG} on_stop: delete-image auto_stop_in: 3 weeks + rules: + # Automatically rebuild the container image if this file, the Dockerfile, + # the installed requirements or the kaniko template change + - changes: + - Dockerfile + - requirements.txt + - .gitlab/ci_templates/kaniko.yml + # Also rebuild when the CI variable contain this jobs name + # or commit msg contains /TRIGGER_JOBS=.*ci-test-image-build/ + - if: '$TRIGGER_JOBS =~ /ci-test-image-build/' + - if: '$CI_COMMIT_MESSAGE =~ /TRIGGER_JOBS=.*ci-test-image-build/' extends: - .kaniko_build - - .ci_test_image_build_rules interruptible: true report-ci-image-tag: @@ -722,7 +719,6 @@ terminate-droplet: # image re-build as well delete-image: stage: build - when: manual needs: - job: ci-test-image-build variables: @@ -733,5 +729,15 @@ delete-image: environment: name: image/$CI_COMMIT_REF_SLUG action: stop - extends: - - .ci_test_image_build_rules + rules: + # Copy the rules from ci-test-image-build to prevent broken pipelines when + # that job did not run + - changes: + - Dockerfile + - requirements.txt + - .gitlab/ci_templates/kaniko.yml + when: manual + - if: '$TRIGGER_JOBS =~ /ci-test-image-build/' + when: manual + - if: '$CI_COMMIT_MESSAGE =~ /TRIGGER_JOBS=.*ci-test-image-build/' + when: manual