Jenkins Pipeline Syntax: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(→ws) |
||
Line 96: | Line 96: | ||
Allocate workspace. | Allocate workspace. | ||
====build==== | |||
{{External|https://jenkins.io/doc/pipeline/steps/pipeline-build-step/}} | |||
This is how a main pipeline launches in execution a subordinate pipeline. | |||
==Basic Steps== | ==Basic Steps== |
Revision as of 18:24, 21 November 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'
}
}
}
}
Pipeline Steps
node
Allocate node.
sh
Shell Script.
ws
Allocate workspace.
build
This is how a main pipeline launches in execution a subordinate pipeline.
Basic Steps
These basic steps are used invoking on stage.
. In a Jenkinsfile, and inside a stage, invoke on this.
or simply invoking directly, without qualifying.
dir
Change current directory.
echo
error
readFile
Read a file from the workspace.
def versionFile = readFile("${stage.WORKSPACE}/terraform/my-module/VERSION")