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

Missing nodes in during input step with parallel jobs

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • blueocean-plugin
    • Jenkins 2.57
      BlueOcean 1.0.1
    • Blue Ocean 1.1

      Problem
      There appears to be a mismatch between what the Blue Ocean API returns that causes the UI to become disoriented and hide information when dealing with a specific scenario given this pipeline configuration.

      Jenkinsfile

      def envs = [
        [env: "stage", region: "us-east-1"]
      ]
      stage("Plan") {
        def planJobs = [:]
        for(int i = 0; i < envs.size(); i++) {
          def details = envs.get(i)
          planJobs["${details.env}-${details.region}"] = {
            node() {
              echo "Running!"
            }
          }
        }
        parallel(planJobs)
      }
      stage("Apply") {
        def applyJobs = [:]
        for(int i = 0; i < envs.size(); i++) {
          def details = envs.get(i)
          def confirmedUser = "Auto"
          applyJobs["${details.env}-${details.region}"] = {
            def apply = false
            try {
              confirmedUser = input message: 'Apply Plan?', ok: 'Apply', submitterParameter: 'confirmedUser'
              apply = true
            } catch (err) {
              apply = false
              currentBuild.result = 'ABORTED'
            }
            if(apply) {
              node() {
                echo "Applying! Confirmed by ${confirmedUser}"
              }
            }
          }
        }
        parallel(applyJobs)
      }
      

      Background
      We dynamically generate the parallel stages based on information passed into the pipeline (or read from a config file). This way we can run for a project-defined set of params, i.e "run this in stage and prod in the us-east and eu-central regions" or any mix/match of those kinds of parameters. 

      singles.json: A parallel job that has two sequential stages with an input in between (Plan - input - Apply)

      doubles.json: A parallel job that has two jobs running the same two sequential stages with only one waiting on input:

      You can see in the image with the single "Apply" stage, it is missing the plan view (the singles.json file is the API response for that view)

      The second screenshot shows what we expect to see in the single job (without the "prod-us-east-1" node).

          [JENKINS-44493] Missing nodes in during input step with parallel jobs

          James Dumay added a comment -

          plukevdh thank you for reporting this. Could I please have a Jenkinsfile that reproduces the problem? The one provided in the gist doesn't execute cleanly without me modifying it. I actually tried modifying it and got some script security errors - it would be great if we could get an example that does not violate the sandbox.

          James Dumay added a comment - plukevdh thank you for reporting this. Could I please have a Jenkinsfile that reproduces the problem? The one provided in the gist doesn't execute cleanly without me modifying it. I actually tried modifying it and got some script security errors - it would be great if we could get an example that does not violate the sandbox.

          James Dumay added a comment -

          Assigning to myself for investigation. Scheduling a fix is dependant on receiving a clean Jenkinsfile that can be executed without script security violations.

          James Dumay added a comment - Assigning to myself for investigation. Scheduling a fix is dependant on receiving a clean Jenkinsfile that can be executed without script security violations.

          Absolutely. The code posted above was mainly meant to act as pseudocode to guide the investigation, but here is a Jenkinsfile that demonstrates the issue once the job hits the `input` directive.

           

          https://gist.github.com/plukevdh/3c1822fb1b9baea5f6fede218cbb1d28

          Luke van der Hoeven added a comment - Absolutely. The code posted above was mainly meant to act as pseudocode to guide the investigation, but here is a Jenkinsfile that demonstrates the issue once the job hits the `input` directive.   https://gist.github.com/plukevdh/3c1822fb1b9baea5f6fede218cbb1d28

          James Dumay added a comment -

          Thanks I was able to verify this one.

          James Dumay added a comment - Thanks I was able to verify this one.

            vivek Vivek Pandey
            plukevdh Luke van der Hoeven
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: