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

parameterized-remote-trigger-plugin fails token evaluation on credentials with special characters

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • Jenkins version 2.107.3
      Token Macro Plugin 2.5
      Parameterized Remote Trigger Plugin 3.1.1

      When trying to connect to remote Jenkins using a credential with special characters like $ in the password the Token Macro plugin is failing to tokenize the credential.  The password is unfortunately being displayed in the log as well.

      org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Unrecognized macro 'SOME_PASSWORD' in 'SOME_USER:"$SOME_PASSWORD"'
      at org.jenkinsci.plugins.tokenmacro.Parser.processToken(Parser.java:326)
      at org.jenkinsci.plugins.tokenmacro.Action$KiHW1UeqOdqAwZul.run(Unknown Source)
      at org.parboiled.matchers.ActionMatcher.match(ActionMatcher.java:96)
      at org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)
      at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)
      at org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)
      at org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)
      at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)
      at org.parboiled.matchers.FirstOfMatcher.match(FirstOfMatcher.java:41)
      at org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)
      at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)
      at org.parboiled.matchers.FirstOfMatcher.match(FirstOfMatcher.java:41)
      at org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)
      at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)
      at org.parboiled.matchers.ZeroOrMoreMatcher.match(ZeroOrMoreMatcher.java:39)
      at org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)
      at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)
      at org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)
      at org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)
      at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)
      at org.parboiled.parserunners.BasicParseRunner.run(BasicParseRunner.java:72)
      at org.parboiled.parserunners.ReportingParseRunner.runBasicMatch(ReportingParseRunner.java:86)
      at org.parboiled.parserunners.ReportingParseRunner.run(ReportingParseRunner.java:66)
      at org.parboiled.parserunners.AbstractParseRunner.run(AbstractParseRunner.java:81)
      at org.parboiled.parserunners.AbstractParseRunner.run(AbstractParseRunner.java:76)
      at org.jenkinsci.plugins.tokenmacro.Parser.process(Parser.java:68)
      at org.jenkinsci.plugins.tokenmacro.TokenMacro.expand(TokenMacro.java:204)
      at org.jenkinsci.plugins.tokenmacro.TokenMacro.expandAll(TokenMacro.java:234)
      at org.jenkinsci.plugins.tokenmacro.TokenMacro.expandAll(TokenMacro.java:212)
      at org.jenkinsci.plugins.ParameterizedRemoteTrigger.utils.TokenMacroUtils.applyTokenMacroReplacements(TokenMacroUtils.java:18)
      Caused: java.io.IOException
      at org.jenkinsci.plugins.ParameterizedRemoteTrigger.utils.TokenMacroUtils.applyTokenMacroReplacements(TokenMacroUtils.java:22)
      at org.jenkinsci.plugins.ParameterizedRemoteTrigger.utils.Base64Utils.generateAuthorizationHeaderValue(Base64Utils.java:50)
      at org.jenkinsci.plugins.ParameterizedRemoteTrigger.auth2.CredentialsAuth.setAuthorizationHeader(CredentialsAuth.java:125)
      at org.jenkinsci.plugins.ParameterizedRemoteTrigger.utils.HttpHelper.getAuthorizedConnection(HttpHelper.java:316)
      at org.jenkinsci.plugins.ParameterizedRemoteTrigger.utils.HttpHelper.sendHTTPCall(HttpHelper.java:462)
      at org.jenkinsci.plugins.ParameterizedRemoteTrigger.utils.HttpHelper.tryCall(HttpHelper.java:603)
      at org.jenkinsci.plugins.ParameterizedRemoteTrigger.utils.HttpHelper.tryGet(HttpHelper.java:623)
      at org.jenkinsci.plugins.ParameterizedRemoteTrigger.RemoteBuildConfiguration.doGet(RemoteBuildConfiguration.java:918)
      at org.jenkinsci.plugins.ParameterizedRemoteTrigger.RemoteBuildConfiguration.getRemoteJobMetadata(RemoteBuildConfiguration.java:1094)
      at org.jenkinsci.plugins.ParameterizedRemoteTrigger.RemoteBuildConfiguration.performTriggerAndGetQueueId(RemoteBuildConfiguration.java:646)
      at org.jenkinsci.plugins.ParameterizedRemoteTrigger.pipeline.RemoteBuildPipelineStep$Execution.run(RemoteBuildPipelineStep.java:273)
      at org.jenkinsci.plugins.ParameterizedRemoteTrigger.pipeline.RemoteBuildPipelineStep$Execution.run(RemoteBuildPipelineStep.java:249)
      at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:49)
      at hudson.security.ACL.impersonate(ACL.java:290)
      at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:46)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)

       

      I believe this is the same as JENKINS-31237, but I can't view the issue 

          [JENKINS-61273] parameterized-remote-trigger-plugin fails token evaluation on credentials with special characters

          Mike Huang created issue -
          Alex Earl made changes -
          Component/s Original: token-macro-plugin [ 15832 ]
          John Czukkermann made changes -
          Comment [ I am getting the same error.  My pipeline's call to remote trigger looks like this.  The value for the remoteWorkspace variable is set earlier in the pipeline.  The other variables are pipeline parameters.

           
          {code:java}
          triggerRemoteJob(
               auth: CredentialsAuth(credentials: 'the_creds'),
               remoteJenkinsUrl: 'https://jenkins.blah.com',
               job: 'folder/myjob',
               abortTriggeredJob: true,
               parameters:'''
                   RELEASE=$RELEASE
                   DRIVER=$BASE_DRIVER
                  BUILD_ROOT_DIR=$remoteWorkspace
              ''',
               remoteJenkinsName: 'My Jenkins',
               useCrumbCache: true,
               useJobInfoCache: true
           )
          {code}
           

          The error is:
           ERROR: Remote build failed with 'IOException' for the following reason: 'org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Unrecognized macro 'remoteWorkspace' in 'BUILD_ROOT_DIR=$remoteWorkspace''. ]

            cashlalala KaiHsiang Chang
            bbgobie Mike Huang
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: