jenkinsci / jenkinsci/matrix-project-plugin

[JENKINS-50377] Error when using axis as token

Open
#699 2 comments 0 reactions 0 assignees View on GitHub
component:conditional-buildstep-plugin component:dynamic-axis-plugin component:matrix-project-plugin imported-jira-issue priority:major resolution:unresolved
Dominant language
Java
Stars
17
Forks
85
Avg merge
4h 27m
Merged PRs (30d)
5

Description

In Jenkins version 1.651.1 it is possible in a [matrix job|https://wiki.jenkins.io/display/JENKINS/Matrix+Project+Plugin] to use a [conditional-buildstep|https://wiki.jenkins.io/display/JENKINS/Conditional+BuildStep+Plugin] to run a build step to trigger/call builds on other projects and to have as part of the condition the name of an axis (using [token expansion|https://wiki.jenkins.io/display/JENKINS/Token+Macro+Plugin]).  Doing this in our setup causes the following exception:

 Exception caught evaluating condition: [org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Unrecognized macro 'PLATFORM' in '$\{PLATFORM}'], action = [Fail the build]


For example, having an axis named PLATFORM with string values NX3 and LX3 use to be able to be used in a conditional build step comparing two strings where string 1 is ${PLATFORM} and string 2 is hard coded to NX3 or LX3 which would build jobs in the matrices differently:

In addition, adding the same functionality using a dynamic axis would be even better.

Our setup:



  • Jenkins version 2.107.1

  • Matrix plugin version 1.11 or 1.12

  • Token macro plugin v2.3

  • Conditional BuildStep 1.3.6

  • Dynamic axis v1.0.3

Other setup:



  • Jenkins version 1.651.1

  • Will get info on the other versions if it matters when I can

It's a nice feature to have the axis as a token to build the same job differently.  Perhpas similar to the email-ext problem JENKINS-14382?

---
Originally reported by architeuthis, imported from: Error when using axis as token


  • status: Open
  • priority: Major
  • component(s): conditional-buildstep-plugin, dynamic-axis-plugin, matrix-project-plugin
  • resolution: Unresolved
  • votes: 1
  • watchers: 3
  • imported: 2025-12-06

Raw content of original issue

In Jenkins version 1.651.1 it is possible in a [matrix job|https://wiki.jenkins.io/display/JENKINS/Matrix+Project+Plugin] to use a [conditional-buildstep|https://wiki.jenkins.io/display/JENKINS/Conditional+BuildStep+Plugin] to run a build step to trigger/call builds on other projects and to have as part of the condition the name of an axis (using [token expansion|https://wiki.jenkins.io/display/JENKINS/Token+Macro+Plugin]).  Doing this in our setup causes the following exception:



 Exception caught evaluating condition: [org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Unrecognized macro 'PLATFORM' in '$\{PLATFORM}'], action = [Fail the build]



For example, having an axis named PLATFORM with string values NX3 and LX3 use to be able to be used in a conditional build step comparing two strings where string 1 is ${PLATFORM} and string 2 is hard coded to NX3 or LX3 which would build jobs in the matrices differently:

In addition, adding the same functionality using a dynamic axis would be even better.

Our setup:



  • Jenkins version 2.107.1

  • Matrix plugin version 1.11 or 1.12

  • Token macro plugin v2.3

  • Conditional BuildStep 1.3.6

  • Dynamic axis v1.0.3

Other setup:



  • Jenkins version 1.651.1

  • Will get info on the other versions if it matters when I can

It's a nice feature to have the axis as a token to build the same job differently.  Perhpas similar to the email-ext problem JENKINS-14382?

2 attachments

- [build_job_condition.PNG](https://issues.jenkins.io/secure/attachment/41946/build_job_condition.PNG)
> ![build_job_condition.PNG](https://issues.jenkins.io/secure/attachment/41946/build_job_condition.PNG)
- [configuration_matrix_axis.PNG](https://issues.jenkins.io/secure/attachment/41947/configuration_matrix_axis.PNG)
> ![configuration_matrix_axis.PNG](https://issues.jenkins.io/secure/attachment/41947/configuration_matrix_axis.PNG)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the matrix job scenario with the conditional-buildstep, dynamic-axis, and token macro plugins, using an axis named PLATFORM and the reported ${PLATFORM} condition. Trace where the token is evaluated and compare that context with the matrix axis values. Done means the axis token resolves in the conditional build step, including for dynamic axes, without the reported MacroEvaluationException.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, ci-cd
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.