Matrix Axes, Labels, and Capacity

Scenario: Copied stages test several runtimes but silently omit one supported operating-system combination.

Pipeline example

matrix { axes { axis { name 'RUNTIME'; values '18','20' } }; agent { label "node-${RUNTIME}" }; stages { stage('Test') { steps { sh 'npm test' } } } }

Axes create a Cartesian test plan

Declarative matrix defines named axes and values, then runs its nested stages for every combination. Two operating systems and three runtimes create six cells. Axis values become environment variables and can drive an agent expression such as os-${OS} && node-${RUNTIME}. Label vocabulary and axis values therefore form a scheduling contract.

Excludes remove unsupported combinations in Pipeline structure. An exclude combines axis filters, while notValues can express all values except a set. Excluding Windows with runtime 18 is clearer than a shell condition that silently skips work. Review the generated cell count whenever adding an axis because Cartesian growth quickly consumes executors and service quotas.

Preserve cell identity

Matrix cells may have their own agent, environment, options, when, stages, and post behavior. Put axis values in report, stash, and artifact names so cells cannot overwrite each other. Choose fail-fast only after deciding whether saving capacity outweighs the complete compatibility picture.

For a missing cell inspect excludes and when. For a queued cell read its fully expanded label and agent availability. Track results by combination over time; a failure isolated to Windows and one JDK is actionable evidence that a single aggregate red result conceals.

Goal: Practice the concrete behavior in jenkins-labeled-parallel-tests. Learn sections have no Jenkins terminal; the Jenkins lab opens the real shared service in a new full-screen tab inside your private folder.