① An  environment  directive used in the top-level  pipeline  block will apply to all steps within the Pipeline. ② An  environment  directive defined within a  stage  will only apply the given environment variables to steps within the  stage . Parameters Declarative Pipeline supports parameters out-of-the-box, allowing the Pipeline to accept user- specified parameters at runtime via the parameters directive. Configuring parameters with Scripted Pipeline is done with the  properties  step, which can be found in the Snippet Generator. If you configured your pipeline to accept parameters using the  Build with Parameters  option, those parameters are accessible as members of the  params  variable. Assuming that a String parameter named "Greeting" has been configuring in the  Jenkinsfile , it can access that parameter via  ${params.Greeting} : Declarative Pipeline supports robust failure handling by default via its post section which allows declaring a number of different "post conditions" such as:  always ,  unstable ,  success ,  failure , and changed . The Pipeline Syntax section provides more detail on how to use the various post conditions. Handling Failures // Declarative // pipeline { agent any parameters { string(name: 'Greeting', defaultValue: 'Hello', description: 'How should I greet the world?') } stages { stage('Example') { steps { echo "${params.Greeting} World!" } } } } // Script // properties([parameters([string(defaultValue: 'Hello', description: 'How should I greet the world?', name: 'Greeting')])]) node { echo "${params.Greeting} World!" } 37