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

Can I use multiple podTemplate not nest

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Not A Defect
    • Icon: Major Major
    • kubernetes-plugin
    • None

      Hello.

       

      When my code compiles with heavy CPU and memory,

      I think Jenkins create one pod and create several containers is not good idea.

      I think Jenkins create several pods is good idea. 

      Am I right?

       

      Is it possible to use like below ? I think this is not correct DSL. and I can't find right way.

      podTemplate(
        label: 'mypod1',
        containers: [
          containerTemplate(name: 'maven1', image: 'maven', ttyEnabled: true, command: 'cat')
        ],
        volumes: [
          hostPathVolume(mountPath: '/var/run/docker.sock', hostPath: '/var/run/docker.sock')
        ]
      ),
      podTemplate(
        label: 'mypod2',
        containers: [
          containerTemplate(name: 'maven2', image: 'maven', ttyEnabled: true, command: 'cat')
        ],
        volumes: [
          hostPathVolume(mountPath: '/var/run/docker.sock', hostPath: '/var/run/docker.sock')
        ]
      ) {
      stage('Sync') {
        parallel Syncfortype1: {
          node('mypod1') {
            container(name: 'maven1', shell: '/bin/bash') {
              sh 'cd ${WORKSPACE}'
              p4sync blah blah
            }
          }
        },
        Syncfortype2: {
          node('mypod2') {
            container(name: 'maven2', shell: '/bin/bash') {
              sh 'cd ${WORKSPACE}'
              p4sync blah blah
            }
          }
        }
      }
      }
      

            csanchez Carlos Sanchez
            horangs Hokwang Lee
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: