Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-41140

Jenkins Pipeline still uses --force=yes for Docker Build and Publish plugin

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Not A Defect
    • Labels:
    • Environment:
      Jenkins ver. 2.19.4
      CloudBees Docker Build and Publish plugin 1.3.2
      Running on Ubuntu 16.04
    • Similar Issues:

      Description

      The `--force` flag is still being set to true for Pipeline Docker build and publish steps. I'm running into the issue when executing a job to build and publish an image to a registry:

      + docker tag --force=true foo:tag foo:tag
      unknown flag: --force
      See 'docker tag --help'.

      The relevant bit from my Jenkinsfile:

      node {
      stage('deploy'){
      git branch: 'feature/branch', credentialsId: 'foo-key', url: 'git@github.com:bar/baz.git'
      withDockerRegistry([credentialsId: 'ecr:us-east-1:foo-key', url: 'https://etcetera/']) {
      docker.image('foo:tag').push()
      }

        Attachments

          Issue Links

            Activity

            Hide
            csanchez Carlos Sanchez added a comment -

            docker pipeline support comes from another plugin https://wiki.jenkins-ci.org/display/JENKINS/CloudBees+Docker+Pipeline+Plugin which has fixed the docker tag force in 1.4

            Show
            csanchez Carlos Sanchez added a comment - docker pipeline support comes from another plugin https://wiki.jenkins-ci.org/display/JENKINS/CloudBees+Docker+Pipeline+Plugin which has fixed the docker tag force in 1.4
            Hide
            darabi Kambiz Darabi added a comment -

            I have a Jenkins 2.7.2 instance with both plugins installed:

            I have a Docker build with this Jenkinsfile:

            node {
               def registry = "registry.local:5000"
               def imagename = "my-test"
            
               stage 'Checkout'
            
               checkout scm
               sh "grep -e 'ENV APP_VERSION' Dockerfile | cut -f 3 -d ' '  > .version";
            
               def version=readFile('.version').trim();
               def docker_image = "${registry}/${imagename}:${version}"
            
               stage 'Build'
               def app
               try {
                  app = docker.build docker_image
               } catch (any) {
                  currentBuild.result = 'FAILURE'
                  throw any
               } finally {
                  def to = emailextrecipients([
                     [$class: 'CulpritsRecipientProvider'],
                     [$class: 'DevelopersRecipientProvider'],
                     [$class: 'RequesterRecipientProvider']
                  ])
                  step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: to])
               }
            
               stage 'Publish'
                  docker.withRegistry("https://${registry}/", 'docker-registry-credentials') {
                    app.push 'latest'
                    app.push version
                  }
            }
            

            The build in Jenkins leads to this error

            + docker tag --force=true registry.local:5000/my-test:0.9.0 registry.local:5000/my-test:latest
            unknown flag: --force
            

            Does that mean that I am not able to install both plugins? Or maybe there is something wrong with my Jenkinsfile?

            Any hint is appreciated.

            Show
            darabi Kambiz Darabi added a comment - I have a Jenkins 2.7.2 instance with both plugins installed: CloudBees Docker Build and Publish version 1.3.2 CloudBees Docker Pipeline Plugin version 1.9 I have a Docker build with this Jenkinsfile: node { def registry = "registry.local:5000" def imagename = "my-test" stage 'Checkout' checkout scm sh "grep -e 'ENV APP_VERSION' Dockerfile | cut -f 3 -d ' ' > .version" ; def version=readFile( '.version' ).trim(); def docker_image = "${registry}/${imagename}:${version}" stage 'Build' def app try { app = docker.build docker_image } catch (any) { currentBuild.result = 'FAILURE' throw any } finally { def to = emailextrecipients([ [$class: 'CulpritsRecipientProvider' ], [$class: 'DevelopersRecipientProvider' ], [$class: 'RequesterRecipientProvider' ] ]) step([$class: 'Mailer' , notifyEveryUnstableBuild: true , recipients: to]) } stage 'Publish' docker.withRegistry( "https: //${registry}/" , 'docker-registry-credentials' ) { app.push 'latest' app.push version } } The build in Jenkins leads to this error + docker tag --force= true registry.local:5000/my-test:0.9.0 registry.local:5000/my-test:latest unknown flag: --force Does that mean that I am not able to install both plugins? Or maybe there is something wrong with my Jenkinsfile? Any hint is appreciated.
            Hide
            darabi Kambiz Darabi added a comment -

            Sorry for the noise. Unfortunately, I didn't look hard enough and found JENKINS-41148 a minute too late.

            Show
            darabi Kambiz Darabi added a comment - Sorry for the noise. Unfortunately, I didn't look hard enough and found JENKINS-41148 a minute too late.

              People

              Assignee:
              csanchez Carlos Sanchez
              Reporter:
              sa_jbrooks Jack Brooks
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: