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

Parallel Nested Pods

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Critical Critical
    • kubernetes-plugin
    • None
    • kubernetes plugin 1.1
      jenkins 2.60.3

      not shure if it is the same problem

      https://issues.jenkins-ci.org/browse/JENKINS-42184

       

      #!/usr/bin/env groovy
      @Library('piper-lib') _
      
      timestamps {
        node {
          def uiGroups = ["group1", "group2"]
          def stepsForParallel = uiGroups.collectEntries {
            [
              "${it}" : {
                def label = UUID.randomUUID().toString() + "-${it}"
                podTemplate(
                  name: env.jaas_owner + '-jaas-${it}',
                  label: label,
                  containers: [
                  // Custom JNLP docker slave needs to be defined in each podTemplate
                  containerTemplate(
                    name: 'jnlp',
                    image: 'docker.wdf.sap.corp:50001/sap-production/jnlp:1.0.1',
                    args: '${computer.jnlpmac} ${computer.name}'
                  ),
                  containerTemplate(
                    name: 'busybox',
                    image: 'busybox',
                    ttyEnabled: true,
                    command: '/bin/cat',
                    envVars: [
                      envVar(key: 'ID', value: 'outer'),
                      envVar(key: 'GROUP', value: it)
                    ]
                  )
                ]
              ) {
                podTemplate(
                  label: label + '-inner',
                  containers: [
                    containerTemplate(
                      name: 'busybox2',
                      image: 'busybox',
                      ttyEnabled: true,
                      command: '/bin/cat',
                      envVars: [
                        envVar(key: 'ID', value: 'inner'),
                        envVar(key: 'GROUP', value: it)
                      ]
                    )
                  ]
                ) {
                    node(label + '-inner') {
                      container('busybox') {
                        sh '''
                        echo $ID
                        echo $GROUP
                        '''
                      }
                      container('busybox2') {
                        sh '''
                          echo $ID
                          echo $GROUP
                        '''
                      }
                    }
                  }
                }
              }
            ]
          }
      
          parallel stepsForParallel
        }
      }
      

      the outer container allways has group2 as group env ;(

            csanchez Carlos Sanchez
            gimler Gordon Franke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: