gitlab-ci: Use rules: instead of except:/only: for test-docs job
authorMichel Dänzer <mdaenzer@redhat.com>
Mon, 22 Jun 2020 09:13:05 +0000 (11:13 +0200)
committerMarge Bot <eric+marge@anholt.net>
Wed, 1 Jul 2020 14:31:38 +0000 (14:31 +0000)
Only run the job automatically for Marge Bot, otherwise let it be
triggered manually.

v2:
* Never run this job for the main project, since it's only needed in
  pre-merge pipelines.
* Add comment explaining that cases not covered by explicit rules
  default to "when: never".

Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5469>

.gitlab-ci.yml

index 42a969559ef5deb1c1c6af96b2b47023df286408..227a27d9bb67599783ae8b36435197f41367ebce 100644 (file)
@@ -47,13 +47,17 @@ pages:
 test-docs:
   extends: .docs-base
   stage: container+docs
-  except:
-    refs:
-    - master@mesa/mesa
-  only:
-    changes:
-    - docs/**/*
-    - .gitlab-ci.yml
+  rules:
+    - if: '$CI_PROJECT_NAMESPACE == "mesa"'
+      when: never
+    - if: '$GITLAB_USER_LOGIN == "marge-bot"'
+      changes: &docs-or-ci
+      - docs/**/*
+      - .gitlab-ci.yml
+      when: on_success
+    - changes: *docs-or-ci
+      when: manual
+    # Other cases default to never
 
 # When to automatically run the CI
 .ci-run-policy: