Parallel Nested Pods

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      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 ;(

            Assignee:
            Carlos Sanchez
            Reporter:
            Gordon Franke
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: