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

Continue to get [org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Error processing tokens] after upgrade to 280

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • token-macro-plugin
    • None
    • 285.vff7645a_56ff0

      related to issues

      https://issues.jenkins.io/browse/JENKINS-67862

      https://issues.jenkins.io/browse/JENKINS-67873

       

      Upgraded the Token Macro jenkins plugin to 280.v97a_82642793c but still encountering the error reported in these tickets.

       

      Exception caught evaluating condition: [org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Error processing tokens], action = [Don't run]
      Exception caught evaluating condition: [org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Error processing tokens], action = [Fail the build]
      Build step 'Conditional steps (multiple)' changed build result to FAILURE
      Build step 'Conditional steps (multiple)' marked build as failure

       

       

      Prior to v277 these jobs ran without issue.

      It may be related to the specific syntax in my conditional statement - with is a string beginning with a $.

      See the attached screenshot for details.

       

       

       

       

       

        1. bug.png
          bug.png
          12 kB
        2. ExampleCondition2.png
          ExampleCondition2.png
          28 kB
        3. no_bug.png
          no_bug.png
          12 kB
        4. PluginVersion.png
          PluginVersion.png
          20 kB
        5. TokenMacroConditional.png
          TokenMacroConditional.png
          55 kB

          [JENKINS-67916] Continue to get [org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Error processing tokens] after upgrade to 280

          Alex Earl added a comment -

          ral_openbravo I am also not able to reproduce your issue in a test, can you please give more information?

          Alex Earl added a comment - ral_openbravo  I am also not able to reproduce your issue in a test, can you please give more information?

          Our jenkins server upgraded the plugin to 277 last week and we noticed the issue last Friday. The jenkins admin updated the plugin to 280 expecting the issue to be resolved - but it continued. 280 was in the 'installed' version - so am confident the upgrade was completed correctly. We have since downgraded to v267 and the jobs are running again.

          Just to note - the value set in the the text box was without quotes ("").

          Brendan Farrell added a comment - Our jenkins server upgraded the plugin to 277 last week and we noticed the issue last Friday. The jenkins admin updated the plugin to 280 expecting the issue to be resolved - but it continued. 280 was in the 'installed' version - so am confident the upgrade was completed correctly. We have since downgraded to v267 and the jobs are running again. Just to note - the value set in the the text box was without quotes ("").

          Alex Earl added a comment -

          Right, I used the non-quote version. Can you share any stack traces or anything? 

          Alex Earl added a comment - Right, I used the non-quote version. Can you share any stack traces or anything? 

          Brendan Farrell added a comment - - edited

          A Colleague has recreated this issue on a local jenkins install.

          The following Stack trace is observed.

          {{Mar 03, 2022 4:42:08 P.M. WARNING org.jenkins_ci.plugins.run_condition.BuildStepRunner logEvaluateException
          Exception caught evaluating condition: [org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Error processing tokens], action = [Fail the build]
          org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Invalid identifier in macro
          at org.jenkinsci.plugins.tokenmacro.Parser.parseIdentifier(Parser.java:210)
          at org.jenkinsci.plugins.tokenmacro.Parser.parseDelimitedToken(Parser.java:148)
          at org.jenkinsci.plugins.tokenmacro.Parser.parseToken(Parser.java:111)
          at org.jenkinsci.plugins.tokenmacro.Parser.parse(Parser.java:87)
          Caused: org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Error processing tokens
          at org.jenkinsci.plugins.tokenmacro.Parser.parse(Parser.java:97)
          at org.jenkinsci.plugins.tokenmacro.Parser.process(Parser.java:75)
          at org.jenkinsci.plugins.tokenmacro.Parser.process(Parser.java:68)
          at org.jenkinsci.plugins.tokenmacro.TokenMacro.expand(TokenMacro.java:199)
          at org.jenkinsci.plugins.tokenmacro.TokenMacro.expandAll(TokenMacro.java:237)
          at org.jenkinsci.plugins.tokenmacro.TokenMacro.expandAll(TokenMacro.java:211)
          at org.jenkinsci.plugins.tokenmacro.TokenMacro.expandAll(TokenMacro.java:203)
          at org.jenkins_ci.plugins.run_condition.core.StringsMatchCondition.runPerform(StringsMatchCondition.java:62)
          at org.jenkins_ci.plugins.run_condition.BuildStepRunner$2.evaluate(BuildStepRunner.java:109)
          at org.jenkins_ci.plugins.run_condition.BuildStepRunner$Fail.conditionalRun(BuildStepRunner.java:149)
          at org.jenkins_ci.plugins.run_condition.BuildStepRunner.perform(BuildStepRunner.java:107)
          at org.jenkinsci.plugins.conditionalbuildstep.ConditionalBuilder.perform(ConditionalBuilder.java:134)
          at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
          at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:806)
          at hudson.model.Build$BuildExecution.build(Build.java:198)
          at hudson.model.Build$BuildExecution.doRun(Build.java:163)
          at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:514)
          at hudson.model.Run.execute(Run.java:1888)
          at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          at hudson.model.ResourceController.execute(ResourceController.java:99)
          at hudson.model.Executor.run(Executor.java:432)}}

          Console output as follows

          Run condition [Strings match] enabling prebuild for step [BuilderChain]
          Exception caught evaluating condition: [org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Error processing tokens], action = [Fail the build]
          Build step 'Conditional steps (multiple)' changed build result to FAILURE
          Build step 'Conditional steps (multiple)' marked build as failure

          Brendan Farrell added a comment - - edited A Colleague has recreated this issue on a local jenkins install. The following Stack trace is observed. {{Mar 03, 2022 4:42:08 P.M. WARNING org.jenkins_ci.plugins.run_condition.BuildStepRunner logEvaluateException Exception caught evaluating condition: [org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Error processing tokens] , action = [Fail the build] org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Invalid identifier in macro at org.jenkinsci.plugins.tokenmacro.Parser.parseIdentifier(Parser.java:210) at org.jenkinsci.plugins.tokenmacro.Parser.parseDelimitedToken(Parser.java:148) at org.jenkinsci.plugins.tokenmacro.Parser.parseToken(Parser.java:111) at org.jenkinsci.plugins.tokenmacro.Parser.parse(Parser.java:87) Caused: org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Error processing tokens at org.jenkinsci.plugins.tokenmacro.Parser.parse(Parser.java:97) at org.jenkinsci.plugins.tokenmacro.Parser.process(Parser.java:75) at org.jenkinsci.plugins.tokenmacro.Parser.process(Parser.java:68) at org.jenkinsci.plugins.tokenmacro.TokenMacro.expand(TokenMacro.java:199) at org.jenkinsci.plugins.tokenmacro.TokenMacro.expandAll(TokenMacro.java:237) at org.jenkinsci.plugins.tokenmacro.TokenMacro.expandAll(TokenMacro.java:211) at org.jenkinsci.plugins.tokenmacro.TokenMacro.expandAll(TokenMacro.java:203) at org.jenkins_ci.plugins.run_condition.core.StringsMatchCondition.runPerform(StringsMatchCondition.java:62) at org.jenkins_ci.plugins.run_condition.BuildStepRunner$2.evaluate(BuildStepRunner.java:109) at org.jenkins_ci.plugins.run_condition.BuildStepRunner$Fail.conditionalRun(BuildStepRunner.java:149) at org.jenkins_ci.plugins.run_condition.BuildStepRunner.perform(BuildStepRunner.java:107) at org.jenkinsci.plugins.conditionalbuildstep.ConditionalBuilder.perform(ConditionalBuilder.java:134) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:806) at hudson.model.Build$BuildExecution.build(Build.java:198) at hudson.model.Build$BuildExecution.doRun(Build.java:163) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:514) at hudson.model.Run.execute(Run.java:1888) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:99) at hudson.model.Executor.run(Executor.java:432)}} Console output as follows Run condition [Strings match] enabling prebuild for step [BuilderChain] Exception caught evaluating condition: [org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Error processing tokens] , action = [Fail the build] Build step 'Conditional steps (multiple)' changed build result to FAILURE Build step 'Conditional steps (multiple)' marked build as failure

          Rafa added a comment -

          Alex, could you estimate when this issue could be fixed?

          Rafa added a comment - Alex, could you estimate when this issue could be fixed?

          Alex Earl added a comment -

          No, I haven't been able to reproduce it, so I can't really say when it will be fixed.

          Alex Earl added a comment - No, I haven't been able to reproduce it, so I can't really say when it will be fixed.

          Jernej added a comment -

          We encountered the same issue with upgrade to v280.v97a_82642793c. In the end we found out that the issue was caused by an "unset environment variable" used as a token. We worked around the issue by setting the enviroment variable to a default value and thus ensuring that there are never empty/unset tokens.

          Jernej added a comment - We encountered the same issue with upgrade to v280.v97a_82642793c. In the end we found out that the issue was caused by an "unset environment variable" used as a token. We worked around the issue by setting the enviroment variable to a default value and thus ensuring that there are never empty/unset tokens.

          Brendan Farrell added a comment - - edited

          Some detailed steps from my colleague on how he reproduced the issue.

          Exact steps to reproduce:

          Jenkins version 2.319.3
          Token Macro plugin v280.v97a_82642793c

          1. Create new Freestyle project job
          2. Check the "This project is parameterized" checkbox
          3. Add one "Choice Parameter"

          • Name: token_response
          • Choices:
            Bearer ${$.get_authorisation.response.body.token}
            Bearer ${$.get_authorisation.response.body.access_token}

          4. Under "Build", Add Build step -> Conditional steps (multiple)
          5. In Conditional steps (multiple) entry

          • under "Run?", select "String match" in dropdown

                          String 1: ${token_response}

                          String 2: Bearer ${$.get_authorisation.response.body.access_token}

          • Add a step to run under "Steps to run if condition is met"
            (I've added "Execute Shell" containing "echo hi")

           6. Save config and then Build with Parameters

          Brendan Farrell added a comment - - edited Some detailed steps from my colleague on how he reproduced the issue. Exact steps to reproduce: Jenkins version 2.319.3 Token Macro plugin v280.v97a_82642793c 1. Create new Freestyle project job 2. Check the "This project is parameterized" checkbox 3. Add one "Choice Parameter" Name: token_response Choices: Bearer ${$.get_authorisation.response.body.token} Bearer ${$.get_authorisation.response.body.access_token} 4. Under "Build", Add Build step -> Conditional steps (multiple) 5. In Conditional steps (multiple) entry under "Run?", select "String match" in dropdown                 String 1: ${token_response}                 String 2: Bearer ${$.get_authorisation.response.body.access_token} Add a step to run under "Steps to run if condition is met" (I've added "Execute Shell" containing "echo hi")  6. Save config and then Build with Parameters

          Alex Earl added a comment -

          Thanks, I will try this out!

          Alex Earl added a comment - Thanks, I will try this out!

          Alex Earl added a comment -

          285 was released yesterday that I believe should fix this. It worked in my testing.

          Alex Earl added a comment - 285 was released yesterday that I believe should fix this. It worked in my testing.

            slide_o_mix Alex Earl
            brendanf Brendan Farrell
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: