Skip to content

Getting Started

Andrew Bayer edited this page Jan 10, 2017 · 4 revisions

What is a Pipeline?

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.

Quick Start

Java

pipeline {
  agent { docker 'maven:3.3.3' }
  stages {
    stage('build') {
      steps {
        sh 'mvn --version'
        sh 'mvn install'
      }
    }
  }
}

Node.js / JavaScript

pipeline {
  agent { docker 'node:6.3' }
  stages {
    stage('build') {
      steps {
        sh 'npm --version'
        sh 'npm install'
        sh 'npm test'
      }
    }
  }
}

Ruby

pipeline {
  agent { docker 'ruby:2.1' }
  stages {
    stage('build') {
      steps {
        sh 'ruby --version'
        sh 'bundle install'
      }
    }
  }
}

Python

pipeline {
  agent { docker 'python:3.5.1' }
  stages {
    stage('build') {
      steps {
        sh 'pip --version'
        sh 'python --version'
      }
    }
  }
}

PHP

pipeline {
  agent { docker 'php' }
  stages {
    stage('build') {
      steps {
        sh 'php --version'    
      }
    }
  }
}

Create your first Pipeline

To get started quickly with Pipeline (assuming you have already downloaded and installed Jenkins):

  1. Copy one of the examples into your repository and name it Jenkinsfile

  2. Click the New Item menu within Jenkins

  3. Provide a name for your new item (e.g., My Pipeline) and select Multibranch Pipeline

  4. Click the Add Source button, choose the type of repository you want to use, and fill in the details

  5. 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.