Jenkins
pipeline generators and documentation can be found at ${YOUR_JENKINS_URL}/pipeline-syntax.
Run Jenkins stage only if specific dir changes:
stages {
stage('Nginx') {
when { changeset "nginx/*"}
steps {
sh "make build-nginx"
sh "make start-nginx"
}
}
}
Resources:
-
run with specific Docker image:
pipeline { agent { docker { image 'golang' } } stages { stage('build') { steps { sh 'go version' } } } } -
checkout git repository:
pipeline { agent any stages { stage('hello') { checkout scm steps { sh 'echo hello' } } stage('welcome') { steps { echo 'welcome' } } } }
Jenkinsfile examples: