diff options
author | Tim-Philipp Müller <tim@centricular.com> | 2022-10-20 15:39:46 +0300 |
---|---|---|
committer | Jordan Petridis <jordan@centricular.com> | 2022-11-09 21:47:22 +0300 |
commit | 8d1c7cef3ef7ae0d14cb8cc42115b2ecda71dbf0 (patch) | |
tree | 91ee92a944c1c0f7f0760d71d7d72ddb570bcb32 /.gitlab-ci.yml | |
parent | cc8d84330ca5ed43ebc439920f1dc5be3c3746ea (diff) |
ci: add trigger job and only run documentation job post-merge
- require manual trigger to run pipeline on branches and MRs
- require manual trigger to run pipeline post-merge (excl. docs)
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/417
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/965>
Diffstat (limited to '.gitlab-ci.yml')
-rw-r--r-- | .gitlab-ci.yml | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bd709137c..6998e1b31 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -38,12 +38,34 @@ default: interruptible: true stages: + - "trigger" - "prep" - "lint" - "test" - "extras" - "integration" +# This is an empty job that is used to trigger the pipeline. +trigger: + image: alpine:latest + stage: 'trigger' + variables: + GIT_STRATEGY: none + script: + - echo "Trigger job done, now running the pipeline." + rules: + - if: $CI_PIPELINE_SOURCE == "schedule" + # If the MR is assigned to the Merge bot, trigger the pipeline automatically + - if: '$CI_MERGE_REQUEST_ASSIGNEES == "gstreamer-merge-bot"' + # Require explicit action to trigger tests post merge + - if: '$CI_PROJECT_NAMESPACE == "gstreamer" && $CI_COMMIT_BRANCH == "main"' + when: 'manual' + # When the assignee isn't the merge bot, require an explicit action to trigger the pipeline + # to avoid wasting CI resources + - if: '$CI_MERGE_REQUEST_ASSIGNEES != "gstreamer-merge-bot"' + when: 'manual' + allow_failure: false + .debian:11: variables: FDO_DISTRIBUTION_VERSION: 'bullseye-slim' @@ -87,6 +109,8 @@ stages: apt clean && bash ./ci/install-rust-ext.sh && pip install tomli + needs: + - "trigger" rules: - if: '$UPDATE_IMG == null' @@ -281,6 +305,15 @@ documentation: paths: - documentation/ needs: [] + rules: + # Run job if the MR is assigned to the Merge bot or it a post-merge pipeline on main branch + - if: '$CI_MERGE_REQUEST_ASSIGNEES == "gstreamer-merge-bot"' + when: 'always' + - if: '$CI_PROJECT_NAMESPACE == "gstreamer" && $CI_COMMIT_BRANCH == "main"' + when: 'always' + # Require explicit action to trigger otherwise + - if: '$CI_PROJECT_NAMESPACE != "gstreamer" || $CI_COMMIT_BRANCH != "main"' + when: 'manual' # build gst-plugins-rs as a gst-build subproject gst-build: @@ -328,7 +361,8 @@ gst-build: .msvc2019 build: stage: 'test' - needs: [] + needs: + - 'trigger' tags: - 'docker' - 'windows' |