I am very excited to announce the addition of Declarative Pipeline syntax 1.0 to Jenkins Pipeline . We think this new syntax will enable everyone involved in DevOps, regardless of expertise, to participate in the continuous delivery process. Whether creating, editing or reviewing a pipeline, having a straightforward structure helps to understand and predict the flow of the pipeline and provides a common foundation across all pipelines.
Pipeline as Code was one of the pillars of the Jenkins 2.0 release and an essential part of implementing continuous delivery. Defining all of the stages of an application's CD pipeline within a "Jenkinsfile" and treating it as part of the application code automatically provides all of the benefits inherent in SCM:
- Retain history of all changes to Pipeline
- Rollback to a previous pipeline version
- Review new changes to the pipeline in code review
- Test new pipeline steps in branches
- Audit changes to the pipeline
- Run the same pipeline on a different Jenkins server
We recommend people begin using it for all their pipeline definitions in Jenkins and the CloudBees Jenkins Platform. The plugin has been available for use and testing starting with the 0.1 release that was debuted at Jenkins World in September, it has already been installed over 5,000 times.
If you haven't tried Pipeline or have considered Pipeline in the past we believe this new syntax is much more approachable with an easy adoption curve to quickly realize all of the benefits of Pipeline as Code. In addition, the predefined structure of Declarative makes it possible to create and edit pipelines with a graphical user interface (GUI). The Blue Ocean team is actively working on a Pipeline Editor that will be included in an upcoming release.
If you have already begun using Pipelines in Jenkins we believe that this new alternative syntax can help expand that usage. The original syntax for defining pipelines in Jenkins is a Groovy DSL that allows most of the features of full imperative programming. This syntax is still fully supported and is now referred to as "Scripted Pipeline Syntax" to distinguish it from "Declarative Pipeline Syntax." Both use the same underlying execution engine in Jenkins and both will generate the same results in Pipeline Stage View or Blue Ocean visualization. All existing pipeline steps, global variables and shared libraries can be used in either. You can now create more cookie-cutter pipelines and extend the power of Pipeline to all users regardless of Groovy expertise.
Other key features of Declarative Pipeline include:
- Syntax Checking
- Immediate runtime syntax checking with explicit error messages
- API endpoint for linting Jenkinsfiles
- CLI command to lint Jenkinsfiles
- Docker Pipeline plugin integration
- Run all stages in a single container
- Run each stage in a different container
- Easy configuration
- Quickly define parameters for your pipeline
- Quickly define environment variables and credentials for your pipeline
- Quickly define options (such as timeout, retry, build discarding) for your pipeline
- Conditional actions
- Send notifications or take actions depending upon success or failure
- Skip stages based on branches, environment, or other Boolean expression
Be on the lookout for future blog posts here or on Jekins.io detailing specific examples of scenarios or features in Declarative Pipeline. Andrew Bayer, one of the primary engineers behind Declarative Pipeline, will be presenting at FOSDEM in Brussels, Belgium this weekend. We have also scheduled an online Jenkins Area Meetup (JAM) later this month to demo the features of Declarative Pipeline and give a sneak peek at the upcoming Blue Ocean Pipeline Editor.
In the meantime, we have updated all Pipeline documentation to incorporate a Getting Started guide, a Guided Tour and a Syntax Reference page with numerous examples to help you get on your way. We have also created a Quick Reference card that can be printed and hung nearby. Simply upgrade to the latest version of the Pipeline plugin in Jenkins to enable all of these great features.
Jenkins is a powerful, open source automation tool with an impressive plugin architecture that helps development teams automate their software lifecycle. Jenkins is used to power many industry-leading companies’ software development pipelines.
Jenkins Pipeline offers:
- First-class feature for managing complex, multi-step pipelines
- A set of open source plugins and integrations
- Brings the power of Jenkins and the plugin ecosystem into a scriptable Domain Specific Language (DSL)
Best of all, like Jenkins core, Pipeline is extensible by third-party developers, supporting custom extensions to the Pipeline DSL and various options for plugin integration. Download the whitepaper here.
Stay up to date
We'll never share your email address and you can opt out at any time, we promise.