Jenkins Pipeline - fail a stage but continue the build

25,284 views
Skip to first unread message

Stefan Golas

unread,
Jan 3, 2017, 11:10:13 AM1/3/17
to Jenkins Users
Hello,
I would like to fail a stage in a pipeline job without aborting the build (pipeline). Is there a way?

regards Stefan

Andrew Bayer

unread,
Jan 3, 2017, 2:15:12 PM1/3/17
to jenkins...@googlegroups.com
There's no *easy* way to do this - in Declarative + Blue Ocean, we now have this capability, but it relies on adding some additional metadata to the "failed" stage that Blue Ocean reads. That said, if you don't care about the visualization (i.e., the stage is marked as passed in Blue Ocean or the Stage View, the build continues, but at the end of the build the whole build is marked as failed), catchError will do the trick - https://jenkins.io/doc/pipeline/steps/workflow-basic-steps/#code-catcherror-code-catch-error-and-set-build-result

A.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/6cfbefd9-99da-40a1-afe2-5005c72a5b5f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Cameron Jeffries

unread,
Feb 22, 2018, 2:55:28 AM2/22/18
to Jenkins Users
Can you please link to the syntax for the Blue Ocean metadata to use?  I'm having trouble finding it.


On Tuesday, January 3, 2017 at 11:15:12 AM UTC-8, Andrew Bayer wrote:
There's no *easy* way to do this - in Declarative + Blue Ocean, we now have this capability, but it relies on adding some additional metadata to the "failed" stage that Blue Ocean reads. That said, if you don't care about the visualization (i.e., the stage is marked as passed in Blue Ocean or the Stage View, the build continues, but at the end of the build the whole build is marked as failed), catchError will do the trick - https://jenkins.io/doc/pipeline/steps/workflow-basic-steps/#code-catcherror-code-catch-error-and-set-build-result

A.
On Tue, Jan 3, 2017 at 8:10 AM, 'Stefan Golas' via Jenkins Users <jenkins...@googlegroups.com> wrote:
Hello,
I would like to fail a stage in a pipeline job without aborting the build (pipeline). Is there a way?

regards Stefan

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.

Baptiste Mathus

unread,
Feb 22, 2018, 2:07:39 PM2/22/18
to jenkins...@googlegroups.com
Andrew was referring to adding code into Blue Ocean itself, not something doable for end users.

To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/d162304a-f064-4fb3-8cfd-8728ea283025%40googlegroups.com.

Raz Lubinsky

unread,
Sep 2, 2019, 5:40:37 AM9/2/19
to Jenkins Users
right now there is a new option

read first comment here:

although I must admit that I had a problem with it 
and if you can help me there I will be more than happy:
Reply all
Reply to author
Forward
0 new messages