From 02db9525e76b9925c9235f01f04e68a7d6a4d8be Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Fri, 20 Nov 2020 14:54:13 +0100 Subject: [PATCH] ci: Replace only/except with rules only/except keywords where deperecated in favor of rules. Since we started using GNOME/gnome-shell!1492 it introduced a second pipeline being run for each commit. Detached pipelines are the only way to access CI_MERGE_REQUEST_* variables, and if we disable normal pipelines you will need to create wip/spam MRs in order to run the tests. This reworked rules makes it so, the normal pipeline needs manual interaction to be started, and the detached/MR pipleines is always run. Part-of: --- .gitlab-ci.yml | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 260af5ad..2aabb9a3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,11 +24,19 @@ variables: LINT_LOG: "eslint-report.xml" JS_LOG: "js-report.txt" -.only_default: &only_default - only: - - branches - - tags - - merge_requests +workflow: + rules: + - if: '$CI_MERGE_REQUEST_IID' + - if: '$CI_COMMIT_TAG' + - if: '$CI_COMMIT_BRANCH' + +.pipeline_guard: &pipeline_guard + rules: + - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' + - if: '$CI_COMMIT_TAG' + - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' + - if: '$CI_COMMIT_BRANCH =~ /^gnome-[0-9-]+$/' + - when: 'manual' check_commit_log: extends: @@ -36,7 +44,7 @@ check_commit_log: stage: pre_review script: - ./.gitlab-ci/check-commit-log.sh - <<: *only_default + <<: *pipeline_guard artifacts: expire_in: 1 week paths: @@ -55,7 +63,7 @@ check-merge-request: else echo "Not a merge request" ; fi - <<: *only_default + <<: *pipeline_guard artifacts: expire_in: 1 week paths: @@ -68,7 +76,6 @@ js_check: script: - find extensions -name '*.js' -exec js78 -c '{}' ';' 2>&1 | tee $JS_LOG - (! grep -q . $JS_LOG) - <<: *only_default artifacts: paths: - ${JS_LOG} @@ -78,7 +85,6 @@ eslint: stage: review script: - eslint -o $LINT_LOG -f junit extensions - <<: *only_default artifacts: paths: - ${LINT_LOG} @@ -90,7 +96,6 @@ build-bundles: needs: ["check_commit_log"] script: - ./export-zips.sh - <<: *only_default artifacts: name: 'Extension bundles' expose_as: 'Get Extension bundles here'