Categories

Jan 17 in Jenkins

Q: What are Declarative Pipelines in Jenkins?

1 Answer

Jan 17
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.
Click here to read more about Jenkins
Click here to read more about Insurance

Related questions

Madanswer
Jan 17 in Jenkins
May 13 in Jenkins
Jan 17 in Jenkins
...