Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-13347

Build Name returns 'Unrecognized macro' errors for everything except ${BUILD_NUMBER}

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • Windows 2008 R2 SP1 x64
      Java 1.6.0_31 x64 from Oracle
      Tomcat 6.0.35
      Jenkins 1.458, freshly installed and never upgraded
      SVN

      My Jenkins instance/project are working just fine and builds work as expected.
      Now I try to use the "build-name-setter" plugin. My goal is to have build names like "svn123build9879".

      I installed the plugin via the plugin manager, and set the new "Build Name" field to "svn${SVN_REVISION}build${BUILD_NUMBER}" (without quotes). It looks like the expected syntax, and I can see ${SVN_REVISION} in my env-vars.html
      However, this leads to the following error in the console log:
      Unrecognized macro 'SVN_REVISION' in 'svn${SVN_REVISION}build${BUILD_NUMBER}'

      I'm available for more info. I searched for similar bugs, sorry if that's not a but but just a misconfiguration, please point me to what you think might be wrong.

          [JENKINS-13347] Build Name returns 'Unrecognized macro' errors for everything except ${BUILD_NUMBER}

          Ronan Jouchet added a comment - - edited

          Actually my problem is not related to SVN_REVISION. All macros seem to fail: setting build-name=${BUILD_NUMBER}-${JOB_NAME} returns this:
          Unrecognized macro 'JOB_NAME' in '${BUILD_NUMBER}-${JOB_NAME}'

          Ronan Jouchet added a comment - - edited Actually my problem is not related to SVN_REVISION. All macros seem to fail: setting build-name=${BUILD_NUMBER}-${JOB_NAME} returns this: Unrecognized macro 'JOB_NAME' in '${BUILD_NUMBER}-${JOB_NAME}'

          Workaround:

          ${ENV,var="SVN_REVISION"}

          Note: When using multiple Subversion locations, the environment variables are names such as:

          SVN_REVISION_1, SVN_REVISION_2, ...

          assembling waves added a comment - Workaround: ${ENV, var = "SVN_REVISION" } Note: When using multiple Subversion locations, the environment variables are names such as: SVN_REVISION_1, SVN_REVISION_2, ...

          Ronan Jouchet added a comment -

          Works! I think the more general bug remains valid, so I won't close yet.
          Thanks for the help

          Ronan Jouchet added a comment - Works! I think the more general bug remains valid, so I won't close yet. Thanks for the help

          Glad I could help. I looked up the environment variables for the project by calling:
          http://localhost:8080/env-vars.html/?

          assembling waves added a comment - Glad I could help. I looked up the environment variables for the project by calling: http://localhost:8080/env-vars.html/?

          Juraj Misur added a comment -

          I have a release build where I can specify release version via "Release_version" string parameter and I want use that one for setting build name using this parameter as ${Release_version}. That would be super cool. Would the ENV hack work here?

          Juraj Misur added a comment - I have a release build where I can specify release version via "Release_version" string parameter and I want use that one for setting build name using this parameter as ${Release_version}. That would be super cool. Would the ENV hack work here?

          Eric Pyle added a comment -

          I believe this is actually the Token Macro plugin. I encountered this in a change made to an existing job, adding a Conditional Step to trigger a build of another job an existing set of Post-Build Script steps. The build is triggered with two predefined parameters, the first of which is $JOB_NAME. Here's the error from the console log:

          09:45:17 Exception caught evaluating condition: [org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Unrecognized macro 'JOB_NAME' in '${JOB_NAME}'], action = [Fail the build]
          09:45:17 Build step 'Use publishers from another project' changed build result to FAILURE
          09:45:17 Build step 'Use publishers from another project' marked build as failure

          I'm running Jenkins 1.466.2 on a Linux platform, Token Macro plugin version 1.5.1, PostBuildScript plugin version 0.7.

          Eric Pyle added a comment - I believe this is actually the Token Macro plugin. I encountered this in a change made to an existing job, adding a Conditional Step to trigger a build of another job an existing set of Post-Build Script steps. The build is triggered with two predefined parameters, the first of which is $JOB_NAME. Here's the error from the console log: 09:45:17 Exception caught evaluating condition: [org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Unrecognized macro 'JOB_NAME' in '${JOB_NAME}'] , action = [Fail the build] 09:45:17 Build step 'Use publishers from another project' changed build result to FAILURE 09:45:17 Build step 'Use publishers from another project' marked build as failure I'm running Jenkins 1.466.2 on a Linux platform, Token Macro plugin version 1.5.1, PostBuildScript plugin version 0.7.

          Alex Earl added a comment -

          Are you saying that JOB_NAME is a parameter to the job itself?

          Alex Earl added a comment - Are you saying that JOB_NAME is a parameter to the job itself?

          Lev Mishin added a comment -

          As was written above:

          Workaround:
          ${ENV,var="SVN_REVISION"}

          but it is not a workaround it is normally for Token macro plugin, so the bug is not related to build name setter

          Lev Mishin added a comment - As was written above: Workaround: ${ENV,var="SVN_REVISION"} but it is not a workaround it is normally for Token macro plugin, so the bug is not related to build name setter

            le0 Lev Mishin
            ronj Ronan Jouchet
            Votes:
            5 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: