Declarative Piepline: conditional execution of stage/steps depending on branch

74 views
Skip to first unread message

Eddard

unread,
Oct 26, 2016, 12:09:04 PM10/26/16
to Jenkins Users
I recently been introduced to declarative pipeline 
me and my team would like to use this model on most
of our CI Jobs. 

The problem we are trying to solve right now is to find a way to execute certain stages or steps only on certain branches (master)
is there a declarative way to do that?

best regards
Eddard

Andrew Bayer

unread,
Nov 21, 2016, 2:25:46 PM11/21/16
to jenkins...@googlegroups.com
Hi -

In the latest release of Declarative Pipelines (0.6), we've got a new "when" section on stages to do exactly what you want - https://github.com/jenkinsci/pipeline-model-definition-plugin/wiki/Advanced#controlling-when-stages-execute

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/db46828f-a8df-45ce-8623-e9e401096866%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Omeka

unread,
Dec 21, 2016, 1:54:41 PM12/21/16
to Jenkins Users
Thanks andrew it works very well.

do you have any intention to make failire/success/etc... usable in normal stages so i can execute a stage only if the previous one is success?


Le lundi 21 novembre 2016 20:25:46 UTC+1, Andrew Bayer a écrit :
Hi -

In the latest release of Declarative Pipelines (0.6), we've got a new "when" section on stages to do exactly what you want - https://github.com/jenkinsci/pipeline-model-definition-plugin/wiki/Advanced#controlling-when-stages-execute

A.
On Wed, Oct 26, 2016 at 9:09 AM, Eddard <exup...@gmail.com> wrote:
I recently been introduced to declarative pipeline 
me and my team would like to use this model on most
of our CI Jobs. 

The problem we are trying to solve right now is to find a way to execute certain stages or steps only on certain branches (master)
is there a declarative way to do that?

best regards
Eddard

--
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.

Andrew Bayer

unread,
Dec 23, 2016, 2:49:22 PM12/23/16
to jenkins...@googlegroups.com
I think that should be doable already? Just remember that if "currentBuild.result == null", that's success.

A.

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/770e1b95-f26b-4b9d-9261-e4cd80477edb%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages