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

User-scoped credentials cannot be looked up in pipeline

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      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

        Attachments

          Issue Links

            Activity

            vehovmar Martin Vehovsky created issue -
            vehovmar Martin Vehovsky made changes -
            Field Original Value New Value
            Summary User-scoped credentials cannot be looked up with pipeline User-scoped credentials cannot be looked up in pipeline
            vehovmar Martin Vehovsky made changes -
            Description 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}
            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}
            vehovmar Martin Vehovsky made changes -
            Description 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}
            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_
            jglick Jesse Glick made changes -
            Labels pipeline
            jglick Jesse Glick made changes -
            Labels pipeline documentation pipeline
            cleclerc Cyrille Le Clerc made changes -
            Link This issue is related to JENKINS-44772 [ JENKINS-44772 ]
            jamesdumay James Dumay made changes -
            Labels documentation pipeline cloudbees-internal-pipeline documentation pipeline
            jamesdumay James Dumay made changes -
            Remote Link This issue links to "Jenkins Users post (Web Link)" [ 17280 ]
            b_dean Ben Dean made changes -
            Link This issue is related to JENKINS-47699 [ JENKINS-47699 ]
            cloudbees CloudBees Inc. made changes -
            Remote Link This issue links to "CloudBees Internal CLTS-1179 (Web Link)" [ 19151 ]
            jglick Jesse Glick made changes -
            Link This issue relates to JENKINS-44774 [ JENKINS-44774 ]
            wfollonier Wadeck Follonier made changes -
            Link This issue relates to JENKINS-58170 [ JENKINS-58170 ]
            jvz Matt Sicker made changes -
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Resolved [ 5 ]

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              vehovmar Martin Vehovsky
              Votes:
              28 Vote for this issue
              Watchers:
              33 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: