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

docker login being called without server-related environment variables

      Split out from JENKINS-38018. The environment variables set by withDockerServer are not being passed to the docker login command.

          [JENKINS-51397] docker login being called without server-related environment variables

          This works with

          docker-plugin 1.1.4
          docker-workflow 1.15.1

           

          but not with

          docker-plugin 1.1.4
          docker-workflow 1.6

           

              // run from base dir for folder builds and from tmp for url builds
              dir ("$runPwd") {
                  echo "Build with server ${env.DOCKER_HOST} and registry ${env.CP_DOCKER_RELEASE}"
                  docker.withServer(env.DOCKER_HOST) {
                      docker.withRegistry(env.CP_DOCKER_RELEASE,env.DOCKER_CREDENTIALS ){
                          echo "Execute docker build -t $name:$version $params"
                          sh "docker   build -t $name:$version $params"
          //                def image = docker.build ("$name:$version", params)
                      }
                  }
              }
          

          Nico Navarrete added a comment - This works with docker-plugin 1.1.4 docker-workflow 1.15.1   but not with docker-plugin 1.1.4 docker-workflow 1.6       // run from base dir for folder builds and from tmp for url builds     dir ( "$runPwd" ) {         echo "Build with server ${env.DOCKER_HOST} and registry ${env.CP_DOCKER_RELEASE}"         docker.withServer(env.DOCKER_HOST) {             docker.withRegistry(env.CP_DOCKER_RELEASE,env.DOCKER_CREDENTIALS ){                 echo "Execute docker build -t $name:$version $params"                 sh "docker   build -t $name:$version $params" //                def image = docker.build ( "$name:$version" , params)             }         }     }

          Jesse Glick added a comment -

          nicolasus vwbusguy schulzha et al., anyone care to test a proposed fix? If so, use the Advanced tab to manually update this build of docker-commons and of docker-workflow.

          Jesse Glick added a comment - nicolasus vwbusguy schulzha et al., anyone care to test a proposed fix? If so, use the Advanced tab to manually update this build of docker-commons and of docker-workflow .

          Jesse Glick added a comment -

          BTW nicolasus the version of the docker plugin is probably irrelevant here. docker-commons and docker-workflow are the plugins involved.

          Jesse Glick added a comment - BTW nicolasus the version of the docker plugin is probably irrelevant here. docker-commons and docker-workflow are the plugins involved.

          Jesse Glick added a comment -

          (The downloads above also include the fix for JENKINS-51395.)

          Jesse Glick added a comment - (The downloads above also include the fix for JENKINS-51395 .)

          Hans Schulz added a comment -

          jglick The fix works for us, thank you!

          Hans Schulz added a comment - jglick The fix works for us, thank you!

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/org/jenkinsci/plugins/docker/commons/credentials/DockerRegistryEndpoint.java
          src/main/java/org/jenkinsci/plugins/docker/commons/credentials/DockerRegistryToken.java
          src/main/java/org/jenkinsci/plugins/docker/commons/impl/RegistryKeyMaterialFactory.java
          src/test/java/org/jenkinsci/plugins/docker/commons/util/SampleDockerBuilder.java
          http://jenkins-ci.org/commit/docker-commons-plugin/4f7f7772d36c277c0a055489d35bccaa3658890e
          Log:
          JENKINS-51397 Define API for passing environment to docker login command.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/org/jenkinsci/plugins/docker/commons/credentials/DockerRegistryEndpoint.java src/main/java/org/jenkinsci/plugins/docker/commons/credentials/DockerRegistryToken.java src/main/java/org/jenkinsci/plugins/docker/commons/impl/RegistryKeyMaterialFactory.java src/test/java/org/jenkinsci/plugins/docker/commons/util/SampleDockerBuilder.java http://jenkins-ci.org/commit/docker-commons-plugin/4f7f7772d36c277c0a055489d35bccaa3658890e Log: JENKINS-51397 Define API for passing environment to docker login command.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/org/jenkinsci/plugins/docker/commons/credentials/DockerRegistryEndpoint.java
          src/main/java/org/jenkinsci/plugins/docker/commons/credentials/DockerRegistryToken.java
          src/main/java/org/jenkinsci/plugins/docker/commons/impl/RegistryKeyMaterialFactory.java
          src/test/java/org/jenkinsci/plugins/docker/commons/util/SampleDockerBuilder.java
          http://jenkins-ci.org/commit/docker-commons-plugin/a5e6fa06a9d2f2419dc4e9cf1c07ff2886df5a5e
          Log:
          Merge pull request #71 from jglick/docker-login-env-JENKINS-51397

          JENKINS-51397 Define API for passing environment to docker login command

          Compare: https://github.com/jenkinsci/docker-commons-plugin/compare/5bd5ad32f534...a5e6fa06a9d2
          *NOTE:* This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/

          Functionality will be removed from GitHub.com on January 31st, 2019.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/org/jenkinsci/plugins/docker/commons/credentials/DockerRegistryEndpoint.java src/main/java/org/jenkinsci/plugins/docker/commons/credentials/DockerRegistryToken.java src/main/java/org/jenkinsci/plugins/docker/commons/impl/RegistryKeyMaterialFactory.java src/test/java/org/jenkinsci/plugins/docker/commons/util/SampleDockerBuilder.java http://jenkins-ci.org/commit/docker-commons-plugin/a5e6fa06a9d2f2419dc4e9cf1c07ff2886df5a5e Log: Merge pull request #71 from jglick/docker-login-env- JENKINS-51397 JENKINS-51397 Define API for passing environment to docker login command Compare: https://github.com/jenkinsci/docker-commons-plugin/compare/5bd5ad32f534...a5e6fa06a9d2 * NOTE: * This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/ Functionality will be removed from GitHub.com on January 31st, 2019.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          pom.xml
          src/main/java/org/jenkinsci/plugins/docker/workflow/RegistryEndpointStep.java
          http://jenkins-ci.org/commit/docker-workflow-plugin/2319da7e180d2c49d77f8572becb980573bdf241
          Log:
          JENKINS-51397 Pass environment to docker login command.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml src/main/java/org/jenkinsci/plugins/docker/workflow/RegistryEndpointStep.java http://jenkins-ci.org/commit/docker-workflow-plugin/2319da7e180d2c49d77f8572becb980573bdf241 Log: JENKINS-51397 Pass environment to docker login command.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          pom.xml
          src/main/java/org/jenkinsci/plugins/docker/workflow/RegistryEndpointStep.java
          http://jenkins-ci.org/commit/docker-workflow-plugin/a19719c196def05b740b44b75376e25dda077b84
          Log:
          Merge pull request #140 from jglick/docker-login-env-JENKINS-51397

          JENKINS-51397 Pass environment to docker login command

          Compare: https://github.com/jenkinsci/docker-workflow-plugin/compare/e8a1815cf41b...a19719c196de
          *NOTE:* This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/

          Functionality will be removed from GitHub.com on January 31st, 2019.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml src/main/java/org/jenkinsci/plugins/docker/workflow/RegistryEndpointStep.java http://jenkins-ci.org/commit/docker-workflow-plugin/a19719c196def05b740b44b75376e25dda077b84 Log: Merge pull request #140 from jglick/docker-login-env- JENKINS-51397 JENKINS-51397 Pass environment to docker login command Compare: https://github.com/jenkinsci/docker-workflow-plugin/compare/e8a1815cf41b...a19719c196de * NOTE: * This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/ Functionality will be removed from GitHub.com on January 31st, 2019.

            jglick Jesse Glick
            jglick Jesse Glick
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: