jenkinsci / jenkinsci/docker-workflow-plugin
[JENKINS-42152] Docker Pipeline causes build to fails because of use of --force=yes for tagging
- Dominant language
- Java
- Stars
- 527
- Forks
- 422
- Avg merge
- 10m
- Merged PRs (30d)
- 1
Description
First off, I verify that I have read other tickets relating to similar issues, especially https://issues.jenkins-ci.org/browse/JENKINS-41140. I am convinced this is not a duplicate.
This Jenkinsfile exits and fails the build as soon as I try to do a Image.push('tag') with error code 125.
#!groovy
// define name of project
projectBaseName = 'gradle'node {
def tagVersion= sh(script:"git tag -l --sort=-creatordate | head -n 1", returnStdout: true)
echo tagVersion
stage('checkout') {
checkout scm: [
$class: 'GitSCM',
userRemoteConfigs: [[credentialsId: 'erentodevsSSH', url: 'git@github.com:erento/infra-gradle.git']],
branches: [[name: "refs/tags/${tagVersion}"]]],
changelog: false,
poll: false
}def myImage
stage('build image') {
myImage = docker.build("eu.gcr.io/erento-docker/${projectBaseName}")
}stage('publish image') {
myImage.push "${tagVersion}"
myImage.push 'latest'
}
}
Here is the end of the log where the build fails:
Successfully built 5cd83ad22ca8
[Pipeline] dockerFingerprintFrom
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (publish image)
[Pipeline] sh
[-_Infra_infra-gradle_master-324YNW3MJA4FOWI2NQMEZBAZKMJ727NUFOWZA5FUGORPAAWKKMVA] Running shell script
+ docker tag --force=true eu.gcr.io/erento-docker/gradle eu.gcr.io/erento-docker/gradle:3.3-1
unknown flag: --force
See 'docker tag --help'.
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of PipelineGitHub has been notified of this commit’s build result
ERROR: script returned exit code 125
Finished: FAILURE
I have verified that switching the order of pushing latest and tagVersion causes the push of latest to work, and the push of tagVersion fails in the exact same manner as shown here.
I also verified that:
docker tag --force=true eu.gcr.io/erento-docker/gradle eu.gcr.io/erento-docker/gradle:3.3-1 - fails on console
docker tag eu.gcr.io/erento-docker/gradle eu.gcr.io/erento-docker/gradle:3.3-1 - does not fail on console
Please let me know if I can provide any more data useful for fixing this.
---
Originally reported by wduda, imported from: Docker Pipeline causes build to fails because of use of --force=yes for tagging
Raw content of original issue
First off, I verify that I have read other tickets relating to similar issues, especially https://issues.jenkins-ci.org/browse/JENKINS-41140. I am convinced this is not a duplicate.
This Jenkinsfile exits and fails the build as soon as I try to do a Image.push('tag') with error code 125.
#!groovy
// define name of project
projectBaseName = 'gradle'node {
def tagVersion= sh(script:"git tag -l --sort=-creatordate | head -n 1", returnStdout: true)
echo tagVersion
stage('checkout') {
checkout scm: [
$class: 'GitSCM',
userRemoteConfigs: [[credentialsId: 'erentodevsSSH', url: 'git@github.com:erento/infra-gradle.git']],
branches: [[name: "refs/tags/${tagVersion}"]]],
changelog: false,
poll: false
}def myImage
stage('build image') {
myImage = docker.build("eu.gcr.io/erento-docker/${projectBaseName}")
}stage('publish image') {
myImage.push "${tagVersion}"
myImage.push 'latest'
}
}Here is the end of the log where the build fails:
Successfully built 5cd83ad22ca8
[Pipeline] dockerFingerprintFrom
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (publish image)
[Pipeline] sh
[-_Infra_infra-gradle_master-324YNW3MJA4FOWI2NQMEZBAZKMJ727NUFOWZA5FUGORPAAWKKMVA] Running shell script
+ docker tag --force=true eu.gcr.io/erento-docker/gradle eu.gcr.io/erento-docker/gradle:3.3-1
unknown flag: --force
See 'docker tag --help'.
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of PipelineGitHub has been notified of this commit’s build result
ERROR: script returned exit code 125
Finished: FAILUREI have verified that switching the order of pushing latest and tagVersion causes the push of latest to work, and the push of tagVersion fails in the exact same manner as shown here.
I also verified that:
docker tag --force=true eu.gcr.io/erento-docker/gradle eu.gcr.io/erento-docker/gradle:3.3-1 - fails on console
docker tag eu.gcr.io/erento-docker/gradle eu.gcr.io/erento-docker/gradle:3.3-1 - does not fail on consolePlease let me know if I can provide any more data useful for fixing this.
environment
```
Jenkins 2.32.2
Docker 1.12.3
Docker Pipeline Plugin 1.10
```
Contributor guide
Assessment
This issue has not been assessed yet.