Fix workflow:rules not accessing passed-upstream and trigger variables
What does this MR do?
Related to #206929 (closed)
Example CI config:
workflow:
rules:
- if: $SOME_VARIABLE
test:
script: echo test
Normally, we should run this pipeline with passing SOME_VARIABLE
in it. However, when running this pipeline with trigger
keyword or trigger API, workflow::rules
can not read the passed variable.
In Ci::CreatePipelineService
, we run https://gitlab.com/gitlab-org/gitlab/-/blob/5aae54af261e21b5a17c04967d8d8f0d84730c60/lib/gitlab/ci/pipeline/chain/seed.rb#L25 in Gitlab::Ci::Pipeline::Chain::Seed
section. seeds_block
is passed through Ci::CreatePipelineService
in the places where some attributes are passed to the to-be-created pipeline. For example; in Ci::PipelineTriggerService
and Ci::CreateDownstreamPipelineService
, we are using it to pass variables.
The problem is, Gitlab::Ci::Pipeline::Chain::EvaluateWorkflowRules
is run before Gitlab::Ci::Pipeline::Chain::Seed
, so the workflow:rules
can't read the variables.
This MR fixes this.
Technical proposal origin: #206929 (comment 399503264)
Screenshots
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team