How to stop the current pipeline step?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

How to stop the current pipeline step?

Ivo Bellin Salarin
Hi all,

I am implementing the pipeline functionality for an existing plugin. Currently, on an eventual error the plugin sets the build status to FAILURE: the build continues executing all the build steps after the current one, and its status is set to failure, as expected.

But I would like the build to stop right after this step execution, skipping all the following steps . On some SO posts I have found that the ABORTED step should be preferred to FAILURE to obtain this behavior. Is this right? I am persuaded that the official Javadoc documentation is unclear. Has somebody a better explanation/documentation about the build Result(s) codes?

Many thanks in advance,
Ivo

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAPc4eF8Kif5jUUu9hf7h%2Bo%3DzMuqPY8cXxzacRwzQcrG7hunkNg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to stop the current pipeline step?

stephenconnolly

On Mon 4 Sep 2017 at 17:47, Ivo Bellin Salarin <[hidden email]> wrote:
Hi all,

I am implementing the pipeline functionality for an existing plugin. Currently, on an eventual error the plugin sets the build status to FAILURE: the build continues executing all the build steps after the current one, and its status is set to failure, as expected

Are you throwing an exception after setting the build result?

Iirc you should be throwing something if you want the execution to "stop"

(Though finally-type behaviour should continue execution)
.

But I would like the build to stop right after this step execution, skipping all the following steps . On some SO posts I have found that the ABORTED step should be preferred to FAILURE to obtain this behavior. Is this right? I am persuaded that the official Javadoc documentation is unclear. Has somebody a better explanation/documentation about the build Result(s) codes?

Many thanks in advance,
Ivo

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAPc4eF8Kif5jUUu9hf7h%2Bo%3DzMuqPY8cXxzacRwzQcrG7hunkNg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
Sent from my phone

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CA%2BnPnMyHDhqnkO3MwkYmh0zBYUF%3DdyTFaLR4Rz8CbZ0NgZQhPg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to stop the current pipeline step?

Ivo Bellin Salarin

No, I wasn't throwing anything, since in the past the perform(Abstract build, ...) was returning a Boolean, and AFAIk a False was sufficient to stop the execution...

Should the thrown exception belong to a definite set, or inherit from a specific base type?


On lun. 4 sept. 2017 à 20:29 Stephen Connolly <[hidden email]> wrote:
On Mon 4 Sep 2017 at 17:47, Ivo Bellin Salarin <[hidden email]> wrote:
Hi all,

I am implementing the pipeline functionality for an existing plugin. Currently, on an eventual error the plugin sets the build status to FAILURE: the build continues executing all the build steps after the current one, and its status is set to failure, as expected

Are you throwing an exception after setting the build result?

Iirc you should be throwing something if you want the execution to "stop"

(Though finally-type behaviour should continue execution)
.

But I would like the build to stop right after this step execution, skipping all the following steps . On some SO posts I have found that the ABORTED step should be preferred to FAILURE to obtain this behavior. Is this right? I am persuaded that the official Javadoc documentation is unclear. Has somebody a better explanation/documentation about the build Result(s) codes?

Many thanks in advance,
Ivo

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAPc4eF8Kif5jUUu9hf7h%2Bo%3DzMuqPY8cXxzacRwzQcrG7hunkNg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
Sent from my phone

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CA%2BnPnMyHDhqnkO3MwkYmh0zBYUF%3DdyTFaLR4Rz8CbZ0NgZQhPg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAPc4eF9KnxMLfEafznXvm3_DqgKJBrmxP6jHyJg2akj9uPKuLg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to stop the current pipeline step?

stephenconnolly

On 4 September 2017 at 12:42, Ivo Bellin Salarin <[hidden email]> wrote:

No, I wasn't throwing anything, since in the past the perform(Abstract build, ...) was returning a Boolean, and AFAIk a False was sufficient to stop the execution...

Should the thrown exception belong to a definite set, or inherit from a specific base type?


On lun. 4 sept. 2017 à 20:29 Stephen Connolly <[hidden email]> wrote:
On Mon 4 Sep 2017 at 17:47, Ivo Bellin Salarin <[hidden email]> wrote:
Hi all,

I am implementing the pipeline functionality for an existing plugin. Currently, on an eventual error the plugin sets the build status to FAILURE: the build continues executing all the build steps after the current one, and its status is set to failure, as expected

Are you throwing an exception after setting the build result?

Iirc you should be throwing something if you want the execution to "stop"

(Though finally-type behaviour should continue execution)
.

But I would like the build to stop right after this step execution, skipping all the following steps . On some SO posts I have found that the ABORTED step should be preferred to FAILURE to obtain this behavior. Is this right? I am persuaded that the official Javadoc documentation is unclear. Has somebody a better explanation/documentation about the build Result(s) codes?

Many thanks in advance,
Ivo

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAPc4eF8Kif5jUUu9hf7h%2Bo%3DzMuqPY8cXxzacRwzQcrG7hunkNg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
Sent from my phone

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CA%2BnPnMyHDhqnkO3MwkYmh0zBYUF%3DdyTFaLR4Rz8CbZ0NgZQhPg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAPc4eF9KnxMLfEafznXvm3_DqgKJBrmxP6jHyJg2akj9uPKuLg%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CA%2BnPnMy46JvT%2BxSbCyn1GkJuLVkegoxA%3DRheWje8BAQAbie3Wg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to stop the current pipeline step?

Jesse Glick-4
Throw `AbortException`. Do _not_ attempt to set the build status yourself.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr249nUA1vquuFLXTFfdW3h0a7jWgeysUFzTu5efH%3DxnDA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to stop the current pipeline step?

Ivo Bellin Salarin
@Jesse: what's the preferred way to set the build result to unstable?

Le mer. 6 sept. 2017 à 00:03, Jesse Glick <[hidden email]> a écrit :
Throw `AbortException`. Do _not_ attempt to set the build status yourself.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr249nUA1vquuFLXTFfdW3h0a7jWgeysUFzTu5efH%3DxnDA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAPc4eF9O4PUGp9QYPQPZ%2BJy%3DOzFibdfaEr%3DfGGncP22cYCtAUA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to stop the current pipeline step?

Jesse Glick-4
On Thu, Sep 7, 2017 at 9:02 AM, Ivo Bellin Salarin
<[hidden email]> wrote:
> @Jesse: what's the preferred way to set the build result to unstable?

`setResult(UNSTABLE)`. But if your step “fails”, just throw
`AbortException` and let the caller decide what to do.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr0TS%3D4pmrhq79569mBCcEb6hTO92aL3NUH1o%3DmxZLCQmw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.