Jenkins Pipeline Jenkinsfile: 'node' and 'pipeline' directives Jenkins Pipeline Jenkinsfile: 'node' and 'pipeline' directives jenkins jenkins

Jenkins Pipeline Jenkinsfile: 'node' and 'pipeline' directives


yes, a top-level node implies scripted pipeline, and a top-level pipeline implies declarative pipeline.

declarative appears to be the more future-proof option and the one that people recommend, like in this jenkins user list post where a core contributor says "go declarative." it's the only one the Visual Pipeline Editor can support. it supports validation. and it ends up having most of the power of scripted since you can fall back to scripted in most contexts. occasionally someone comes up with a use case where they can't quite do what they want to do with declarative, but this is generally people who have been using scripted for some time, and these feature gaps are likely to close in time. and finally, if you really have to bail on one or the other, writing a programmatic translator from declarative to scripted would be easier than the other way around (sort of by definition, since the grammar is more tightly constrained).

more context on pros of declarative from the general availability blog post: https://jenkins.io/blog/2017/02/03/declarative-pipeline-ga/

the most official docs i could find that mention both (as of June 21, 2017): https://jenkins.io/doc/book/pipeline/syntax/