Implement variables for pipeline workflow rules [RUN ALL RSPEC] [RUN AS-IF-FOSS]
-
Review changes -
-
Download -
Patches
-
Plain diff
All threads resolved!
What does this MR do?
This is another approach for #294232 (closed). First approach: !50682 (closed).
Refactor has been done before this MR => !57136 (merged)
This MR implements the variables
keyword for rules
of pipeline workflow. This is only for workflow:rules, the previous MR implemented for job:rules
.
- Added
root_variables
toPipeline::Chain::Command
to store variables defined in YAML.- Initially, assigned
result.workflow_attributes[:yaml_variables]
inlib/gitlab/ci/pipeline/chain/config/process.rb
.
- Initially, assigned
- Added logic in
lib/gitlab/ci/pipeline/chain/evaluate_workflow_rules.rb
that applying rules for workflow by changing theroot_variables
ofPipeline::Chain::Command
. - We have logic in
lib/gitlab/ci/config/entry/processable.rb
that merging root variables with job variables.- Kept the
variables
attribute the same for now. It will be removed with #300581 (closed). - Added
job_variables
return only job variables. - Added
variable_inheritance
to handle this inseed/build
.
- Kept the
- Then, added logic in
lib/gitlab/ci/pipeline/seed/build.rb
to override only variables fromroot
.
Why did I choose this way?
- Our
inherit
logic is inlib/gitlab/ci/config/entry/processable.rb
. - However, we have the result of
rules
in the "create pipeline" logic and we need that result to override workflow variables. - We need to use the variables from the result of
rules
to override the job variables from the workflow. - We know the result of
workflow:variables
/workflow:rules:variables
inseed/build
. - We need to merge root variables into job variables only if they are a part of "inheritance".
- Another comment: !52085 (comment 506395096)
-
ci_workflow_rules_variables
feature flag issue => #300997 (closed)
Screenshots (strongly suggested)
variables:
VAR1: my var 1
VAR2: my var 2
workflow:
rules:
- if: $CI_COMMIT_REF_NAME =~ /master/
variables:
VAR1: overridden var 1
- if: $CI_COMMIT_REF_NAME =~ /feature/
variables:
VAR2: overridden var 2
VAR3: new var 3
- when: always
If the first condition is satisfied, then the total variables will be:
- VAR1: overridden var 1
- VAR2: my var 2
If the second condition is satisfied, then the total variables will be:
- VAR1: my var 1
- VAR2: overridden var 2
- VAR3: new var 3
If no condition is satisfied, then the total variables will be:
- VAR1: my var 1
- VAR2: my var 2
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
Edited by Furkan Ayhan
Merge request reports
Compare and
Show latest version
- version 281eb166cc
- version 271eb166cc
- version 26ed23b9fe
- version 2583938aa5
- version 2444b84259
- version 23640d81ac
- version 2273455f57
- version 211ea4af93
- version 20d51ab2e6
- version 1963bdb0a6
- version 1863bdb0a6
- version 175d0fe693
- version 16b4adae20
- version 15847bb107
- version 1444863cdd
- version 13ae4a930c
- version 1290e22635
- version 111d1c1d63
- version 10ac776b0d
- version 9e4a21f03
- version 843a9fb60
- version 7ae2ec8ec
- version 6dfe80b11
- version 5dadbf84f
- version 405f958bc
- version 3109f72b4
- version 200138d93
- version 1115b7fc0
- master (base)
- latest version4f3a7d7b1 commit,
- version 281eb166cc1 commit,
- version 271eb166cc1 commit,
- version 26ed23b9fe9 commits,
- version 2583938aa56 commits,
- version 2444b842595 commits,
- version 23640d81ac5 commits,
- version 2273455f575 commits,
- version 211ea4af933 commits,
- version 20d51ab2e61 commit,
- version 1963bdb0a61 commit,
- version 1863bdb0a61 commit,
- version 175d0fe6931 commit,
- version 16b4adae201 commit,
- version 15847bb1071 commit,
- version 1444863cdd1 commit,
- version 13ae4a930c4 commits,
- version 1290e226354 commits,
- version 111d1c1d633 commits,
- version 10ac776b0d2 commits,
- version 9e4a21f037 commits,
- version 843a9fb607 commits,
- version 7ae2ec8ec6 commits,
- version 6dfe80b114 commits,
- version 5dadbf84f4 commits,
- version 405f958bc3 commits,
- version 3109f72b42 commits,
- version 200138d931 commit,
- version 1115b7fc01 commit,
Compare changes
- Side-by-side
- Inline
There are no changes yet
No changes between version 6 and version 6
Loading