"scripted" Pipeline simply uses typical programmatic "if" construct.

Declarative makes this more, well, declarative and is a bit different for
readability purpose.

Le 9 févr. 2017 1:52 PM, "Roi Aldaag" <roi.ald...@gmail.com> a écrit :

> 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: rty...@jabber.org
>>
>>   % 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 jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/jenkinsci-users/38a2f213-9acc-4101-b9c8-f588286eeb08%40googlegroups.
> com
> <https://groups.google.com/d/msgid/jenkinsci-users/38a2f213-9acc-4101-b9c8-f588286eeb08%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CANWgJS7WXqY1pMwB%2BaOZGmR0d74G7wmz4mOnm24w0Zq653rdkQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to