[JIRA] (JENKINS-38452) imageName() drops registry prefix outside of withRegistry() block
Title: Message Title Christopher Bayliss commented on JENKINS-38452 Re: imageName() drops registry prefix outside of withRegistry() block Or may use case: Pull an image from one repository and publish it to another. You just can't do it without resorting to the shell. Add Comment This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-38452) imageName() drops registry prefix outside of withRegistry() block
Title: Message Title Mikhail Sakhnov edited a comment on JENKINS-38452 Re: imageName() drops registry prefix outside of withRegistry() block [~abayer] proof me if I am wrong, but to me, it seems that there is no way to use an image from private registry now. Let me explain what I mean.img.pull command always uses $\{imageName()} method (./main/resources/org/jenkinsci/plugins/docker/workflow/Docker.groovy:141) to build image name (so, inside withRegistry it would be with registry prefix, outside it would be without registry prefix)but img.withRun command instead of imageName uses directrly id property: {code:java}def container = docker.script.sh(script: "docker run -d${args != '' ? ' ' + args : ''} ${id}${command != '' ? ' ' + command : ''}", returnStdout: true).trim(){code}so if we pull some image inside some withRegistry block, it will save the image with the full qualified local name. But even if we call withRun inside the same withRegistry block, it would use the not full qualified name, but id property passed to image constructor.Pseudocode:{code}docker.withRegistry("someregistry") {def image = docker.image("blablaimage")image.pull() // image saved to local docker with fq name image.run() // tries to run blablaimage which doesn't exists because on previous step it was saved with fq name} {code} Add Comment This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit htt
[JIRA] (JENKINS-38452) imageName() drops registry prefix outside of withRegistry() block
Title: Message Title Mikhail Sakhnov commented on JENKINS-38452 Re: imageName() drops registry prefix outside of withRegistry() block Andrew Bayer proof me if I am wrong, but to me, it seems that there is no way to use an image from private registry now. Let me explain what I mean. img.pull command always uses ${imageName()} method (./main/resources/org/jenkinsci/plugins/docker/workflow/Docker.groovy:141) to build image name (so, inside withRegistry it would be with registry prefix, outside it would be without registry prefix) but img.withRun command instead of imageName uses directrly id property: def container = docker.script.sh(script: "docker run -d${args != '' ? ' ' + args : ''} ${id}${command != '' ? ' ' + command : ''}", returnStdout: true).trim() so if we pull some image inside some withRegistry block, it will save the image with the full qualified local name. But even if we call withRun inside the same withRegistry block, it would use the not full qualified name, but id property passed to image constructor. Pseudocode: docker.withRegistry("someregistry") { def image = docker.image("blablaimage") image.pull() // image saved to local docker with fq name image.run() // tries to run blablaimage which doesn't exists because on previous step it was saved with fq name } Add Comment This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
[JIRA] (JENKINS-38452) imageName() drops registry prefix outside of withRegistry() block
Title: Message Title Andrew Bayer resolved as Not A Defect So first, the reason you're able to do anything with img when you reference it for the first time inside the withRegistry(...) block is that you defined it as img = ... - welcome to Groovy script variable scoping. =) If a variable is defined without a type or def ... in a Groovy script, it's global to the entire script. So for all intents and purposes, img = ... within the withRegistry(...) block works the same as def img before the withRegistry(...) block and then img = ... inside the block. However, if you did def img = ... inside the block, you would not be able to reference the img variable anywhere outside the block. Good times. Second, putting the Groovy scoping fun aside, yeah, this is expected behavior. withRegistry(...) alters behavior of Docker Pipeline methods/variables used inside its block, but only while you're in the block. So if you defined img before the withRegistry(...) block, img.imageName() called before the block wouldn't have the registry prefix, img.imageName() called inside the block would have the registry prefix, and img.imageName() called after the block wouldn't have the registry prefix. This is how this is supposed to work. Jenkins / JENKINS-38452 imageName() drops registry prefix outside of withRegistry() block Change By: Andrew Bayer Status: Open Resolved Resolution: Not A Defect Add Comment
[JIRA] (JENKINS-38452) imageName() drops registry prefix outside of withRegistry() block
Title: Message Title Andrew Bayer updated an issue Jenkins / JENKINS-38452 imageName() drops registry prefix outside of withRegistry() block Change By: Andrew Bayer Component/s: docker-workflow-plugin Component/s: pipeline Add Comment This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-38452) imageName() drops registry prefix outside of withRegistry() block
Title: Message Title Mikhail Sakhnov commented on JENKINS-38452 Re: imageName() drops registry prefix outside of withRegistry() block Christian Höltje but for me, it looks like it doesn't work even if you defy img inside withRegistry block - withRun still ignores the registry prefix in the name. Add Comment This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-38452) imageName() drops registry prefix outside of withRegistry() block
Title: Message Title Christian Höltje commented on JENKINS-38452 Re: imageName() drops registry prefix outside of withRegistry() block But you went out of the .withRegistry() block. It wasn't there before and it isn't after the block. In fact, that code shouldn't work unless you had a def img before the withRegistry() block. Because the img variable should no longer exist outside. Add Comment This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-38452) imageName() drops registry prefix outside of withRegistry() block
Title: Message Title Anthony Pioli updated an issue Jenkins / JENKINS-38452 imageName() drops registry prefix outside of withRegistry() block Change By: Anthony Pioli I have this pipeline:{code: groovy java }node { docker.withRegistry('https://my-private-repo') {sh 'echo "FROM ubuntu" > Dockerfile'img = docker.build('my-test-image:1.0.0')print img.imageName()}print img.imageName()}{code}When the first print is done I get the expected full name with the registry prefix.The 2nd print however drops the registry prefix and I just get the id.Was not expecting that since the img object did not change. Add Comment This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-38452) imageName() drops registry prefix outside of withRegistry() block
Title: Message Title Anthony Pioli commented on JENKINS-38452 Re: imageName() drops registry prefix outside of withRegistry() block maybe?!?! But I was expecting the img object to retain it's full name. Add Comment This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-38452) imageName() drops registry prefix outside of withRegistry() block
Title: Message Title Christian Höltje commented on JENKINS-38452 Re: imageName() drops registry prefix outside of withRegistry() block Isn't this how it is supposed to work? Add Comment This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-38452) imageName() drops registry prefix outside of withRegistry() block
Title: Message Title Anthony Pioli created an issue Jenkins / JENKINS-38452 imageName() drops registry prefix outside of withRegistry() block Issue Type: Bug Assignee: Unassigned Components: pipeline Created: 2016/Sep/22 3:23 PM Environment: Jenkins 2.7.3 Oracle Java 1.8.0_92 All plugins & versions: ace-editor 1.1 ansicolor 0.4.2 ant 1.4 antisamy-markup-formatter 1.5 authentication-tokens 1.3 bouncycastle-api 1.648.3 branch-api 1.10.2 build-failure-analyzer 1.17.1 build-flow-plugin 0.20 build-name-setter 1.6.5 build-timeout 1.17.1 build-user-vars-plugin 1.5 buildgraph-view 1.3.2 buildtriggerbadge 2.3 cloudbees-folder 5.12 conditional-buildstep 1.3.5 copy-to-slave 1.4.4 copyartifact 1.38.1 credentials 2.1.4 credentials-binding 1.9 cucumber-testresult-plugin 0.8.2 cvs 2.12 display-url-api 0.3 docker-commons 1.4.1 docker-plugin 0.16.2 docker-workflow 1.8 durable-task 1.12 email-ext 2.47 embeddable-build-status 1.9 envinject 1.92.1 Exclusion 0.12 external-monitor-job 1.6 fstrigger 0.39 ghprb 1.33.1 git 3.0.0 git-client 2.0.0 git-server 1.7 github 1.21.1 github-api 1.77 github-branch-source 1.9 github-oauth 0.24 github-organization-folder 1.5 gradle 1.25 groovy 1.29 groovy-postbuild 2.3.1 handlebars 1.1.1 htmlpublisher 1.11 icon-shim 2.0.3 jacoco 2.0.1 javadoc 1.4 job-dsl 1.50 jquery 1.11.2-0 jquery-detached 1.2.1 junit 1.18 ldap 1.12 lockable-resources 1.10 mailer 1.18 mapdb-api 1.0.9.0 matrix-auth 1.4 matrix-project 1.7.1 maven-plugin 2.13 modernstatus 1.2 momentjs 1.1.1 monitoring 1.61.0 multiple-scms 0.6 naginator 1.17.2 nodelabelparameter 1.7.2 pam-auth 1.3 parameterized-trigger 2.32 pegdown-formatter 1.3 pipeline-build-step 2.2 pipeline-graph-analysis 1.1 pipeline-input-step 2.1 pipeline-rest-api 2.0 pipeline-stage-step 2.2 pipeline-stage-view 2.0 pipeline-utility-steps 1.1.6 plain-credentials 1.2 promoted-builds 2.27 rebuild 1.25 run-condition 1.0 saferestart 0.3 scm-api 1.3 scm-sync-configuration 0.0.10 script-security 1.22 scriptler 2.9 shelve-project-plugin 1.5 sidebar-link 1.7 slack 2.0.1 ssh-agent 1.13 ssh-credentials 1.12 ssh-slaves 1.11 structs 1.5 subversion 2.6 swarm 2.2 teamconcert 1.2.0.1 text-finder 1.10 thinBackup 1.7.4 timestamper 1.8.5 token-macro 1.12.1 translation 1.15 uno-choice 1.4 urltrigger 0.41 windows-slaves 1.2 workflow-aggregator 2.3 workflow-api 2.3 workflow-basic-steps 2.1 workflow-cps 2.15 workflow-cps-global-lib 2.3 workflow-durable-task-step 2.4 workflow-job 2.6 workflow-multibranch 2.8 workflow-scm-step 2.2 workflow-step-api 2.3 workflow-support 2.4 ws