O'Reilly logo

Continuous Integration, Delivery, and Deployment by Sander Rossel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Declarative pipeline syntax

Declarative syntax, which is supported since version 2.5 of the Pipeline plugin, puts the focus on what you want rather than how you want it. It has a certain structure, which is required for the Blue Ocean pipeline editor. I think, I can best explain this with an example. Take the following declarative syntax script:

pipeline {  agent any  stages {    stage('Greet') {      steps {        echo env.greetings      }    }  }  environment {    greetings = 'Hello'  }}

Even though the environment node is below the stages node, the echo env.greetings line prints Hello. Obviously, the environment node was interpreted before the stages were executed. This is because we are describing what we want rather than how we want it. We want an environment variable ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required