ITADN

Implement workflow:rules:variables

#1832Openbcouetil 创建于 2026-04-19
B
bcouetilcommented
Again, a small contribution to this wonderful tool. PR incoming. **Is your feature request related to a problem? Please describe.** Variables defined in `workflow:rules` are silently ignored. In GitLab CI, when a `workflow:rules` entry matches, its `variables` are merged into the global variables and made available to all jobs. Currently, gitlab-ci-local evaluates `workflow:rules` for pipeline inclusion/exclusion but discards any `variables` defined on matching rules. For example, this configuration does not set `DEPLOY_ENV` in jobs: ```yaml workflow: rules: - if: $CI_COMMIT_BRANCH == "main" variables: DEPLOY_ENV: production - when: always deploy: script: - echo "Deploying to $DEPLOY_ENV" ``` **Describe the solution you'd like** After evaluating `workflow:rules`, merge the matched rule's `variables` into `gitlabData.variables` (the global variables passed to all jobs). These variables should: - Be available to all jobs as global variables - Be overridable by job-level variables (respecting GitLab CI precedence) - Not be applied when no rule matches **Describe alternatives you've considered** Duplicating the variables in the top-level `variables:` section as a workaround, but this defeats the purpose of conditional workflow variables. **Additional context** GitLab documentation: https://docs.gitlab.com/ci/yaml/#workflowrulesvariables
0 条评论