- Clone
git clone https://github.com/kashyap92/devops-exercise.git
cd devops-exercise
- Build Jenkins image
docker build -t myjenkins:latest .
--> this will download and install all required plugins and amdin page is skipped. chmod 666 /var/run/docker.sock
- Run Jenkin image
docker run --rm -p 8080:8080 -p 50000:50000 -v jenkins_home:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock myjenkins:latest
- Create 2 pipeline jobs; upstream jobs can be any name but downstream job should be 'devops-exercise-downstream-job'
- For the upstream job, use 'Jenkinsfile-upstream'.
- For the 'devops-exercise-downstream-job' job use 'Jenkinsfile-downstream'.
- For shared library, use 'Jenkinsfile-sharedlib' job, the shared libraries are located in a separate repo(standard/recommended configuration) in https://github.com/kashyap92/jenkins-shared-library.git
#!groovy
@Library('maven-build-library') _
mavenPipeline(branch: 'master', url: 'https://github.com/kashyap92/devops-exercise.git')