Real Time CI CD Pipeline Project - java based - { Spring Petclinic }
This Project will help you learn how to implement continuous integration and continuous deployment using declarative pipeline and deploy using Docker Container & Tomcat Server.
Tools Configuration : after Installing the above plugin - In the manage Jenkins.
Jdk - Version - 17
SonarQube - latest Version
Maven - Version - 3.6.0
Dependency-Check - Version - 6.5.1
docker - latest Version
All Steps :
Step1 : On the Dashboard-> Select New Item -> enter the name of the project -> Select the Pipeline -> then ok
Step 2 - Write a description of the Project -> Click on the GitHub Project and the paste git repo link over there
Step 3 - Build Trigger -> Click on the GitHub Hook Trigger polling . GitHub Hook Trigger polling- Which is use for the , when we/anybody can changes the Done on the GitHub , Which will reflect on the pipeline it will trigger.
Step 4 - Create the Declarative Pipeline using Groovy Syntax
Using this Script we can run our pipeline-
Explanation of the script -
These are all the stages are agent of the pipeline. in these stages,
We need to set up the environment and mention the tools which we are using these in the pipeline .
Stage 1: Git Checkout : it is used for cloning the repository
Stage 2 : Code Compile : it is used for compiling the Code
stage 3 : Unit Test : It is sued for the testing the code
stage 4 : SonarQube analysis : We are using for ,
It provides extensive reporting capabilities to help teams identify and remediate code defects, vulnerabilities, and code smells & inspection of code quality .
stage 5 : OWASP Dependency : identifies project dependencies and checks if there are any known, publicly disclosed vulnerabilities.
Stage 6 : Build Artifact : The build artifacts we use for making the files, libraries, or packages executables & preparing it for deployment.
stage 7 : Docker Build - These stage is use for Building the code for making the Docker Image. using these Docker Image we can Deploy these code on the docker Container and after deploying it will accessible on the browser.
Stage 8 : Push to Docker Hub - Using these stage , after Building the code , we can push the image on the docker hub , for pushing the image, we need to login on the docker , and tagging the image and push on the docker hub, for all of these task we use these stage. Also need to add credentials on the manage Jenkins -> global tool configuration using adding the credentials .
Stage 9 : Deploy Container - These stage is use for the deploying the container , using the Docker image, which is we build in the previous stages
stage 10 : These stage is use for the deploy the file , using the Tomcat server. After installing the tomcat, we need to set the port and then and then run these command on the pipeline .
If you are getting error which is mentioned below while deploying on the tomcat