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

CloudBees Docker Build and Publish - Environment Variables

XMLWordPrintable

      I'm trying to push to a custom repository,
      however we have several repositories around the globe and I would like the developer to choose to which repo to push.

      I've the plugin 'This project is parameterized'
      I've set 2 parameters :
      1. TAG
      2. REPOSITORY

      When executing a prebuild that do a simple
      'eval docker login $REPOSITORY --username=x --password=x'
      all works perfect

      However,
      Inside cloudbess docker build and publish I've set the repository equal to $REPOSITORY (tried also ${} and $()) that give me an exception as the variable isn't parsed :

      10:37:19 + eval docker login $REPOSITORY --username=x --password=x
      10:37:19 + docker login https://nexus.x.y.com:5000 --username=x --password=x
      10:37:21 Login Succeeded
      10:37:21 ERROR: no protocol: ${REPOSITORY}
      10:37:21 java.net.MalformedURLException: no protocol: ${REPOSITORY}
      10:37:21 	at java.net.URL.<init>(URL.java:593)
      10:37:21 	at java.net.URL.<init>(URL.java:490)
      10:37:21 	at java.net.URL.<init>(URL.java:439)
      10:37:21 	at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint.getEffectiveUrl(DockerRegistryEndpoint.java:136)
      10:37:21 	at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint.imageName(DockerRegistryEndpoint.java:233)
      10:37:21 	at com.cloudbees.dockerpublish.DockerBuilder.getRepo(DockerBuilder.java:252)
      10:37:21 	at com.cloudbees.dockerpublish.DockerBuilder$Perform.getImageTags(DockerBuilder.java:336)
      10:37:21 	at com.cloudbees.dockerpublish.DockerBuilder$Perform.buildAndTag(DockerBuilder.java:370)
      10:37:21 	at com.cloudbees.dockerpublish.DockerBuilder$Perform.exec(DockerBuilder.java:311)
      10:37:21 	at com.cloudbees.dockerpublish.DockerBuilder$Perform.access$100(DockerBuilder.java:291)
      10:37:21 	at com.cloudbees.dockerpublish.DockerBuilder.perform(DockerBuilder.java:262)
      10:37:21 	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      10:37:21 	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
      10:37:21 	at hudson.model.Build$BuildExecution.build(Build.java:205)
      10:37:21 	at hudson.model.Build$BuildExecution.doRun(Build.java:162)
      10:37:21 	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
      10:37:21 	at hudson.model.Run.execute(Run.java:1741)
      10:37:21 	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      10:37:21 	at hudson.model.ResourceController.execute(ResourceController.java:98)
      10:37:21 	at hudson.model.Executor.run(Executor.java:410)
      10:37:21 Build step 'Docker Build and Publish' marked build as failure
      10:37:21 [ssh-agent] Stopped.
      10:37:21 Finished: FAILURE
      

            Unassigned Unassigned
            geostant Yaniv Eliash
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: