PIPELINE DIAGRAM
Continuous Integration (CI)
Pipeline Overview
- Agent: Runs in EC2 Jenkins agent
- Tools: Configures JDK 17 and Maven 3 for the build.
Environment Variables
- APP_NAME: Name of the application.
- RELEASE: Release version.
- DOCKER_USER: Docker Hub username.
- DOCKER_PASS: Docker Hub password.
- IMAGE_NAME: Docker image name.
- IMAGE_TAG: Docker image tag.
- JENKINS_API_TOKEN: Jenkins API token for secure operations.
Pipeline Stages
- Clean Workspace: Cleans the workspace before each build.
- Checkout: Checks out the source code from GitHub.
- Build Application: Builds the application with Maven.
- Test Application: Runs tests on the application.
- SonarQube Analysis: Performs static code analysis.
- Quality Gate: Checks SonarQube quality gate status.
- Build & Push Docker Image: Builds and pushes the Docker image.
- Trivy Scan: Scans the Docker image for vulnerabilities.
- Cleanup Artifacts: Removes Docker images from the local system.
- Trigger CD Pipeline: Triggers a Continuous Deployment pipeline.
Post Actions
- Success: Logs a success message.
- Failure: Logs a failure message.
- Always: Logs a completion message.
Github repo:- https://github.com/SNS-Srinivasu/CICD-registration-app-Project
Continuous Deployment (CD) Pipeline
Pipeline Stages
- Cleanup Workspace:
- Ensures a fresh environment by cleaning up previous workspace files and artifacts.
- Checkout from SCM:
- Retrieves the latest code from the GitHub repository using the main branch and specified credentials.
- Update the Deployment Tags:
- Updates the deployment.yaml file with the new application version or tag. The sed command is used to replace the old tag with the new one.
- Push the Changed Deployment File to Git:
- Configures Git with user details, commits the updated deployment.yaml file, and pushes the changes to the GitHub repository.