if you want to use the same template this should work podTemplate(label: 'm1') { stage('sync') { parallel A: { node('m1') { sync } }, B: { node('m1') { sync } } } }
If they are different, move the podTemplate to the parallel section { stage('sync') { parallel A: { podTemplate(label: 'm1') node('m1') { sync }} }, B: { podTemplate(label: 'm2') { node('m2') { sync }} } } } On Thu, May 24, 2018 at 2:57 PM 이호광 <luckyhor...@gmail.com> wrote: > Hello. > > In the master branch, my code has feature flags (a.k.a feature toggles). > > So, I want to make a pipeline like > > start - sync - build - test - end > - sync - build - test - > - sync - build - test - > > (if there are 3 feature sets) > > sync is like git clone, and code is same or can be little bit different. > and build command also can be slightly different for using feature flags. > > and when compiling, I use make -j (multi-processing) command. > > > So I think creating one pod and multiple containers in Jenkins is not good > idea due to heavy CPU and memory needed. > > > I think Jenkins should be able to create multiple pods. Am I right? > > > Is it possible ? > > > > In scripted pipeline, I create two container in a one pod successfully. > But I don't know create two pods. > > > podTemplate( > > label: 'mypod', > > containers: [ > > containerTemplate(name: 'm1', image: 'maven', ttyEnabled: true, command: > 'cat'), > > containerTemplate(name: 'm2', image: 'maven', ttyEnabled: true, command: > 'cat') > > ], > > volumes: [ > > hostPathVolume(mountPath: '/var/run/docker.sock', hostPath: > '/var/run/docker.sock'), > > ] > > ) { > > node('mypod') { > > stage('Sync') { > > parallel Syncfortype1: { > > container(name: 'm1', shell: '/bin/bash') { > > sync > > } > > }, > > Syncfortype2: { > > container(name: 'm2', shell: '/bin/bash') { > > sync > > } > > } > > } > > } > > } > > I think there may be the way like, but I can't find. > > // pre-define > podTemplate(label: 'm1') > podTemplate(label: 'm2') > > // use it for node > { > stage('sync') { > parallel A: { > node('m1') { > sync > } > }, > B: { > node('m2') { > sync > } > } > } > } > > In Declarative pipeline, samely, I can't find out pre-define multiple > agents. > > Guide document says, define agent in stage. > > pipeline { > agent none > stages { > stage('Example Build') { > agent { docker 'maven:3-alpine' } > steps { > echo 'Hello, Maven' > sh 'mvn --version' > } > } > stage('Example Test') { > agent { docker 'openjdk:8-jre' } > steps { > echo 'Hello, JDK' > sh 'java -version' > } > } > } > } > > > > But I don't know how to use that agent at next stage (one of parallel) ? > > > > > > -- > 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+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-users/e33ae964-ee84-4dc5-9f85-60335c265f6a%40googlegroups.com > <https://groups.google.com/d/msgid/jenkinsci-users/e33ae964-ee84-4dc5-9f85-60335c265f6a%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CALHFn6Nv73kE%3D2qa8ZNjSYnq3gCHGz%2BUnwTeLf3YXzKZpsi-YA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.