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

Docker Pipeline Plugin withRegistry and Authorize Plugin fails to get credentialsId

    XMLWordPrintable

    Details

    • Similar Issues:
    • Released As:
      docker-workflow 1.18

      Description

      When using the Authorization Project plugin and using "Run as Specific User" or "Run as User Who Triggered Build" authorize strategy and the following pipeline code:

      node {
        // success
        withCredentials([usernameColonPassword(credentialsId: '$CredentialsID', variable: 'USERPASS')]) {
          println "${USERPASS}"
        }
      
        //failure
        docker.withRegistry('$Url:$Port', '$CredentialsID') {
          def dockerImage = docker.image('$dockerImageID)
          dockerImage.push('test')
        }
      }
      

      We get an error at the docker.withRegistry step:

      ERROR: Could not find credentials matching bonjwa-docker-artl
      

      Note that the previous step withCredentials is successful.

        Attachments

          Activity

          Show
          allan_burdajewicz Allan BURDAJEWICZ added a comment - Proposed a PR https://github.com/jenkinsci/docker-commons-plugin/pull/68
          Hide
          jglick Jesse Glick added a comment -

          And where are these credentials defined—global, folder, or user store? What is $CredentialsID supposed to be—that actual syntax, or a placeholder for some constant? Steps to reproduce from scratch?

          Show
          jglick Jesse Glick added a comment - And where are these credentials defined—global, folder, or user store? What is $CredentialsID supposed to be—that actual syntax, or a placeholder for some constant? Steps to reproduce from scratch?
          Hide
          piratejohnny Jon B added a comment -

          I'm seeing this error too but I'm not 100% sure if its the same exact problem or not. In my case, I a using the aws credentials plugin in order to leverage the fact my ec2 hosts have an AWS role assigned to them. I fill out the credential with the correct role and then I save it in the global credential namespace, and then when i try it use it, I get:

          ERROR: Could not find credentials matching JENKINS_SLAVE_AWS_ROLE

          Show
          piratejohnny Jon B added a comment - I'm seeing this error too but I'm not 100% sure if its the same exact problem or not. In my case, I a using the aws credentials plugin in order to leverage the fact my ec2 hosts have an AWS role assigned to them. I fill out the credential with the correct role and then I save it in the global credential namespace, and then when i try it use it, I get: ERROR: Could not find credentials matching JENKINS_SLAVE_AWS_ROLE
          Hide
          allan_burdajewicz Allan BURDAJEWICZ added a comment -

          Simplest scenario if you run docker locally would be to:

          • Create global username/password credentials
          • Create a pipeline jobs that consume those credentials:
          node {
              withDockerRegistry([credentialsId: 'docker-creds', url: 'https://index.docker.io/v1/']) {
                  echo "Hello"
              }
          }
          
          • Change the authorization of the Job to "Run as Specific User" or "Run as User Who Triggered Build"
          Show
          allan_burdajewicz Allan BURDAJEWICZ added a comment - Simplest scenario if you run docker locally would be to: Create global username/password credentials Create a pipeline jobs that consume those credentials: node { withDockerRegistry([credentialsId: 'docker-creds' , url: 'https: //index.docker.io/v1/' ]) { echo "Hello" } } Change the authorization of the Job to "Run as Specific User" or "Run as User Who Triggered Build"
          Hide
          dnusbaum Devin Nusbaum added a comment -

          A fix for this issue was just released in version 1.18 of the Docker Pipeline plugin. See the release notes on the plugin's wiki page for details.

          Show
          dnusbaum Devin Nusbaum added a comment - A fix for this issue was just released in version 1.18 of the Docker Pipeline plugin. See the release notes on the plugin's wiki page for details.

            People

            • Assignee:
              allan_burdajewicz Allan BURDAJEWICZ
              Reporter:
              jtsweet James Sweet
            • Votes:
              3 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: