HOW? Declarative Pipeline - Build Cause change default Parameter

28 views
Skip to first unread message

jieryn

unread,
May 22, 2018, 10:52:07 AM5/22/18
to Jenkins Users
Does anyone have a fragment or can lend a hand in me figuring out how
to get a Jenkinsfile based declarative pipeline where we have a
parameters { } section which will get a different defaultValue
depending on the build cause?

The goal is that I want to do a maven deployment if and only if this
job is being triggered by Jenkins during a nightly build trigger. The
default ought to change from false to true if we're in that @nightly
build trigger (or if the user has clicked build now, and has overriden
the default).

Any help is appreciated, thanks!

Baptiste Mathus

unread,
May 22, 2018, 3:06:06 PM5/22/18
to jenkins...@googlegroups.com
IIUC I did something similar in the past, I think you should leverage a when block, conditioned by that param.
Then, either in a local script block, or better using an external library for that logic: set that variable to the right value to skip or not the deployment stage.

If this is not clear, please provide a bit more details, and I'll do the same :).

Cheers

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAArU9ibH2qt9BkP8PDbmcfVAMhL0Zn2Xxo28_4W%3D8T3D2WgVzw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages