/* Requires the Docker Pipeline plugin */
pipeline {
agent { docker { image 'maven:3.9.9-eclipse-temurin-21-alpine' } }
stages {
stage('build') {
steps {
sh 'mvn --version'
}
}
}
}
Jenkins Pipeline (or simply "Pipeline") is a suite of plugins which supports implementing and integrating continuous delivery pipelines into Jenkins.
A continuous delivery pipeline is an automated expression of your process for getting software from version control right through to your users and customers.
Jenkins Pipeline provides an extensible set of tools for modeling
simple-to-complex delivery pipelines "as code". The definition of a Jenkins
Pipeline is typically written into a text file (called a Jenkinsfile
) which in
turn is checked into a project’s source control repository.
[1]
For more information about Pipeline and what a Jenkinsfile
is, refer to the
respective Pipeline and
Using a Jenkinsfile sections of the User
Handbook.
To get started quickly with Pipeline:
Install the Docker Pipeline plugin through the Manage Jenkins > Plugins page
After installing the plugin, restart Jenkins so that the plugin is ready to use
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.
/* Requires the Docker Pipeline plugin */
pipeline {
agent { docker { image 'maven:3.9.9-eclipse-temurin-21-alpine' } }
stages {
stage('build') {
steps {
sh 'mvn --version'
}
}
}
}
/* Requires the Docker Pipeline plugin */
pipeline {
agent { docker { image 'node:22.12.0-alpine3.20' } }
stages {
stage('build') {
steps {
sh 'node --version'
}
}
}
}
/* Requires the Docker Pipeline plugin */
pipeline {
agent { docker { image 'ruby:3.3.6-alpine3.20' } }
stages {
stage('build') {
steps {
sh 'ruby --version'
}
}
}
}
/* Requires the Docker Pipeline plugin */
pipeline {
agent { docker { image 'python:3.13.0-alpine3.20' } }
stages {
stage('build') {
steps {
sh 'python --version'
}
}
}
}
/* Requires the Docker Pipeline plugin */
pipeline {
agent { docker { image 'php:8.4.1-alpine3.20' } }
stages {
stage('build') {
steps {
sh 'php --version'
}
}
}
}
See more detailed instructions on Getting Started with Pipeline
Review other Pipeline tutorials
Please submit your feedback about this page through this quick form.
Alternatively, if you don't wish to complete the quick form, you can simply indicate if you found this page helpful?
See existing feedback here.