Give following pipeline script, b1 branch finishes immediately and b2 is not completed yet (waiting for input). I determine branch's completion from a branch's end FlowNode and calling FlowNode.isRunning() returns true instead false as its already completed. This makes BlueOcean API returns b1 as running whereas its already been completed.

      node {
          stage("hey") {
              echo "hello from hey"
          }
          
          stage("par") {
              parallel (
                  "b1" : {
                      echo 'hello from b1'
                  },
      
                  "b2" : {
                      def branchInput = input message: 'Please input branch to test against', parameters: [[$class: 'StringParameterDefinition', defaultValue: 'master', description: '', name: 'branch']]
                      echo "BRANCH NAME: ${branchInput}"
                  }             
              )            
          }
             
          stage("ho") {
              echo "hello from ho"
          }
          
      }
      

          [JENKINS-38223] FlowNode.isRunning is not very useful

          Sam Van Oort added a comment -

          > Rather than asking caller to infer that all has ended since you have this end block, which is true but 'isRunning() API' makes no sense to return true in this case as well.

          Yeah, it's a clear bug in workflow-cps here. I think fixable, by looking more closely at cases with > 1 currentHead (and then seeing if it's the end of one of the currently executing branch). May be something I can fix as a small one-off fix (probably needs a change in workflow-api and workflow-cps though, due to spec).

          In pipeline-graph-analysis I use a bit of a deeper inspection to work around this, by looking to see if the node is the BlockEndNode for a BlockStartNode which is a parallel branch start.

          Sam Van Oort added a comment - > Rather than asking caller to infer that all has ended since you have this end block, which is true but 'isRunning() API' makes no sense to return true in this case as well. Yeah, it's a clear bug in workflow-cps here. I think fixable, by looking more closely at cases with > 1 currentHead (and then seeing if it's the end of one of the currently executing branch). May be something I can fix as a small one-off fix (probably needs a change in workflow-api and workflow-cps though, due to spec). In pipeline-graph-analysis I use a bit of a deeper inspection to work around this, by looking to see if the node is the BlockEndNode for a BlockStartNode which is a parallel branch start.

          Michael Neale added a comment -

          vivek so is this fix needed or is it more a temporary thing for the current blue ocean code and should go away when bismuth is used instead?

          Michael Neale added a comment - vivek so is this fix needed or is it more a temporary thing for the current blue ocean code and should go away when bismuth is used instead?

          Sam Van Oort added a comment -

          michaelneale Bismuth doesn't suffer this issue, but it has a kind of filthy hack in place for handling parallels unfortunately (I'd like to be able to drop that).

          Sam Van Oort added a comment - michaelneale Bismuth doesn't suffer this issue, but it has a kind of filthy hack in place for handling parallels unfortunately (I'd like to be able to drop that).

          Jesse Glick added a comment -

          I still think the method is behaving according to spec—it is just not a useful spec. When the branch has completed, a BlockEndNode is created and becomes one of the heads of the flow graph. Thus it isRunning() according to the definition.

          The spec will not be changed (that would not be compatible), so the most that would be done is to deprecate the method, and possibly introduce a new method with a different semantics: example

          Jesse Glick added a comment - I still think the method is behaving according to spec—it is just not a useful spec. When the branch has completed, a BlockEndNode is created and becomes one of the heads of the flow graph. Thus it isRunning() according to the definition. The spec will not be changed (that would not be compatible), so the most that would be done is to deprecate the method, and possibly introduce a new method with a different semantics: example

          Michael Neale added a comment -

          Agree Jesse - if that is the spec, that is the spec. Perhaps a clearer name would help, but this is much needed.

          Michael Neale added a comment - Agree Jesse - if that is the spec, that is the spec. Perhaps a clearer name would help, but this is much needed.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/org/jenkinsci/plugins/workflow/graph/FlowNode.java
          http://jenkins-ci.org/commit/workflow-api-plugin/5deffd7f6f73638576ddcacc2890e8dfd3438408
          Log:
          JENKINS-38223 Introduced FlowNode.isActive.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/org/jenkinsci/plugins/workflow/graph/FlowNode.java http://jenkins-ci.org/commit/workflow-api-plugin/5deffd7f6f73638576ddcacc2890e8dfd3438408 Log: JENKINS-38223 Introduced FlowNode.isActive.

          Code changed in jenkins
          User: Sam Van Oort
          Path:
          Jenkinsfile
          pom.xml
          src/main/java/org/jenkinsci/plugins/workflow/graph/FlowNode.java
          src/test/java/org/jenkinsci/plugins/workflow/graph/FlowNodeTest.java
          http://jenkins-ci.org/commit/workflow-api-plugin/63e8ad0c271573f4bebc57fb0776b3fac4fccea9
          Log:
          Merge pull request #45 from jglick/FlowNode.isActive-JENKINS-38223

          JENKINS-38223 Introduced FlowNode.isActive

          Compare: https://github.com/jenkinsci/workflow-api-plugin/compare/55979f5e128b...63e8ad0c2715

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Sam Van Oort Path: Jenkinsfile pom.xml src/main/java/org/jenkinsci/plugins/workflow/graph/FlowNode.java src/test/java/org/jenkinsci/plugins/workflow/graph/FlowNodeTest.java http://jenkins-ci.org/commit/workflow-api-plugin/63e8ad0c271573f4bebc57fb0776b3fac4fccea9 Log: Merge pull request #45 from jglick/FlowNode.isActive- JENKINS-38223 JENKINS-38223 Introduced FlowNode.isActive Compare: https://github.com/jenkinsci/workflow-api-plugin/compare/55979f5e128b...63e8ad0c2715

          Code changed in jenkins
          User: Jesse Glick
          Path:
          pom.xml
          src/main/java/org/jenkinsci/plugins/workflow/support/actions/LogActionImpl.java
          http://jenkins-ci.org/commit/workflow-support-plugin/d78f301c4630ad3d9cbd408494ed1ad36e97b132
          Log:
          JENKINS-38223 Using FlowNode.isActive to eliminate the main overhead in JENKINS-45553.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml src/main/java/org/jenkinsci/plugins/workflow/support/actions/LogActionImpl.java http://jenkins-ci.org/commit/workflow-support-plugin/d78f301c4630ad3d9cbd408494ed1ad36e97b132 Log: JENKINS-38223 Using FlowNode.isActive to eliminate the main overhead in JENKINS-45553 .

          Code changed in jenkins
          User: Sam Van Oort
          Path:
          pom.xml
          src/main/java/org/jenkinsci/plugins/workflow/support/actions/LogActionImpl.java
          src/main/java/org/jenkinsci/plugins/workflow/support/visualization/table/FlowGraphTable.java
          src/test/java/org/jenkinsci/plugins/workflow/support/actions/LogActionImplTest.java
          http://jenkins-ci.org/commit/workflow-support-plugin/236f06ca40fc019ca4da2cadb4d0804971faa9db
          Log:
          Merge pull request #38 from jglick/FlowNode.isActive-JENKINS-38223

          JENKINS-38223 Using FlowNode.isActive to improve JENKINS-45553

          Compare: https://github.com/jenkinsci/workflow-support-plugin/compare/01f9538af15c...236f06ca40fc

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Sam Van Oort Path: pom.xml src/main/java/org/jenkinsci/plugins/workflow/support/actions/LogActionImpl.java src/main/java/org/jenkinsci/plugins/workflow/support/visualization/table/FlowGraphTable.java src/test/java/org/jenkinsci/plugins/workflow/support/actions/LogActionImplTest.java http://jenkins-ci.org/commit/workflow-support-plugin/236f06ca40fc019ca4da2cadb4d0804971faa9db Log: Merge pull request #38 from jglick/FlowNode.isActive- JENKINS-38223 JENKINS-38223 Using FlowNode.isActive to improve JENKINS-45553 Compare: https://github.com/jenkinsci/workflow-support-plugin/compare/01f9538af15c...236f06ca40fc

          Sam Van Oort added a comment -

          Review finished and released with workflow-api 2.22

          Sam Van Oort added a comment - Review finished and released with workflow-api 2.22

            jglick Jesse Glick
            vivek Vivek Pandey
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: