I am using the Jenkins Pipeline Plugin, but having trouble getting my docker config credential to do what I need.
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