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>
This commit is contained in:
Tim-Philipp Müller 2022-10-20 13:39:46 +01:00 committed by Jordan Petridis
parent cc8d84330c
commit 8d1c7cef3e

View file

@ -38,12 +38,34 @@ default:
interruptible: true interruptible: true
stages: stages:
- "trigger"
- "prep" - "prep"
- "lint" - "lint"
- "test" - "test"
- "extras" - "extras"
- "integration" - "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: .debian:11:
variables: variables:
FDO_DISTRIBUTION_VERSION: 'bullseye-slim' FDO_DISTRIBUTION_VERSION: 'bullseye-slim'
@ -87,6 +109,8 @@ stages:
apt clean && apt clean &&
bash ./ci/install-rust-ext.sh && bash ./ci/install-rust-ext.sh &&
pip install tomli pip install tomli
needs:
- "trigger"
rules: rules:
- if: '$UPDATE_IMG == null' - if: '$UPDATE_IMG == null'
@ -281,6 +305,15 @@ documentation:
paths: paths:
- documentation/ - documentation/
needs: [] 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 # build gst-plugins-rs as a gst-build subproject
gst-build: gst-build:
@ -328,7 +361,8 @@ gst-build:
.msvc2019 build: .msvc2019 build:
stage: 'test' stage: 'test'
needs: [] needs:
- 'trigger'
tags: tags:
- 'docker' - 'docker'
- 'windows' - 'windows'