• Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Blocker Blocker
    • None
    • Jenkins 2.332.2
      Credentials Binding Plugin Version: 1.27.1
      Credentials Plugin Version: 1087.v16065d268466
      Pipeline: Step API Version: 622.vb_8e7c15b_c95a_

      I get execption in following pipeline script:

       

      def checkJira() { withCredentials([usernamePassword(credentialsId: 'jira-http', passwordVariable: 'JIRA_PW', usernameVariable: 'JIRA_USER')]) { echo "Expect error: ${JIRA_USER}" }
      

       

      groovy.lang.MissingPropertyException: No such property: JIRA_USER for class: groovy.lang.Binding at groovy.lang.Binding.getVariable(Binding.java:63) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:271) at org.kohsuke.groovy.sandbox.impl.Checker$7.call(Checker.java:353) at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:357) at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:333) at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.getProperty(SandboxInvoker.java:29) at com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:20) at Script1.checkJira(Script1.groovy:3) at ___cps.transform___(Native Method) at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:74) at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30) at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66) at jdk.internal.reflect.GeneratedMethodAccessor309.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72) at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21) at com.cloudbees.groovy.cps.Next.step(Next.java:83) at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174) at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163) at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:136) at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:275) at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:51) at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:187) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:420) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$400(CpsThreadGroup.java:95) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:330) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:294) at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:67) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:139) at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28) at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829)
      

          [JENKINS-68237] No such property error

          Robert Pofuk added a comment - - edited

          Interesting if i try to print JIRA_PW i get same error. 
          I also see in log message  "Masking supported pattern matches of $JIRA_PW "

           

          [Pipeline] }
          [Pipeline] // load
          [Pipeline] withCredentials
          Masking supported pattern matches of $JIRA_PW
          [Pipeline] {
          [Pipeline] }
          [Pipeline] // withCredentials
          [Pipeline] }
          [Pipeline] // stage
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] End of Pipeline
          groovy.lang.MissingPropertyException: No such property: JIRA_PW for class: groovy.lang.Binding
          
          

          Robert Pofuk added a comment - - edited Interesting if i try to print JIRA_PW i get same error.  I also see in log message  "Masking supported pattern matches of $JIRA_PW "   [Pipeline] } [Pipeline] // load [Pipeline] withCredentials Masking supported pattern matches of $JIRA_PW [Pipeline] { [Pipeline] } [Pipeline] // withCredentials [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline groovy.lang.MissingPropertyException: No such property: JIRA_PW for class: groovy.lang.Binding

          Jonas added a comment -

          We had a similar issue recently. In our case it was a secret text instead of username + password but it may be the same issue. Our root cause was that we assigned a null value (maybe it also just resolved to an empty string) to the variable by using configuration as code. So, Jenkins successfully retrieved a credential object but it was null.

           

          Also: We got the "Masking supported pattern [...]" output and the same error. So maybe it's rather a bad error message.

          Jonas added a comment - We had a similar issue recently. In our case it was a secret text instead of username + password but it may be the same issue. Our root cause was that we assigned a null value (maybe it also just resolved to an empty string) to the variable by using configuration as code. So, Jenkins successfully retrieved a credential object but it was null.   Also: We got the "Masking supported pattern [...] " output and the same error. So maybe it's rather a bad error message.

            Unassigned Unassigned
            rpofuk Robert Pofuk
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: