Thanks Tyler for your prompt response!
Just to make it clear - the "when" clause is NOT supported in the Scripted
Pipeline syntax and is only supported in the Declarative Pipeline
Jenkinsfile?
Is that explained anywhere in the documentation? Aren't those scripts
interpreted eventually by the same engine?
I am aware that the Declarative pipeline should start with the pipeline
outer block. The code that I have posted was for a scripted pipeline and I
have stated that in my original post.
Thanks,
Roi
On Thursday, February 9, 2017 at 12:11:46 PM UTC+2, R Tyler Croy wrote:
>
> (replies inline)
>
> On Thu, 09 Feb 2017, Roi Aldaag wrote:
>
> > for a very simple pipeline in the inline pipeline editor (not in an
> > external Jenkinsfile):
> >
> > *node {*
> > * stage('1') { // for display purposes*
> >
> > * }*
> > * stage('2') {*
> > * when {*
> > * //return false*
> > * }*
> > * }*
> > * stage('3') {*
> >
> > * }*
> > *}*
>
>
> This Jenkinsfile is _not_ a Declarative Pipeline but is instead using the
> Scripted Pipeline syntax.
>
> A Declarative Pipeline *must* have a `pipeline { }` outer block, and a
> number
> of other required sections, and `when` is only applicable within
> Declarative.
> Otherwise you can just use normal Groovy conditionals.
>
> See this document for more: https://jenkins.io/doc/book/pipeline/syntax/
>
> - R. Tyler Croy
>
> ------------------------------------------------------
> Code: <https://github.com/rtyler>
> Chatter: <https://twitter.com/agentdero>
> xmpp: [email protected] <javascript:>
>
> % gpg --keyserver keys.gnupg.net --recv-key 1426C7DC3F51E16F
> ------------------------------------------------------
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/38a2f213-9acc-4101-b9c8-f588286eeb08%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.