Matrix variables no longer available during rules: evaluation (regression)
Summary
Matrix variables defined under parallel:matrix are no longer available during rules: evaluation.
As a result, rules: conditions that previously disabled specific matrix jobs (e.g. based on DISABLE_BUILD flags) no longer work, and GitLab always creates all matrix job instances regardless of the variable values.
This behavior is a regression: it worked correctly earlier (at least until mid-November 2025), and nothing in GitLab documentation suggests that matrix variables should be unavailable to rules.
Steps to reproduce
- Create a job using
parallel:matrixwith a variable, e.g.DISABLE_BUILD: "true". - Add
rules:that check the matrix variable:rules: - if: '$DISABLE_BUILD == "true"' when: never - Trigger a pipeline.
- Observe that all matrix jobs are created, including those where
DISABLE_BUILD="true".
Minimal example:
variables:
DISABLE_ARM64_BUILD: "true"
build:
stage: build
parallel:
matrix:
- ARCH: "amd64"
DISABLE_BUILD: $DISABLE_AMD64_BUILD
- ARCH: "arm64"
DISABLE_BUILD: $DISABLE_ARM64_BUILD
script:
- echo "Building $ARCH"
rules:
- if: '$DISABLE_BUILD == "true"'
when: never
- when: on_success
Example Project
A minimal reproduction repository can be provided on GitLab.com if needed.
What is the current bug behavior?
-
rules:does not see matrix variables. - Conditions like
if: $DISABLE_BUILD == "true"always evaluate as empty, not"true". - GitLab creates all matrix job instances, even those that should be disabled.
What is the expected correct behavior?
- Matrix variables should be available during
rules:evaluation, as they were before. - Jobs whose matrix item sets a disable flag should be skipped entirely, not created.
Relevant logs and/or screenshots
The issue occurs during the job creation phase, before any logs are produced.
GitLab UI shows all matrix jobs being created, even those where DISABLE_BUILD="true".
Possible fixes
This likely relates to the order of evaluation for matrix expansion vs rules:.
Restoring previous behavior where matrix variables were injected before rules evaluation would fix the issue.