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

Inconsistent API data about parallel pipeline stage IDs

      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.

          [JENKINS-59248] Inconsistent API data about parallel pipeline stage IDs

          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 alexvukov is doing)

          node {
          parallel 'one': { 
                           stage('one') { ... }
                   },
                   'two': {
                           stage('two') { ... }
                   }
          }

          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 alexvukov is doing) node { parallel 'one': { stage('one') { ... } }, 'two': { stage('two') { ... } } }

            Unassigned Unassigned
            alexvukov Alexander Vukov
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: