Hello Phil,
The "withCredentials" step exposes the credentials as Shell Environment
Variables, not as groovy variables.
You can find more details
on
https://support.cloudbees.com/hc/en-us/articles/203802500-Injecting-Secrets-into-Jenkins-Build-Jobs
Regarding Docker credentials, did you consider using the Pipeline Docker
Plugin and a "docker.withRegistry(...) {}" build wrapper? You can find a
sample here:
https://github.com/CloudBees-community/game-of-life/blob/db105fed560ffb3f5880224d1693d72ee2e89097/Jenkinsfile#L16
Cyrille
On Tuesday, August 9, 2016 at 9:20:17 PM UTC+2, Phil Swenson wrote:
>
> I am using the Jenkins Pipeline Plugin, but having trouble getting my
> docker config credential to do what I need.
>
>
> using code like:
>
> node('docker-slave') {
>
> withCredentials([[$class: 'UsernamePasswordMultiBinding',
> credentialsId: 'NEXUS', usernameVariable: 'NEXUS_USERNAME',
> passwordVariable: 'NEXUS_PASSWORD'],
> [$class: 'FileBinding', credentialsId: 'DOCKER_REGISTRY', variable:
> 'DOCKER_CONFIG_PATH']]) {
> def dockerConfigPath = "$DOCKER_CONFIG_PATH"
>
>
>
>
> the dockerConfigPath above does not get populated as I'd hope...
>
>
>
> The variable DOCKER_CONFIG_PATH passes in the absolute path to the docker
> config file. I only need the directory path, NOT the file path.
>
> So if the DOCKER_CONFIG_PATH is something like
> /jenkins/tmp/393939kdk/config.json , I need to set the DOCKER_CONFIG
> environment variable to /jenkins/tmp/393939kdk/
>
> Given all the security stuff that's built in to the groovy script, I
> haven't been able to do this.
>
> My question boils down to this: how do I get access to the variable
> DOCKER_CONFIG_PATH that is pulled from the credentials. I need to drop the
> filename at the end off the string.
>
>
>
> Thanks
> phil
>
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/632d912d-bcae-4829-bd6e-f36c60356f9d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.