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

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

XMLWordPrintable

      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
      }
      
      

       

            Assignee:
            Unassigned
            Reporter:
            Yang
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: