1.2 Pipeline CI/CD — GitHub, Maven, Jenkins, Artifactory, SonarQube, Docker, Tomcat
3 min readMay 31, 2020
This is the continuation to the Previous Post 1.1 Pipeline CI/CD — GitHub, Maven, Jenkins, Artifactory, SonarQube, Docker, Tomcat
- Breaking the Code:
Link to the Jenkins File — Click
Jenkins Pipeline Style: Declarative Jenkins Pipeline
In the above Screenshot Fig.1
- Defined the maven and Artifactory methods globally in Jenkins File
- Set the tools name of Java and Maven location as mentioned in the Jenkins — Global Tool Configuration ( Refer Screenshot Fig.2) below.
- Included the options to have the timestamps and log rotation of the builds.
- Set the Environment of SonarQube scanner tool name as mentioned in the Jenkins — Global Tool Configuration ( Refer Screenshot Fig.2) above.
- In the Screenshot above Fig.3 explains the Artifactory, SonarQube Analysis, SonarQube Quality gate Stage.
Note: “ Quality Gate” stage is written in the Jenkins File to make the Jenkins build fail if the Sonar Quality Gate metrics is not met.
- “Deleting docker images and Containers” stage is written to make sure if any docker images and containers are running to be removed before the actual build happens.
Note: In screenshot Fig.4 the mentioned “delete_cont.sh” shell script is found here.
·- In the Screenshot above Fig.5 explains the below:
- Building the Docker Image
- Docker login to perform the pushing of the build image to the Dockerhub
- Running the Docker Container of tomcat to port 8050
Note: Dockerfile is found here.
- In the above Screenshot Fig.6, changed the RUN command to startup the tomcat server with the Port 8050 ( Default port is 8080)
- Defines one or more additional steps that are run upon the completion of a Pipeline’s or stage’s run
- Triggers the mail based up on the Success or Failure of the Build
- Please find the below screenshot of Success Job Post action sent to the mail. ( Refer below Fig.8)
Hope you have enjoyed the two section of stories 😊.