Jan 17, 2020 in Jenkins
Q: What are Declarative Pipelines in Jenkins?

1 Answer

0 votes
Jan 17, 2020
Declarative Pipelines are the newest additions to Jenkins that simplify the groovy syntax of Jenkins pipelines (top-level pipeline) with some exceptions, such as:

No semicolon to be used as a statement separator. The top-level pipeline should be enclosed within block viz;

The common syntax is:

pipeline {

/* Declarative Pipeline */

}

Blocks must contain Sections, Directives, steps or assignments.

pipeline {

                agent any

                stages {

stage(‘Build’) {

                steps {

// Statements…

                }

                }

       stage (‘Test’) {

       steps {

              // Statements…

       }

       }

    }

}

The above code has 3 major elements

Pipeline: The block of script contents.

Agent: Defines where the pipeline will start running from.

Stage: The pipelines contain several steps enclosed in the block called Stage.

Related questions

0 votes
Apr 29 in Jenkins
  • #pipeline-types
  • jenkins-pipelines
0 votes
Jan 17, 2020 in Jenkins
0 votes
May 1 in Jenkins
...