Skip to content
/ rxdb Public
forked from pubkey/rxdb

A fast, local first, reactive Database for JavaScript Applications https://rxdb.info/

License

Notifications You must be signed in to change notification settings

Mmeckawy/rxdb

 
 

Repository files navigation

Pipeline Demo

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.

Table of Contents

  1. Pipeline in Action
  2. Failure Alert
  3. Test Cases
  4. Build History and Test Trends
  5. Rollback Scenario
  6. Run the Pipeline
  7. Blue/Green Deployment

1. Pipeline in Action

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.

webhooks

Inside the Jenkins server you should check the github hooks trigger in order to build automatically the piepline.

2. Failure Alert

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
                }
            }

3. Test Cases

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.

webhooks

4. Build History and Test Trends

webhooks

5. Rollback Scenario

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
            }
        }
    }
}

6. Run the Pipeline

To view and run the Jenkins pipeline, follow these steps:

  1. Open your web browser and navigate to http://172.174.215.207:8080.
  2. Log in using the following credentials for testing:
    • Username: tester
    • Password: pass@123
  3. Once logged in, you will have access to the Jenkins dashboard.
  4. Navigate to the rxdb-pipeline job
  5. You can now run the pipeline

7. Blue/Green Deployement

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.

webhooks

Netlify performs split testing between the 2 branches while simultaneously performing CD.

About

A fast, local first, reactive Database for JavaScript Applications https://rxdb.info/

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 93.5%
  • JavaScript 4.2%
  • CSS 1.8%
  • Dart 0.4%
  • HTML 0.1%
  • Shell 0.0%