pipeline {
agent { docker 'maven:3.3.3' }
stages {
stage('build') {
steps {
sh 'mvn --version'
}
}
}
}
To get started quickly with Pipeline:
Copy one of the examples below into your repository and name it Jenkinsfile
Click the New Item menu within Jenkins
Provide a name for your new item (e.g. My Pipeline) and select Multibranch Pipeline
Click the Add Source button, choose the type of repository you want to use and fill in the details.
Click the Save button and watch your first Pipeline run!
You may need to modify one of the example Jenkinsfile
's to make it run with your project. Try modifying the sh
command to run the same command you would run on your local machine.
After you have setup your Pipeline, Jenkins will automatically detect any new Branches or Pull Requests that are created in your repository and start running Pipelines for them.
Below are some easily copied and pasted examples of a simple Pipeline with various languages.
pipeline {
agent { docker 'maven:3.3.3' }
stages {
stage('build') {
steps {
sh 'mvn --version'
}
}
}
}
pipeline {
agent { docker 'node:6.3' }
stages {
stage('build') {
steps {
sh 'npm --version'
}
}
}
}
pipeline {
agent { docker 'ruby' }
stages {
stage('build') {
steps {
sh 'ruby --version'
}
}
}
}
pipeline {
agent { docker 'python:3.5.1' }
stages {
stage('build') {
steps {
sh 'python --version'
}
}
}
}