Jenkins

Installing Jenkins

docker pull jenkins/jenkins

# Persist Jenkins Data within the Docker Container
docker volume create jenkins-data

docker run --name jenkins-production \
           --detach \
           -p 50000:50000 \
           -p 8080:8080 \
           -v jenkins-data:/var/jenkins_home \
           jenkins/jenkins:2.164.2

Access Jenkins at http://localhost:8080/

Installing Plugins

  • Blueocean plugin

Manage Jenkins > Manage Plugins

Pipeline Script

Hello World Pipeline Script

pipeline {
    agent none
    environment {
        APPLICATION_NAME = 'hello-jenkins-pipeline'
    }

    stages {

        stage('build') {
            steps {
                echo "Hello World"
            }
        }

    }
}

Pipeline script to Build Another Jenkins Job

pipeline {
    agent none
    stages{
        stage('build'){
            steps {
                echo "Hello World"
                build 'project2-child'
            }
        }
    }
}