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

Inconsistent API data about parallel pipeline stage IDs

    Details

    • Similar Issues:

      Description

      I have a jenkins pipeline which contains parallel stages. When I invoke GET /job/:job-name/:run-id/wfapi/describe to get the stages I can't distinguish in any way which stages are the parallel ones and which is their parent stage. All I have is a list of stages with names, statuses and IDs. So I decided to use Blue Ocean's API blue/rest/organizations/jenkins/pipelines/:job-name/runs/run-id/nodes but it doesn't return the same IDs and same names for the parallel stages as the classic API. The parallel stages are declared like this in the Jenkinsfile:
      node {
      parallel 'one':

      { stage('1') \{ ... }

      }, 'two':

      { stage('2') \{ ... }

      }
      }
      So the classic API returns stages with names "1" and "2" and the BlueOcean API returns stages with names "one" and "two" and the IDs of the stages are different in the two APIs.

      So there doesn't seem to be a way to get the parallel stage names and IDs in BlueOcean and there is no way to get the parent-child relations for parallel stages in the classic API.

        Attachments

          Activity

          Hide
          raulkumar28 Rahul Racha added a comment -

          I'm seeing the same behavior.

          Going by the documentation for parallel stages in scripted pipeline style, the code mentioned above should look something like:

          node {
          parallel 'one': { ... }, 'two': { ... }
          } 

          However, with this syntax, /wfapi/describe would NOT display stages 'one' & 'two' (as they're not wrapped inside of a stage{} block)

          Workaround for me is to add a redundant stage{} block inside each of the parallel stage/branch blocks (Same as what Alexander Vukov is doing)

          node {
          parallel 'one': { 
                           stage('one') { ... }
                   },
                   'two': {
                           stage('two') { ... }
                   }
          }
          Show
          raulkumar28 Rahul Racha added a comment - I'm seeing the same behavior. Going by the documentation for parallel stages in scripted pipeline style, the code mentioned above should look something like: node { parallel 'one': { ... }, 'two': { ... } } However, with this syntax, /wfapi/describe would NOT display stages 'one' & 'two' (as they're not wrapped inside of a stage{}  block) Workaround for me is to add a redundant stage{} block inside each of the parallel stage/branch blocks (Same as what Alexander Vukov is doing) node { parallel 'one': { stage('one') { ... } }, 'two': { stage('two') { ... } } }

            People

            • Assignee:
              svanoort Sam Van Oort
              Reporter:
              alexvukov Alexander Vukov
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: