1. Pipeline DSL¶
1.1. Jenkinsfile¶
Pipeline model definition
Add
Jenkinsfile
to the repository main folderBundled with Blue Ocean
declarative-linter
validate before running jobThe first line of a Jenkinsfile should be #!/usr/bin/env groovy
Automatically create Pipelines for all Branches and Pull Requests
Code review/iteration on the Pipeline
Audit trail for the Pipeline
Single source of truth for the Pipeline, which can be viewed and edited by multiple members of the project.
1.2. Documentation¶
1.3. Examples¶
1.3.1. Single Stage¶
pipeline {
agent any
stages {
stage('My Stage Name') {
steps {
sh '/bin/echo Working...'
}
}
}
}
1.3.2. Multi Stage¶
pipeline {
agent any
stages {
stage('Build') {
steps {
sh '/bin/echo Building...'
}
}
stage('Test') {
steps {
sh '/bin/echo Testing...'
}
}
stage('Deploy') {
steps {
sh '/bin/echo Deploying...'
}
}
}
}