Jenkins Pipeline Syntax: Difference between revisions
Jump to navigation
Jump to search
Line 24: | Line 24: | ||
// ... | // ... | ||
} | } | ||
==Parallel Stages== | |||
<syntaxhighlight lang='groovy'> | |||
stage("tests") { | |||
parallel( | |||
"unit tests": { | |||
// run unit tests | |||
}, | |||
"coverage tests": { | |||
// run coverage tests | |||
} | |||
) | |||
} | |||
</syntaxhighlight> | |||
=Declarative Pipeline= | =Declarative Pipeline= |
Revision as of 18:52, 25 October 2019
External
Internal
Scripted Pipeline
node { echo 'Pipeline logic starts' stage('Build') { // ... } stage('Test') { // ... } stage('Deploy') { // ... }
Parallel Stages
stage("tests") {
parallel(
"unit tests": {
// run unit tests
},
"coverage tests": {
// run coverage tests
}
)
}
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' } } } }