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

wfapi Plugin Incorrectly Reports Stages as Successful Even When They Fail

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • Jenkins v2.504.2
      Pipeline: REST API Plugin v2.38

      Take the following example:

       

      stage('Build') {
          stage('Inner') {
              print("This inner stage succeeded")
          }
          throw new RuntimeException("Intentionally failing Build stage")
      }
      

      It results in the following JSON from the wfapi endpint, which indicates both 'Inner' and 'Build' succeeded:

       

      {
        "_links": {
          "self": {
            "href": "/job/paragc-scratch/149/wfapi/describe"
          }
        },
        "id": "149",
        "name": "#149",
        "status": "FAILED",
        "startTimeMillis": 1750107546031,
        "endTimeMillis": 1750107547934,
        "durationMillis": 1903,
        "queueDurationMillis": 4,
        "pauseDurationMillis": 0,
        "stages": [
          {
            "_links": {
              "self": {
                "href": "/job/paragc-scratch/149/execution/node/5/wfapi/describe"
              }
            },
            "id": "5",
            "name": "Build",
            "execNode": "",
            "status": "SUCCESS",
            "startTimeMillis": 1750107547672,
            "durationMillis": 26,
            "pauseDurationMillis": 0
          },
          {
            "_links": {
              "self": {
                "href": "/job/paragc-scratch/149/execution/node/7/wfapi/describe"
              }
            },
            "id": "7",
            "name": "Inner",
            "execNode": "",
            "status": "SUCCESS",
            "startTimeMillis": 1750107547698,
            "durationMillis": 42,
            "pauseDurationMillis": 0
          }
        ]
      } 

       

      From my experiments, it seems to me that once a new stage directive is encountered, the status of the prior stage directive is frozen. In order for 'Build' to report FAILED, it has to encounter an error before the next stage directive:

      stage('Build') {
          throw new RuntimeException("Intentionally failing Build stage")
          stage('Inner') {
              println("This inner stage succeeded")
          }
      } 

      Note that this inconsistency only appears in wfapi; not in the visualization, which shows the correct stage statuses (see image).

            surenpi Rick
            pchandra Parag
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: