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

build parameter not usable in Docker build step

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Docker build step plugin version: 1.38
      Jenkins Version: 2.32.1 LTS

      I set a build parameter called VERSION, which I successfully use in a shell build step.
      Setting this parameter as tag (I put ${VERSION} in the tag field) in the Docker build step (push image) however fails in following error:

      [Docker] INFO: Pushing image <our private repository>:5000/path/image${ VERSION };
      12:30:27 ERROR: Build step failed with exception
      12:30:27 java.lang.IllegalStateException: The template variable 'VERSION' has no value
      12:30:27 	at org.glassfish.jersey.client.JerseyWebTarget.getUri(JerseyWebTarget.java:134)
      12:30:27 	at org.glassfish.jersey.client.JerseyWebTarget.request(JerseyWebTarget.java:214)
      

      I tried putting just $VERSION in the tag field, resulting in the following error:

      [Docker] INFO: Pushing image <our private repository>:5000/path/image:$VERSION
      12:34:28 [Docker] ERROR: Failed to push image:{"message":"Error parsing reference: \"<our private repository>:5000/path/image:$VERSION\" is not a valid repository/tag"}
      12:34:28 
      12:34:28 [Docker] ERROR: command 'Push image' failed: {"message":"Error parsing reference: \"<our private repository>:5000/path/image:$VERSION\" is not a valid repository/tag"}
      12:34:28 
      12:34:28 ERROR: {"message":"Error parsing reference: \"<our private repository>:5000/path/image:$VERSION\" is not a valid repository/tag"}
      12:34:28 
      12:34:28 Finished: FAILURE
      

        Attachments

          Issue Links

            Activity

            Hide
            michaelniemand Michael Niemand added a comment -

            I tried to format this better, but Jira's curly brackets formatting makes it impossible. I'm sorry ...

            Show
            michaelniemand Michael Niemand added a comment - I tried to format this better, but Jira's curly brackets formatting makes it impossible. I'm sorry ...
            Hide
            jared_biel_bt Jared Biel added a comment - - edited

            I edited the body of this ticket to try to get the formatting to look nicer, but as you said it's pretty much impossible. I put spaces around VERSION in the first block and it's somewhat serviceable now.

            Anyway, same issue here. Tag step succeeds to access/use variables (GIT_COMMIT/BUILD_NUMBER) but the push step fails to access GIT_COMMIT and errors out.

            Jenkins - 2.41
            Docker-build-step - 1.38
            Docker commons - 1.6

            [Docker] INFO: Tagged image foo:cf11bdb09f407b44b99297379f43dd826e2bd6c3_473 in docker.example.com/foo as cf11bdb09f407b44b99297379f43dd826e2bd6c3_473
            [Docker] INFO: Pushing image docker.example.com/foo:${GIT_COMMIT}_${BUILD_NUMBER}
            ERROR: Build step failed with exception
            java.lang.IllegalStateException: The template variable 'GIT_COMMIT' has no value
            	at org.glassfish.jersey.client.JerseyWebTarget.getUri(JerseyWebTarget.java:134)
            

            I've downgraded docker build step to 1.35; that version works.

            Show
            jared_biel_bt Jared Biel added a comment - - edited I edited the body of this ticket to try to get the formatting to look nicer, but as you said it's pretty much impossible. I put spaces around VERSION in the first block and it's somewhat serviceable now. Anyway, same issue here. Tag step succeeds to access/use variables (GIT_COMMIT/BUILD_NUMBER) but the push step fails to access GIT_COMMIT and errors out. Jenkins - 2.41 Docker-build-step - 1.38 Docker commons - 1.6 [Docker] INFO: Tagged image foo:cf11bdb09f407b44b99297379f43dd826e2bd6c3_473 in docker.example.com/foo as cf11bdb09f407b44b99297379f43dd826e2bd6c3_473 [Docker] INFO: Pushing image docker.example.com/foo:${GIT_COMMIT}_${BUILD_NUMBER} ERROR: Build step failed with exception java.lang.IllegalStateException: The template variable 'GIT_COMMIT' has no value at org.glassfish.jersey.client.JerseyWebTarget.getUri(JerseyWebTarget.java:134) I've downgraded docker build step to 1.35; that version works.

              People

              • Assignee:
                vjuranek vjuranek
                Reporter:
                michaelniemand Michael Niemand
              • Votes:
                2 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: