-
Bug
-
Resolution: Unresolved
-
Major
-
None
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?
I'm seeing this issue too in Token Macro v2.3 and Matrix v1.12.
For me, it looks like everything works as expected in the jobs that are defined by each configuration of the matrix (they kick off the appropriate jobs), however the parent job that kicks off the configurations shows the same error as above. I've only seen it when trying to conditionally kick off a job and the condition used the macro as part of its evaluation criteria. For example, mine was using a File Exists check that looked for a name based on the matrix axis.
As a workaround, I converted my build conditional step to check a shell command rather than checking through the built-in File Exists.