Jenkins Pipeline Syntax

From NovaOrdis Knowledge Base
Jump to navigation Jump to search

External

Internal


Scripted Pipeline

node {

    echo 'Pipeline logic starts'

    stage('Build') {
       // ...
    }
    stage('Test') {
       // ...
    }
    stage('Deploy') {
       // ...
    }

Declarative Pipeline

pipeline { 
    agent any 
    options {
        skipStagesAfterUnstable()
    }
    stages {
        stage('Build') { 
            steps { 
                sh 'make' 
            }
        }
        stage('Test'){
            steps {
                sh 'make check'
                junit 'reports/**/*.xml' 
            }
        }
        stage('Deploy') {
            steps {
                sh 'make publish'
            }
        }
    }
}

Step Reference