A user feedback came in that he expected currentBuild.result=success to forcibly set the build result to success, even if there was some earlier failure marked, such as via catchError step.

      This behaviour originates in Core's Run.setResult() to prevent plugins from inadvertently masking early failures, but if it's the user doing it, I can see why this could be confusing.

      RunWrapper could do a force set of the result to avoid such a confusion. If the user shoots himself in a foot, he has only himself to blame anyway.

          [JENKINS-27574] RunWrapper.setResult() should be force set

          Jesse Glick added a comment -

          If you do not want the result to be set to FAILURE earlier, do not use catchError—its only purpose is to do this.

          That said, there may be some SimpleBuildStep impls (for example) which gratuitously change the build status and you want to reset it.

          Jesse Glick added a comment - If you do not want the result to be set to FAILURE earlier, do not use catchError —its only purpose is to do this. That said, there may be some SimpleBuildStep impls (for example) which gratuitously change the build status and you want to reset it.

          Andrew Bayer added a comment -

          svanoort - this seems pertinent to the discussion we were having yesterday...

          Andrew Bayer added a comment - svanoort - this seems pertinent to the discussion we were having yesterday...

          Jesse Glick added a comment -

          I would not advise changing the behavior of setResult. Anyway it is actually hard-coded in WorkflowRun. You could perhaps have it log a warning (using some TBD API to find a contextual TaskListener) if getResult after the call is not what was requested.

          Jesse Glick added a comment - I would not advise changing the behavior of setResult . Anyway it is actually hard-coded in WorkflowRun . You could perhaps have it log a warning (using some TBD API to find a contextual TaskListener ) if getResult after the call is not what was requested.

            Unassigned Unassigned
            kohsuke Kohsuke Kawaguchi
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: