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

Build Flow does not always run multiple jobs in parallel: requires parameters to be passed, and "Execute concurrent" in downstream job

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • build-flow-plugin
    • None

      I created two jobs, flowA and flowB. flowA is a "Build Flow" job; flowB is just a regular job ("Freestyle project") that does nothing.

      I used this for the Groovy code in flowA:

      =========================
      parallel (

      { build("flowB" ) },
      { build("flowB" ) }

      ,

      { build("flowB" ) }

      )
      =========================

      The console output from running this job was:

      =========================
      Started by user Ken Beal
      parallel {
      Schedule job flowB
      Schedule job flowB
      Schedule job flowB
      Build flowB #1 started
      Build flowB #1 started
      Build flowB #1 started
      flowB #1 completed
      flowB #1 completed
      flowB #1 completed
      }
      Notifying upstream projects of job completion
      Finished: SUCCESS
      =========================

      Then I thought, perhaps it needs parameters? So I added a string parameter named "string" with default "ABC" to flowB, then updated flowA's Groovy code to:

      =========================
      parallel (

      { build("flowB", string: 1 ) }

      ,

      { build("flowB", string: 2 ) }

      ,

      { build("flowB", string: 3 ) }

      )
      =========================

      I rebuilt, and got the same result. I almost submitted the bug report at this stage, where I'm blocked, but I found out how to unblock myself so I'll report that as well (and, this might be why this set of bugs hasn't been reported yet – perhaps most people start with jobs that have parameters). I then checked flowB's "Execute concurrently builds if necessary", and re-ran it; this time, the output looked better:

      =========================
      Started by user Ken Beal
      parallel {
      Schedule job flowB
      Schedule job flowB
      Schedule job flowB
      Build flowB #3 started
      Build flowB #4 started
      flowB #3 completed
      Build flowB #5 started
      flowB #4 completed
      flowB #5 completed
      }
      Notifying upstream projects of job completion
      Finished: SUCCESS
      =========================

      Then I did a final check, as I wanted to know which was required, the "concurrent" checkbox, or the parameter passing? I removed the parameter passing from the Groovy in flowA, but left flowB alone, and re-ran; then I got the same results that I originally got – proving that BOTH are necessary.

      So, with the current state of the code, in order to run a downstream job in parallel, that job needs to be configured to run in parallel (the "duh" part), and also, the calling job needs to pass parameters down (not at all obvious).

      I synced to the latest available Jenkins (1.589) and Build Flow plugin (0.16), before reproducing and reporting this today.

            Unassigned Unassigned
            kbeal Ken Beal
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: