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

User-scoped credentials cannot be looked up in pipeline

      It's possible to look-up User-scoped credentials in Freestyle jobs with Bindings. The same seems not to work in pipeline jobs.

      node {
          withCredentials([[$class          : 'UsernamePasswordMultiBinding', credentialsId: 'bc047678-37b8-4747-95d8-c1a8b3df51a6',
                            usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
              echo "${env.USERNAME}"
          }
      }
      
      org.jenkinsci.plugins.credentialsbinding.impl.CredentialNotFoundException: bc047678-37b8-4747-95d8-c1a8b3df51a6
      	at org.jenkinsci.plugins.credentialsbinding.MultiBinding.getCredentials(MultiBinding.java:124)
      	at org.jenkinsci.plugins.credentialsbinding.impl.UsernamePasswordMultiBinding.bind(UsernamePasswordMultiBinding.java:68)
      	at org.jenkinsci.plugins.credentialsbinding.impl.BindingStep$Execution.start(BindingStep.java:92)
      

      Plugin versions:
      credentials-binding: 1.9
      credentials: 2.1.5

          [JENKINS-38963] User-scoped credentials cannot be looked up in pipeline

          Martin Vehovsky created issue -
          Martin Vehovsky made changes -
          Summary Original: User-scoped credentials cannot be looked up with pipeline New: User-scoped credentials cannot be looked up in pipeline
          Martin Vehovsky made changes -
          Description Original: It's possible to look-up User-scoped credentials in Freestyle jobs with Bindings. The same seems not to works in pipeline jobs.

          {code:java}
          node {
              withCredentials([[$class : 'UsernamePasswordMultiBinding', credentialsId: 'bc047678-37b8-4747-95d8-c1a8b3df51a6',
                                usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
                  echo "${env.USERNAME}"
              }
          }
          {code}



          {code:java}
          org.jenkinsci.plugins.credentialsbinding.impl.CredentialNotFoundException: bc047678-37b8-4747-95d8-c1a8b3df51a6
          at org.jenkinsci.plugins.credentialsbinding.MultiBinding.getCredentials(MultiBinding.java:124)
          at org.jenkinsci.plugins.credentialsbinding.impl.UsernamePasswordMultiBinding.bind(UsernamePasswordMultiBinding.java:68)
          at org.jenkinsci.plugins.credentialsbinding.impl.BindingStep$Execution.start(BindingStep.java:92)
          {code}
          New: It's possible to look-up User-scoped credentials in Freestyle jobs with Bindings. The same seems not to work in pipeline jobs.

          {code:java}
          node {
              withCredentials([[$class : 'UsernamePasswordMultiBinding', credentialsId: 'bc047678-37b8-4747-95d8-c1a8b3df51a6',
                                usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
                  echo "${env.USERNAME}"
              }
          }
          {code}



          {code:java}
          org.jenkinsci.plugins.credentialsbinding.impl.CredentialNotFoundException: bc047678-37b8-4747-95d8-c1a8b3df51a6
          at org.jenkinsci.plugins.credentialsbinding.MultiBinding.getCredentials(MultiBinding.java:124)
          at org.jenkinsci.plugins.credentialsbinding.impl.UsernamePasswordMultiBinding.bind(UsernamePasswordMultiBinding.java:68)
          at org.jenkinsci.plugins.credentialsbinding.impl.BindingStep$Execution.start(BindingStep.java:92)
          {code}
          Martin Vehovsky made changes -
          Description Original: It's possible to look-up User-scoped credentials in Freestyle jobs with Bindings. The same seems not to work in pipeline jobs.

          {code:java}
          node {
              withCredentials([[$class : 'UsernamePasswordMultiBinding', credentialsId: 'bc047678-37b8-4747-95d8-c1a8b3df51a6',
                                usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
                  echo "${env.USERNAME}"
              }
          }
          {code}



          {code:java}
          org.jenkinsci.plugins.credentialsbinding.impl.CredentialNotFoundException: bc047678-37b8-4747-95d8-c1a8b3df51a6
          at org.jenkinsci.plugins.credentialsbinding.MultiBinding.getCredentials(MultiBinding.java:124)
          at org.jenkinsci.plugins.credentialsbinding.impl.UsernamePasswordMultiBinding.bind(UsernamePasswordMultiBinding.java:68)
          at org.jenkinsci.plugins.credentialsbinding.impl.BindingStep$Execution.start(BindingStep.java:92)
          {code}
          New: It's possible to look-up User-scoped credentials in Freestyle jobs with Bindings. The same seems not to work in pipeline jobs.

          {code:java}
          node {
              withCredentials([[$class : 'UsernamePasswordMultiBinding', credentialsId: 'bc047678-37b8-4747-95d8-c1a8b3df51a6',
                                usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
                  echo "${env.USERNAME}"
              }
          }
          {code}



          {code:java}
          org.jenkinsci.plugins.credentialsbinding.impl.CredentialNotFoundException: bc047678-37b8-4747-95d8-c1a8b3df51a6
          at org.jenkinsci.plugins.credentialsbinding.MultiBinding.getCredentials(MultiBinding.java:124)
          at org.jenkinsci.plugins.credentialsbinding.impl.UsernamePasswordMultiBinding.bind(UsernamePasswordMultiBinding.java:68)
          at org.jenkinsci.plugins.credentialsbinding.impl.BindingStep$Execution.start(BindingStep.java:92)
          {code}

          Plugin versions:
          _credentials-binding: 1.9_
          _credentials: 2.1.5_
          Jesse Glick made changes -
          Labels New: pipeline
          Jesse Glick made changes -
          Labels Original: pipeline New: documentation pipeline
          Cyrille Le Clerc made changes -
          Link New: This issue is related to JENKINS-44772 [ JENKINS-44772 ]
          James Dumay made changes -
          Labels Original: documentation pipeline New: cloudbees-internal-pipeline documentation pipeline
          James Dumay made changes -
          Remote Link New: This issue links to "Jenkins Users post (Web Link)" [ 17280 ]
          Ben Dean made changes -
          Link New: This issue is related to JENKINS-47699 [ JENKINS-47699 ]
          CloudBees Inc. made changes -
          Remote Link New: This issue links to "CloudBees Internal CLTS-1179 (Web Link)" [ 19151 ]

            Unassigned Unassigned
            vehovmar Martin Vehovsky
            Votes:
            28 Vote for this issue
            Watchers:
            34 Start watching this issue

              Created:
              Updated:
              Resolved: