This README provides instructions for setting up and running a CI/CD pipeline demo. The demo showcases the entire lifecycle of a code change, from committing the code to deployment, and includes monitoring, alerting, good and bad check-ins, build history, test trends, and rollback scenarios.
- Pipeline in Action
- Failure Alert
- Test Cases
- Build History and Test Trends
- Rollback Scenario
- Run the Pipeline
- Blue/Green Deployment
First off, we need to do CI by checking if there are any new commits, push, or pull requests on github. Jenkins does this step by getting triggered by a webhook created inside the github repositry. The webhook is connected to the jenkins server as shown below.
Inside the Jenkins server you should check the github hooks trigger in order to build automatically the piepline.
Using email alerting mechanism the developer gets notified once the build fails
post {
success {
// Send email notification for build failure
emailext subject: "Build Succeeded: ${currentBuild.fullDisplayName}",
body: "The build was finished successfully.",
to: "mariam.meckawy@hotmail.com",
attachLog: true
}
failure {
// Send email notification for build failure
emailext subject: "Build failed: ${currentBuild.fullDisplayName}",
body: "The build has failed. Please check the Jenkins console output for more details.",
to: "mariam.meckawy@hotmail.com",
attachLog: true
}
}
In the figure below, build #21 was a bad check-in as it had bad azure credentials, after this error was fixed build #22 ran automatically a good check-in.
By adding the following script to the pipeline, the failed build is aborted, and the pipeline is triggered to use the last successful build.
post {
always {
// Trigger the pipeline again after rollback
script {
// Trigger the pipeline again if the build failed
if (currentBuild.result == 'FAILURE') {
currentBuild.result = 'ABORTED' // Abort the current build to trigger a new one
}
}
}
}
To view and run the Jenkins pipeline, follow these steps:
- Open your web browser and navigate to http://172.174.215.207:8080.
- Log in using the following credentials for testing:
- Username: tester
- Password: pass@123
- Once logged in, you will have access to the Jenkins dashboard.
- Navigate to the rxdb-pipeline job
- You can now run the pipeline
Netlify is a proxy used for deployment, load balancing and continuous deployment. The blue/green deployment methodolgy was applied by treating the master branch as the green part of the method and created a branch for the blue part. Then, you should specify those 2 branches at the Site configuration --> Split testing, as shown in the figure below.
Netlify performs split testing between the 2 branches while simultaneously performing CD.