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

Pipeline: Parallel syncs don't set environment variables properly.

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: p4-plugin
    • Labels:
    • Environment:
      CloudBees Jenkins Enterprise 2.107.2.1-rolling, P4 plugin 1.8.9
    • Similar Issues:

      Description

      The following scripted pipeline prints out a map of the environment variables returned by by each p4 checkout run in parallel.  The map in both cases contains the client from the second checkout (Client_2) as the value for P4_CLIENT.

      node() {
          parallel ([ BranchOne: {
              node {
                  def scmVars = checkout poll: false,
                              scm: perforce(credential: "Credential",
                                      populate: syncOnly(force: false,
                                              have: true,
                                              modtime: false,
                                              parallel: [enable: true, minbytes: '0', minfiles: '0', threads: '0'],
                                              pin: "",
                                              quiet: true,
                                              revert: false),
                                      workspace: manualSpec(charset: 'none',
                                              name: 'Client_1',
                                              pinHost: false,
                                              spec: clientSpec(allwrite: false,
                                                      backup: false,
                                                      clobber: true,
                                                      compress: false,
                                                      line: 'LOCAL',
                                                      locked: false,
                                                      modtime: false,
                                                      rmdir: true,
                                                      serverID: '',
                                                      streamName: "//stream",
                                                      type: 'WRITABLE',
                                                      view: "")))
                  echo "${scmVars}"
              }
          }, BranchTwo: {
              node {
                  def scmVars2 = checkout poll: false,
                              scm: perforce(credential: "Credential",
                                      populate: syncOnly(force: false,
                                              have: true,
                                              modtime: false,
                                              parallel: [enable: true, minbytes: '0', minfiles: '0', threads: '0'],
                                              pin: "",
                                              quiet: true,
                                              revert: false),
                                      workspace: manualSpec(charset: 'none',
                                              name: 'Client_2',
                                              pinHost: false,
                                              spec: clientSpec(allwrite: false,
                                                      backup: false,
                                                      clobber: true,
                                                      compress: false,
                                                      line: 'LOCAL',
                                                      locked: false,
                                                      modtime: false,
                                                      rmdir: true,
                                                      serverID: '',
                                                      streamName: "//stream",
                                                      type: 'WRITABLE',
                                                      view: "")))
                  echo "${scmVars2}"
              }
          }])
      }
      

        Attachments

          Activity

          Hide
          p4paul Paul Allen added a comment -

          Hi guys,  I have merged the original pull request and added a test case to test parallel stages.

          Show
          p4paul Paul Allen added a comment - Hi guys,  I have merged the original pull request and added a test case to test parallel stages.
          Hide
          wbrode William Brode added a comment -

          Awesome, thanks Paul!  I'll be sure to add a test for my next pull request.

          Show
          wbrode William Brode added a comment - Awesome, thanks Paul!  I'll be sure to add a test for my next pull request.
          Hide
          p4paul Paul Allen added a comment -

          Released in 1.10.6

          Show
          p4paul Paul Allen added a comment - Released in 1.10.6
          Hide
          alisdair_robertson Alisdair Robertson added a comment -

          Prior to this change the p4sync step yielded a map of the env vars, I'm using this in many pipeline scripts. After updating to 1.10.6 from 1.10.4 the p4sync step returns an empty map (breaking my pipeline scripts!)

          Was this expected?

          Show
          alisdair_robertson Alisdair Robertson added a comment - Prior to this change the p4sync  step yielded a map of the env vars, I'm using this in many pipeline scripts. After updating to 1.10.6 from 1.10.4 the  p4sync  step returns an empty map (breaking my pipeline scripts!) Was this expected?
          Hide
          p4karl Karl Wirth added a comment -

          Hi Alisdair Robertson - I've created a new bug to look into this - JENKINS-60074. Will let you know what I find from that bug.

          Show
          p4karl Karl Wirth added a comment - Hi Alisdair Robertson - I've created a new bug to look into this - JENKINS-60074 . Will let you know what I find from that bug.

            People

            Assignee:
            wbrode William Brode
            Reporter:
            wbrode William Brode
            Votes:
            4 Vote for this issue
            Watchers:
            9 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: