-
Notifications
You must be signed in to change notification settings - Fork 248
Getting Started
Pipelines are a series of steps that allow you to orchestrate the work required to build, test and deploy applications. Pipelines are defined in a file called Jenkinsfile
that is stored in the root of your project’s source repository.
pipeline {
agent { docker 'maven:3.3.3' }
stages {
stage('build') {
steps {
sh 'mvn --version'
sh 'mvn install'
}
}
}
}
pipeline {
agent { docker 'node:6.3' }
stages {
stage('build') {
steps {
sh 'npm --version'
sh 'npm install'
sh 'npm test'
}
}
}
}
pipeline {
agent { docker 'ruby:2.1' }
stages {
stage('build') {
steps {
sh 'ruby --version'
sh 'bundle install'
}
}
}
}
pipeline {
agent { docker 'python:3.5.1' }
stages {
stage('build') {
steps {
sh 'pip --version'
sh 'python --version'
}
}
}
}
To get started quickly with Pipeline (assuming you have already downloaded and installed Jenkins):
-
Copy one of the examples 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 set up your Pipeline, Jenkins will automatically detect any new Branches or Pull Requests that are created in your repository and start running Pipelines for them.
Documentation
- Getting Started
- Running multiple steps
- Controlling your build environment
- Environment variables
- Reporting test results and storing artifacts
- Notifications
- Deployment and credentials
- Parallelism
- Triggering runs
- Parametrized pipelines
- Pipeline options and log rotation
- Jenkinsfile validation from the CLI
- Advanced pipeline authoring
- Syntax reference
- Version history and changes
Examples