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

Missing nodes in during input step with parallel jobs

XMLWordPrintable

    • 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).

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

              Created:
              Updated: