Jenkins Pipeline Syntax: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 51: Line 51:
     }
     }
  }
  }
=Parallel Stages=
<syntaxhighlight lang='groovy'>
stage("tests") {
    parallel(
        "unit tests": {
            // run unit tests
        },
        "coverage tests": {
            // run coverage tests
        }
    )
}
</syntaxhighlight>


=Step Reference=
=Step Reference=


* [https://jenkins.io/doc/pipeline/steps/workflow-basic-steps/#stash-stash-some-files-to-be-used-later-in-the-build stash]
* [https://jenkins.io/doc/pipeline/steps/workflow-basic-steps/#stash-stash-some-files-to-be-used-later-in-the-build stash]

Revision as of 18:52, 25 October 2019

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