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

Incorrect validation error in Build/Publish Docker Container step

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Trivial Trivial
    • docker-plugin
    • None
    • docker-plugin 0.16.2

      The "Build / Publish Docker Containers" build step's web user-interface is misleading.
      The "Image" validation code complains about valid input.
      The "Image" help-text is incomplete.

      In the "Build / Publish Docker Containers" build step, the "Image" field is set to be the tags that are to be applied to the newly-created image.
      The syntax of these tags can have a variety of format depending on the complexity (see https://docs.docker.com/engine/reference/commandline/tag/ for details).
      e.g. it can be as simple as "myimage", but it could be "myimage:mytag", or even "myregistry:1234/myimage:mytag".

      The online-help for this field says that it's

      Repository name (and optionally a tag) to be applied to the resulting image in case of success.
      New line separated values.


      This is not entirely correct - it can also include a registry name (and optionally a port) prefixed to a "/" and then the repository name (and optionally a tag).

      The web-ui validation code is even more restrictive than the help-text and insists that the only valid option is just a repository name on its own. e.g. if you give an image name of myimage:mytag then it complains:
      Tag myimage:mytag doesn't match ^([a-z0-9-_.]+)$
      (and it has similar complains about myregistry/myimage:mytag and myregistry:1234/myimage:mytag)

      Note: Despite all the complaints from the web-front-end, the build-step works as it should. As long as you ignore the red validation errors, you can, for example, specify a tag of myregistry:1234/myimagename:mytag, tick the "push" checkbox, and it'll push the built image into your registry.
      i.e. The build-step works, it's only the "help" and "validation" that's wrong.

          [JENKINS-39103] Incorrect validation error in Build/Publish Docker Container step

          pjdarton added a comment -

          pjdarton added a comment - See pull request https://github.com/jenkinsci/docker-plugin/pull/453

          Code changed in jenkins
          User: Peter Darton
          Path:
          docker-plugin/src/main/java/com/nirima/jenkins/plugins/docker/builder/DockerBuilderPublisher.java
          docker-plugin/src/main/resources/com/nirima/jenkins/plugins/docker/builder/DockerBuilderPublisher/config.jelly
          docker-plugin/src/main/resources/com/nirima/jenkins/plugins/docker/builder/DockerBuilderPublisher/help-pushOnSuccess.html
          docker-plugin/src/main/resources/com/nirima/jenkins/plugins/docker/builder/DockerBuilderPublisher/help-tagsString.html
          docker-plugin/src/main/resources/com/nirima/jenkins/plugins/docker/builder/DockerBuilderPublisher/help.html
          docker-plugin/src/test/java/com/nirima/jenkins/plugins/docker/builder/DockerBuilderPublisherTest.java
          http://jenkins-ci.org/commit/docker-plugin/80aa6b8572b4540e10ef488711d3e0a2508512cd
          Log:
          JENKINS-39103: Fix "Build / Publish Docker Container" Image field validation (#453)

          • Fix Jenkins-39103.

          Tags validation no longer complains about non-trivial-but-valid tags.
          Changed displayname from "Build / Publish Docker Containers" to "Build /
          Publish Docker Image" because we're building an image (just one) and not
          a container.
          Corrected error message from "What this build run on Docker?" to "Was
          this build run on Docker?".
          Added unit-test for tag-validation code.

          • Cosmetic UI enhancements to DockerBuilderPublisher build step.

          Removed "description" of "Image" field. The help-text explained it
          better, and the old description was (strictly-speaking) incorrect.
          Improved help text for "Image" field.
          Added help text for pushOnSuccess checkbox.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Peter Darton Path: docker-plugin/src/main/java/com/nirima/jenkins/plugins/docker/builder/DockerBuilderPublisher.java docker-plugin/src/main/resources/com/nirima/jenkins/plugins/docker/builder/DockerBuilderPublisher/config.jelly docker-plugin/src/main/resources/com/nirima/jenkins/plugins/docker/builder/DockerBuilderPublisher/help-pushOnSuccess.html docker-plugin/src/main/resources/com/nirima/jenkins/plugins/docker/builder/DockerBuilderPublisher/help-tagsString.html docker-plugin/src/main/resources/com/nirima/jenkins/plugins/docker/builder/DockerBuilderPublisher/help.html docker-plugin/src/test/java/com/nirima/jenkins/plugins/docker/builder/DockerBuilderPublisherTest.java http://jenkins-ci.org/commit/docker-plugin/80aa6b8572b4540e10ef488711d3e0a2508512cd Log: JENKINS-39103 : Fix "Build / Publish Docker Container" Image field validation (#453) Fix Jenkins-39103. Tags validation no longer complains about non-trivial-but-valid tags. Changed displayname from "Build / Publish Docker Containers" to "Build / Publish Docker Image" because we're building an image (just one) and not a container. Corrected error message from "What this build run on Docker?" to "Was this build run on Docker?". Added unit-test for tag-validation code. Cosmetic UI enhancements to DockerBuilderPublisher build step. Removed "description" of "Image" field. The help-text explained it better, and the old description was (strictly-speaking) incorrect. Improved help text for "Image" field. Added help text for pushOnSuccess checkbox.

            ndeloof Nicolas De Loof
            pjdarton pjdarton
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: