-
Bug
-
Resolution: Won't Fix
-
Minor
-
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] // node
[Pipeline] End of Pipeline
ERROR: Could not find credentials entry with ID 'trose'
Jenkinsfile:
node {
withCredentials([ usernamePassword(credentialsId: 'trose', usernameVariable: 'user',
passwordVariable: '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>
Hi bigtrose! Thanks for using Jenkinsfile Runner.
If I am understanding correctly your reproduction steps, you are trying to provide an existing JENKINS_HOME to the Jenkinsfile Runner image so that you can use a previously configured state from the Jenkinsfile. That is not a use case that Jenkinsfile Runner is intended to be used to. However you could use the configuration-as-code plugin to automatically setup the credentials in the Jenkinsfile Runner image and be able to use them. Please check this demo for an example on how to do it.
I am closing the issue. Please feel free to reopen if you consider it necessary. Thanks!