Change pipeline source keyword to trigger
What does this MR do and why?
Change pipeline source keyword to trigger
. Follow up from !4414 (merged).
According to https://docs.gitlab.com/ee/ci/triggers/index.html#configure-cicd-jobs-to-run-in-triggered-pipelines, the keyword to CI_PIPELINE_SOURCE
value should be trigger
for upstream review apps.
How to set up and validate locally
IMPORTANT: Clone this repository in a new location, as the rake task will overwrite the doc repositories.
- We have the following variables that are either set or not:
-
REMOVE_BEFORE_CLONE
: effectively the same asCI
, so this is always true in the job's context. -
CI_PIPELINE_SOURCE=trigger
: only true when an upstream review app is running. -
MERGE_REQUEST_IID_<product>
: only true when an upstream review app is running. -
BRANCH_<product>
: only true when an upstream review app is running. -
CI_COMMIT_REF_NAME
: whether thegitlab-docs
pipeline runs inmain
, an MR, or a stable branch.
If a variable is not in a command below, it means it's not explicitly set.
-
Hourly pipeline running in
main
ofgitlab-docs
, or when we merge an MR ofgitlab-docs
intomain
(clone all):REMOVE_BEFORE_CLONE=true \ CI_COMMIT_REF_NAME=main \ bundle exec rake default
-
Pipeline running in a stable branch of
gitlab-docs
(clone all stable branches):REMOVE_BEFORE_CLONE=true \ CI_COMMIT_REF_NAME=16.6 \ bundle exec rake default
-
Merge request pipeline in
gitlab-docs
(clone all):REMOVE_BEFORE_CLONE=true \ CI_COMMIT_REF_NAME=test-branch \ bundle exec rake default
-
Review app in one of the upstream projects (clone only runner):
REMOVE_BEFORE_CLONE=true \ CI_COMMIT_REF_NAME=main \ CI_PIPELINE_SOURCE=trigger \ MERGE_REQUEST_IID_RUNNER=4492 \ BRANCH_RUNNER=DarrenEastman-main-patch-76a4 \ TOP_UPSTREAM_SOURCE_PROJECT='gitlab-org/gitlab-runner' \ bundle exec rake default
In all cases, except the last one, CI_PIPELINE_SOURCE
, MERGE_REQUEST_IID_<product>
, and BRANCH_<product>
are not set.
The logic is that when you run a review app from an upstream product, CI_PIPELINE_SOURCE=trigger
is always true for the given gitlab-docs
pipeline. Then, only one of the 5 products gets the MERGE_REQUEST_IID_<product>
and BRANCH_<product>
set, which means the code branch == product["default_branch"]
will be set to false, and so it will not be skipped. For the 4 rest of them, the code branch == product["default_branch"]
will be set to true, and so they'll be skipped.
Merge request acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this merge request.