Details

    • Similar Issues:

      Description

      On the issue https://issues.jenkins-ci.org/browse/JENKINS-45579 Devin Nusbaum has added a couple of really nice steps WarnErrorStep and CatchErrorStep, this improvement is a continuation of his work (mostly copy) to add another user case, when you need to ignore the failure of a stage but you want to mar the build as successful and it is not possible to use CatchErrorStep or you want to simplify your stage code, something like the following stage that it is waiting for an input on declarative where you can not use CatchErrorStep for the input, ignoreErrors option would mark the build as SUCCESS and the stage as UNSTABLE.

      stage('Release Candidate') {
        agent any
        options {
          ignoreErrors('Release Candidate was not uploaded')
        }
        input {
          message 'Should we upload the Release Candidate version?'
          ok 'Yes, we should.'
        }
        when {
          beforeAgent true
          beforeInput true
          anyOf {
            tag "rc-\\d+\\.\\d+\\.\\d+*"
          }
        }
        steps {
          echo "My Release Candidate process"
        }
      }
      

        Attachments

          Issue Links

            Activity

            Hide
            dnusbaum Devin Nusbaum added a comment -

            Ivan Fernandez Calvo Thanks for the RFE. I'm not quite sure what ignoreErrors is doing in your example, it looks like a block scope step because it is in options, but by your description it sounds like a basic step like unstable?

            If I understand correctly, maybe better to just add option to the unstable step, so it could be used like this:

            unstable(message: "Release candidate was not uploaded", setBuildResult: false)
            

            If you mean for ignoreErrors to act like catchError(buildResult: 'SUCCESS', stageResult: 'UNSTABLE'), I think you could just put that in options today, like this (untested):

            options {
              catchError(message: 'Release Candidate was not uploaded', buildResult: 'SUCCESS', stageResult: 'UNSTABLE')
            }
            
            Show
            dnusbaum Devin Nusbaum added a comment - Ivan Fernandez Calvo Thanks for the RFE. I'm not quite sure what ignoreErrors is doing in your example, it looks like a block scope step because it is in options, but by your description it sounds like a basic step like unstable ? If I understand correctly, maybe better to just add option to the unstable step, so it could be used like this: unstable(message: "Release candidate was not uploaded", setBuildResult: false) If you mean for ignoreErrors to act like catchError(buildResult: 'SUCCESS', stageResult: 'UNSTABLE') , I think you could just put that in options today, like this (untested): options { catchError(message: 'Release Candidate was not uploaded', buildResult: 'SUCCESS', stageResult: 'UNSTABLE') }
            Hide
            ifernandezcalvo Ivan Fernandez Calvo added a comment - - edited

            you are right, this thing does not make sense, it is the same. I did not see it because catchError is not available to select in the Declarative Directive Generator, you only can select wramError

            Show
            ifernandezcalvo Ivan Fernandez Calvo added a comment - - edited you are right, this thing does not make sense, it is the same. I did not see it because catchError is not available to select in the Declarative Directive Generator , you only can select wramError
            Hide
            ifernandezcalvo Ivan Fernandez Calvo added a comment -

            Devin Nusbaum for the declarative input step seems there is not a good solution to catch the ABORT and transform it in another thing, I'll continue playing with it to find a solution.

            Show
            ifernandezcalvo Ivan Fernandez Calvo added a comment - Devin Nusbaum for the declarative input step seems there is not a good solution to catch the ABORT and transform it in another thing, I'll continue playing with it to find a solution.

              People

              • Assignee:
                ifernandezcalvo Ivan Fernandez Calvo
                Reporter:
                ifernandezcalvo Ivan Fernandez Calvo
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: