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

Credentials not found by withCredentials

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Minor Minor
    • jenkinsfile-runner
    • None
    • OS X + Docker

      When I run a Jenkinsfile that uses withCredentials, the credentials are not found, even though they exist.

      Command:

      docker run --rm -v $(pwd):/workspace -v /tmp/jenkins:/app/jenkins -v /tmp/jenkins_home/plugins:/usr/share/jenkins/ref/plugins jenkinsfile-runner

      Output:

      15.130 [id=1] WARNING j.branch.WorkspaceLocatorImpl#getWorkspaceRoot: JENKINS-2111 path sanitization ineffective when using legacy Workspace Root Directory ‘/build’; switch to ‘${JENKINS_HOME}/workspace/${ITEM_FULL_NAME}’ as in JENKINS-8446 / JENKINS-21942
      Started
      Running in Durability level: PERFORMANCE_OPTIMIZED
      [Pipeline] Start of Pipeline
      [Pipeline] node
      Running on Jenkins in /build
      [Pipeline]

      { [Pipeline] withCredentials [Pipeline] // withCredentials [Pipeline] }

      [Pipeline] // node
      [Pipeline] End of Pipeline
      ERROR: Could not find credentials entry with ID 'trose'

      Jenkinsfile:

      node {
         withCredentials([ usernamePassword(credentialsId: 'trose', usernameVariable: 'user',
               passwordVariable: 'pass') ])

      {       echo "user: $user, pass: $pass"    }

      }

      From <JENKINS_HOME>/credentials.xml:

      <com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl>
         <scope>GLOBAL</scope>
         <id>trose</id>
         <description></description>
         <username>trose</username>
         <password>{AQAAABAAAAAQ25ldSmp9SUMhWS7u0mODZvmd+lh3ubJx0V7XCSxolTU=} </password>
      </com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl>
       

            egutierrez Evaristo Gutierrez
            bigtrose Thornton Rose
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: