Setting up Continuous Integration on Jenkins 2

Installing Jenkins 2

Standard

Install JDK 8 on your machine.

Go to the official site https://jenkins.io/2.0/

Download the jenkins.war

With Docker

Launch the Docker image (the default port has been changed to 18080):

docker container run -d --name jenkins2 -p 18080:8080 -p 50000:50000 jenkinsci/jenkins

Create a new Job

  • Add New Item
    • Enter an item name
    • Select pipeline
    • Click OK

Jenkins2 item

  • Definition: Pipeline script from SCM
  • SCM: Git
  • Repositories
    • Repository URL: select your repository here

Jenkins2 pipeline

Jenkinsfile

An example of Jenkinsfile which is generated can be found here

Jenkins2 result