-
Bug
-
Resolution: Unresolved
-
Minor
-
None
I created a Multibranch pipeline job and configure docker registry credentials in the Pipeline Model Definition section (see attachment)
Jenkins file below:
pipeline { agent any stages { stage('Build') { steps { script { def image = docker.build "***.com/docker-build-demo:${env.BUILD_TAG}" image.push() image.push('latest') } } } } }
And pipeline failed on docker push step:
+ docker push ***.com/docker-build-demo:jenkins-docker-build-demo-master-4 The push refers to repository [***.com/docker-build-demo] ebf12965380b: Preparing denied: requested access to the resource is denied script returned exit code 1
I can do workaround like this to make the pipeline success but that makes the Jenkinsfile bind to specific jenkins configuration and cannot be run everywhere:
pipeline { agent any stages { stage('Build') { steps { script { docker.withRegistry('https://***.com', 'credential-id') { def image = docker.build "***.com/docker-build-demo:${env.BUILD_TAG}" image.push() image.push('latest') } } } } } }
[JENKINS-54901] Docker registry credentials doesn't apply on multibranch pipeline
Attachment | New: Pipeline Model Definition.png [ 45300 ] |
Description |
Original:
I created a Multibranch pipeline job and configure docker registry credentials in the *Pipeline Model Definition* section (see attachment) Jenkins file below: {code:java} pipeline { agent any stages { stage('Build') { steps { script { def image = docker.build "***.com/docker-build-demo:${env.BUILD_TAG}" image.push() image.push('latest') } } } } }{code} And pipeline failed on docker push step: {code:java} + docker push ***.com/docker-build-demo:jenkins-docker-build-demo-master-4 The push refers to repository [***.com/docker-build-demo] ebf12965380b: Preparing denied: requested access to the resource is denied script returned exit code 1{code} I can do workaround like this to make the pipeline success but that makes the Jenkinsfile bind to specific jenkins configuration and cannot be run everywhere: {code:java} pipeline { agent any stages { stage('Build') { steps { script { docker.withRegistry('https://xxx.com', 'credential-id') { def image = docker.build "harbor.supwisdom.com/institute/docker-build-demo:${env.BUILD_TAG}" image.push() image.push('latest') } } } } } }{code} |
New:
I created a Multibranch pipeline job and configure docker registry credentials in the *Pipeline Model Definition* section (see attachment) Jenkins file below: {code:java} pipeline { agent any stages { stage('Build') { steps { script { def image = docker.build "***.com/docker-build-demo:${env.BUILD_TAG}" image.push() image.push('latest') } } } } }{code} And pipeline failed on docker push step: {code:java} + docker push ***.com/docker-build-demo:jenkins-docker-build-demo-master-4 The push refers to repository [***.com/docker-build-demo] ebf12965380b: Preparing denied: requested access to the resource is denied script returned exit code 1{code} I can do workaround like this to make the pipeline success but that makes the Jenkinsfile bind to specific jenkins configuration and cannot be run everywhere: {code:java} pipeline { agent any stages { stage('Build') { steps { script { docker.withRegistry('https://xxx.com', 'credential-id') { def image = docker.build "***.com/docker-build-demo:${env.BUILD_TAG}" image.push() image.push('latest') } } } } } }{code} |
Description |
Original:
I created a Multibranch pipeline job and configure docker registry credentials in the *Pipeline Model Definition* section (see attachment) Jenkins file below: {code:java} pipeline { agent any stages { stage('Build') { steps { script { def image = docker.build "***.com/docker-build-demo:${env.BUILD_TAG}" image.push() image.push('latest') } } } } }{code} And pipeline failed on docker push step: {code:java} + docker push ***.com/docker-build-demo:jenkins-docker-build-demo-master-4 The push refers to repository [***.com/docker-build-demo] ebf12965380b: Preparing denied: requested access to the resource is denied script returned exit code 1{code} I can do workaround like this to make the pipeline success but that makes the Jenkinsfile bind to specific jenkins configuration and cannot be run everywhere: {code:java} pipeline { agent any stages { stage('Build') { steps { script { docker.withRegistry('https://xxx.com', 'credential-id') { def image = docker.build "***.com/docker-build-demo:${env.BUILD_TAG}" image.push() image.push('latest') } } } } } }{code} |
New:
I created a Multibranch pipeline job and configure docker registry credentials in the *Pipeline Model Definition* section (see attachment) Jenkins file below: {code:java} pipeline { agent any stages { stage('Build') { steps { script { def image = docker.build "***.com/docker-build-demo:${env.BUILD_TAG}" image.push() image.push('latest') } } } } }{code} And pipeline failed on docker push step: {code:java} + docker push ***.com/docker-build-demo:jenkins-docker-build-demo-master-4 The push refers to repository [***.com/docker-build-demo] ebf12965380b: Preparing denied: requested access to the resource is denied script returned exit code 1{code} I can do workaround like this to make the pipeline success but that makes the Jenkinsfile bind to specific jenkins configuration and cannot be run everywhere: {code:java} pipeline { agent any stages { stage('Build') { steps { script { docker.withRegistry('https://***.com', 'credential-id') { def image = docker.build "***.com/docker-build-demo:${env.BUILD_TAG}" image.push() image.push('latest') } } } } } }{code} |
Component/s | New: pipeline [ 21692 ] | |
Component/s | Original: multi-branch-project-plugin (not Pipeline) [ 21127 ] |
Assignee | Original: Matthew DeTullio [ mjdetullio ] | New: Andrew Bayer [ abayer ] |
Assignee | Original: Andrew Bayer [ abayer ] |