--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/fff6ea30-6b51-4f46-8516-8da8026c4241%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Right now, we don't have a great answer for this other than to use Scripted Pipeline docker.build(...) within a script { } block - we don't allow "foo.bar()" or "foo = bar()" syntax in steps blocks in Declarative unless they're within a script block. Anything within a script block doesn't go through validation, so you can use the full Scripted Pipeline syntax there. That said, we are thinking about how to make this clearer in the future so that you can build/deploy images without having to use script {}.A.
On Tue, Feb 14, 2017 at 2:32 PM, Thomas Fjellstrom <tfjel...@gmail.com> wrote:
Hi,I'm brand new to jenkins, and have been reading a lot about the pipeline plugin. I think I have a basic grasp of it, but I haven't been able to figure out the proper syntax to build docker images in a pipeline stage. I don't want to run the steps IN a docker container, but rather build containers (multiple containers) in a pipeline Jenkinsfile. I also have some other requirements, like accessing credentials setup in the jenkins interface, and a private docker registry.Any help would be appreciated.
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
Right now, we don't have a great answer for this other than to use Scripted Pipeline docker.build(...) within a script { } block - we don't allow "foo.bar()" or "foo = bar()" syntax in steps blocks in Declarative unless they're within a script block. Anything within a script block doesn't go through validation, so you can use the full Scripted Pipeline syntax there. That said, we are thinking about how to make this clearer in the future so that you can build/deploy images without having to use script {}.A.
On Tue, Feb 14, 2017 at 2:32 PM, Thomas Fjellstrom <tfjel...@gmail.com> wrote:
Hi,I'm brand new to jenkins, and have been reading a lot about the pipeline plugin. I think I have a basic grasp of it, but I haven't been able to figure out the proper syntax to build docker images in a pipeline stage. I don't want to run the steps IN a docker container, but rather build containers (multiple containers) in a pipeline Jenkinsfile. I also have some other requirements, like accessing credentials setup in the jenkins interface, and a private docker registry.Any help would be appreciated.
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
pipeline { agent { label 'docker' } options { ansiColor colorMapName: 'XTerm' } stages { stage('Build') { steps { sh "docker build -t registry.yourcompany.com/company/your-app:${GIT_SHA} ." } } stage('Publish') { when { branch 'master' } steps { withDockerRegistry([credentialsId: 'registry-creds', url: 'https://registry.yourcompany.com']) { sh "docker push registry.yourcompany.com/company/your-app:${GIT_SHA}" } } } }}
script { def image = docker.build("image-name:test", '-f Dockerfile.dev .')
// can then call methods like image.push() here, or run a command with image.inside():
image.inside('--net=host -v /mount:/mount:ro') { sh 'some-command.sh' }}
Right now, we don't have a great answer for this other than to use Scripted Pipeline docker.build(...) within a script { } block - we don't allow "foo.bar()" or "foo = bar()" syntax in steps blocks in Declarative unless they're within a script block. Anything within a script block doesn't go through validation, so you can use the full Scripted Pipeline syntax there. That said, we are thinking about how to make this clearer in the future so that you can build/deploy images without having to use script {}.A.
On Tue, Feb 14, 2017 at 2:32 PM, Thomas Fjellstrom <tfjel...@gmail.com> wrote:
Hi,I'm brand new to jenkins, and have been reading a lot about the pipeline plugin. I think I have a basic grasp of it, but I haven't been able to figure out the proper syntax to build docker images in a pipeline stage. I don't want to run the steps IN a docker container, but rather build containers (multiple containers) in a pipeline Jenkinsfile. I also have some other requirements, like accessing credentials setup in the jenkins interface, and a private docker registry.Any help would be appreciated.
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.