in Jenkins by
Q:
What are Declarative Pipelines in Jenkins?

▼ Show 1 Answer

0 votes
by
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.
Jenkins
Learn More with Madanswer

Related questions

+1 vote
asked May 13, 2020 in Jenkins by Robindeniel
  • #declarative-pipeline
  • #jenkins-declarative-pipeline
0 votes
asked Jan 17, 2020 in Jenkins by GeorgeBell
...