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

Docker build step fails on latest version of plugin (1.3.1)

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I have a build that runs just fine in jenkins 1.651 with v1.2.2 of the Docker build plugin, but fails on Jenkins 2.7.2 with v1.3.1 of the plugin.

      The echo "Nothing to build or tag." is triggered on both builds, but on the one running on the latest Jenkins and plugin version it is tacked on to the docker command that normally runs a bit later.

      Build that fails:

      [INFO] — docker-maven-plugin:0.4.9:build (default-cli) @ spine —
      [INFO] Copying /var/lib/jenkins/workspace/tigerbooks-develop-build/target/spine-0.0.21-SNAPSHOT.war -> /var/lib/jenkins/workspace/tigerbooks-develop-build/target/docker/spine-0.0.21-SNAPSHOT.war
      [INFO] Copying src/docker/Dockerfile -> /var/lib/jenkins/workspace/tigerbooks-develop-build/target/docker/Dockerfile
      [INFO] Building image storydocks/tb-spine
      Step 1 : FROM java:8
      ---> a7919ba82fd0
      Step 2 : VOLUME /tmp
      ---> Using cache
      ---> 18dfc62824fe
      Step 3 : ENV SPRING_PROFILES_ACTIVE staging
      ---> Using cache
      ---> 958841d765db
      Step 4 : ADD spine-*.war spine.war
      ---> 66d09d10db36
      Removing intermediate container c6b86dd9ca11
      Step 5 : RUN bash -c 'touch /spine.war'
      ---> Running in 8eb27f47c367
      ---> 76a2be383e50
      Removing intermediate container 8eb27f47c367
      Step 6 : ENTRYPOINT java -Djava.security.egd=file:/dev/./urandom -Xmx750M -Xms750M -jar /spine.war
      ---> Running in fa62e3035d37
      ---> d2ac457a92a0
      Removing intermediate container fa62e3035d37
      Successfully built d2ac457a92a0
      [INFO] Built storydocks/tb-spine
      [INFO] Tagging storydocks/tb-spine with 0.0.21-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESS
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 03:45 min
      [INFO] Finished at: 2016-08-09T11:39:12+00:00
      [INFO] Final Memory: 132M/470M
      [INFO] ------------------------------------------------------------------------
      Waiting for Jenkins to finish collecting data
      [JENKINS] Archiving /var/lib/jenkins/workspace/tigerbooks-develop-build/pom.xml to com.tigerbooks.spine/spine/0.0.21-SNAPSHOT/spine-0.0.21-SNAPSHOT.pom
      [JENKINS] Archiving /var/lib/jenkins/workspace/tigerbooks-develop-build/target/spine-0.0.21-SNAPSHOT.war to com.tigerbooks.spine/spine/0.0.21-SNAPSHOT/spine-0.0.21-SNAPSHOT.war
      channel stopped
      [tigerbooks-develop-build] $ docker echo "Nothing to build or tag"
      docker: 'echo' is not a docker command.
      See 'docker --help'.
      Build step 'Docker Build and Publish' marked build as failure
      [BFA] Scanning build for known causes...
      [BFA] No failure causes found
      [BFA] Done. 0s
      Warning: you have no plugins providing access control for builds, so falling back to legacy behavior of permitting any downstream builds to be triggered
      Finished: FAILURE

      Build that completes correctly:

      [INFO] Copying /var/lib/jenkins/workspace/tigerbooks-develop-build/target/spine-0.0.21-SNAPSHOT.war -> /var/lib/jenkins/workspace/tigerbooks-develop-build/target/docker/spine-0.0.21-SNAPSHOT.war
      [INFO] Copying src/docker/Dockerfile -> /var/lib/jenkins/workspace/tigerbooks-develop-build/target/docker/Dockerfile
      [INFO] Building image storydocks/tb-spine
      Step 1 : FROM java:8
      Pulling from library/java
      Digest: sha256:65a1d04d3e2464af0a523ba0b1d23f5bbffd394215497d393fd3a1bc8e043c27
      Status: Downloaded newer image for java:8
      ---> 289bdffc37d7
      Step 2 : VOLUME /tmp
      ---> Using cache
      ---> 23883e610707
      Step 3 : ENV SPRING_PROFILES_ACTIVE staging
      ---> Using cache
      ---> 40fbfee9548b
      Step 4 : ADD spine-*.war spine.war
      ---> 5ccdc634a3dd
      Removing intermediate container 3e5e753a29aa
      Step 5 : RUN bash -c 'touch /spine.war'
      ---> Running in 92e23e249cda
      ---> b6d7b37cf99d
      Removing intermediate container 92e23e249cda
      Step 6 : ENTRYPOINT java -Djava.security.egd=file:/dev/./urandom -Xmx750M -Xms750M -jar /spine.war
      ---> Running in 3c2978f4a1dc
      ---> 46d7fe01ccb3
      Removing intermediate container 3c2978f4a1dc
      Successfully built 46d7fe01ccb3
      [INFO] Built storydocks/tb-spine
      [INFO] Tagging storydocks/tb-spine with 0.0.21-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESS
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 05:03 min
      [INFO] Finished at: 2016-08-03T14:10:51+02:00
      [INFO] Final Memory: 119M/447M
      [INFO] ------------------------------------------------------------------------
      Waiting for Jenkins to finish collecting data
      [JENKINS] Archiving /var/lib/jenkins/workspace/tigerbooks-develop-build/pom.xml to com.tigerbooks.spine/spine/0.0.21-SNAPSHOT/spine-0.0.21-SNAPSHOT.pom
      [JENKINS] Archiving /var/lib/jenkins/workspace/tigerbooks-develop-build/target/spine-0.0.21-SNAPSHOT.war to com.tigerbooks.spine/spine/0.0.21-SNAPSHOT/spine-0.0.21-SNAPSHOT.war
      channel stopped
      [tigerbooks-develop-build] $ echo "Nothing to build or tag"
      Nothing to build or tag
      [tigerbooks-develop-build] $ docker push storydocks/tb-spine
      The push refers to a repository [docker.io/storydocks/tb-spine] (len: 2)
      46d7fe01ccb3: Preparing
      46d7fe01ccb3: Pushing
      46d7fe01ccb3: Pushed
      b6d7b37cf99d: Preparing
      b6d7b37cf99d: Pushing
      b6d7b37cf99d: Pushed
      5ccdc634a3dd: Preparing
      5ccdc634a3dd: Pushing
      5ccdc634a3dd: Pushed
      289bdffc37d7: Image already exists
      5d7cc49c4372: Image already exists
      cd02ed4609aa: Image already exists
      6331ed9a346a: Image already exists
      f23012d4423e: Image already exists
      0d3e866c82f3: Image already exists
      c28cbef85c39: Image already exists
      17bd2058e0c6: Image already exists
      0.0.21-SNAPSHOT: digest: sha256:08b9feb95eb887e28d0a46562212b7467bc37498fd1fe9c1084ebd91e3d78f0a size: 19033
      latest: digest: sha256:bcbc46fe73f447cfdd95bdec76956516ce92dabac3f8ca28b31bebd766514750 size: 19024
      Warning: you have no plugins providing access control for builds, so falling back to legacy behavior of permitting any downstream builds to be triggered
      tigerbooks-develop-deploy is disabled. Triggering skipped
      Finished: SUCCESS

        Attachments

          Activity

          Hide
          flybd5 Juan Jimenez added a comment -

          It's 1.3.1 of the plugin that is failing. I downgraded both Jenkins servers to 1.2.2 and everything works fine now.

          Show
          flybd5 Juan Jimenez added a comment - It's 1.3.1 of the plugin that is failing. I downgraded both Jenkins servers to 1.2.2 and everything works fine now.
          Hide
          flybd5 Juan Jimenez added a comment -

          It looks like when the change was made to prefix all commands with "docker" someone forgot that the echo shell command is not a docker command, and no handling was put in to not prefix the command with "docker" in that instance.

          Show
          flybd5 Juan Jimenez added a comment - It looks like when the change was made to prefix all commands with "docker" someone forgot that the echo shell command is not a docker command, and no handling was put in to not prefix the command with "docker" in that instance.
          Hide
          flybd5 Juan Jimenez added a comment -

          I found a solution. In DockerBuilder.java change this in executeCmd:

          cmd = dockerCmd + " " +cmd;

          ...to this...

          if (!cmd.startsWith("echo"))

          { cmd = dockerCmd + " " +cmd; }

          Sorry, I'm an old-school-fart, don't quite yet understand how to submit pull requests.

          Show
          flybd5 Juan Jimenez added a comment - I found a solution. In DockerBuilder.java change this in executeCmd: cmd = dockerCmd + " " +cmd; ...to this... if (!cmd.startsWith("echo")) { cmd = dockerCmd + " " +cmd; } Sorry, I'm an old-school-fart, don't quite yet understand how to submit pull requests.
          Hide
          flybd5 Juan Jimenez added a comment -

          Never mind, figured out how to create a pull request after forking the project and submitting the fix.

          Show
          flybd5 Juan Jimenez added a comment - Never mind, figured out how to create a pull request after forking the project and submitting the fix.
          Show
          laures Alexander Bätz added a comment - please merge this soon: https://github.com/jenkinsci/docker-build-publish-plugin/pull/47

            People

            • Assignee:
              vjuranek vjuranek
              Reporter:
              flybd5 Juan Jimenez
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: