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

Can't get correct variable in parallel docker.image().inside

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • docker-workflow-plugin
    • None
    • Jenkins 2.293
      docker plugin: 1.2.0

      In docker plugin parallel situation, the x didn't get correct output in docker.image.inside, and always get the last element in the array,

      In my example, the output: 2 2 While expect output: 1 2. Here is the codes:

      node {
      x_array = [1,2]
      x_map = [:]
      image = "centos:latest"
          for (x in x_array) {
              x_map[x] = {
              image = docker.image(image)
              image.pull
              image.inside("-t") {
                   sh "echo $x"
              }
              }
          }
          parallel x_map
      }
      
      

       

            Unassigned Unassigned
            yc2681 Yang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: