Newbie question: pipeline {} vs node {}

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Newbie question: pipeline {} vs node {}

Christoph Ruepprich
Looking at some pipeline scripting examples, I see that there are two different ways to script a pipeline. One begins with pipeline {} the other with node {}. What is the difference between the two, and when would I use one or the other?

thanks,
C

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/43f5428f-25b4-4e4f-994a-427fb1c8849f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Newbie question: pipeline {} vs node {}

Robert Hales
There are 2 different syntaxes. Declarative is the pipeline{} style. scripted doesn't necessarily start with node{}, but uses that heavily. 

Scripted syntax is basically a straight groovy code DSL. Use it when you need to do more complex and interesting things and aren't afraid to get down into writing code. 

Declarative syntax is a more friendly and easy-to-learn syntax. It can be intermingled with scripted in many ways, so I usually like to start with a declarative pipeline and as things start to get more complex where I have had to use too many script{} block or other straight groovy, then I'll consider scraping the declarative framework and converting to a straight groovy script. 


On Tuesday, October 31, 2017 at 8:37:24 AM UTC-6, Christoph Ruepprich wrote:
Looking at some pipeline scripting examples, I see that there are two different ways to script a pipeline. One begins with pipeline {} the other with node {}. What is the difference between the two, and when would I use one or the other?

thanks,
C

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/f444fbb1-8cc8-4c91-9641-9978268f3f7d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Newbie question: pipeline {} vs node {}

Christoph Ruepprich
Thanks Robert,
it helps a lot just knowing what the two different systems are called (declarative vs. scripted).

Cheers,
C


On Tuesday, 31 October 2017 09:53:58 UTC-5, Robert Hales wrote:
There are 2 different syntaxes. Declarative is the pipeline{} style. scripted doesn't necessarily start with node{}, but uses that heavily. 

Scripted syntax is basically a straight groovy code DSL. Use it when you need to do more complex and interesting things and aren't afraid to get down into writing code. 

Declarative syntax is a more friendly and easy-to-learn syntax. It can be intermingled with scripted in many ways, so I usually like to start with a declarative pipeline and as things start to get more complex where I have had to use too many script{} block or other straight groovy, then I'll consider scraping the declarative framework and converting to a straight groovy script. 


On Tuesday, October 31, 2017 at 8:37:24 AM UTC-6, Christoph Ruepprich wrote:
Looking at some pipeline scripting examples, I see that there are two different ways to script a pipeline. One begins with pipeline {} the other with node {}. What is the difference between the two, and when would I use one or the other?

thanks,
C

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/8d7ff6d1-0205-4e99-9c75-9613289f11d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.