Building a CI/CD Pipeline in Jenkins

Customer Profile

Our customer is an online higher education platform providing rigorous industry-relevant programs designed and delivered in collaboration with world-class faculty and industry. Merging the latest technology, pedagogy, and services, it is creating an immersive learning experience – anytime and anywhere.

Goal

During our discussion with customer Project Manager, we zeroed in for the following goals:

  1. Pace of deployment should match the pace of development
  2. Remove Manual Build and Deploy Process
  3. Implement efficient, continuous and automated deployment process
  4. Include Verification before Production Deployment

Solution

By using best practices of DevOps, we implemented a continuous integration and continuous deployment pipeline for our customer. We also converted customer’s infrastructure into code and setup end to end real time monitoring and notifications for their entire product, including software and infrastructure. We took the following steps to achieve our goals:

  1. Implement DevOps in Product Development Lifecycle
  2. Implemented Continuous Integration and Continuous Deployment (CI/CD) pipeline with Jenkins
  3. Integrated tests as part of CI/CD Pipeline to ensure that a code change is deployed only if all tests are passed
  4. Integrated Jenkins with Slack to send notifications to developers when tests fail, build fails, or build cannot be deployed
  5. Implemented Slack based notification so that developers are notified when tests are failing, or change can’t be built or deployed
  6. Created multiple lower/tests environments to ensure that every change go through an end to end life cycle before it is deployed to production.
  7. Created AWS Cloudwatch based alarms to send notification to Slack whenever any code or server error is encountered
  8. Converted entire application infrastructure as code with Terraform so that new environments can be created, and existing ones can be updated from command line.
  9. Used Jenkins Pipeline and converted Jenkins job to Groovy code thereby giving flexibility to have our Jenkins as a Code/Pipeline as a Code (JaaC/PaaC) as well.
  10. Created Bitbucket Organization in Jenkins to enable auto Continuous Integration of all target branches in Git. This ensures all jobs in Jenkins are created automatically.

Tech Stack

This solution used following tools, platforms and services:

  1. AWS – Public Cloud Platform. Following services are prominently used:
    • Elastic Compute Cloud (EC2): for hosting Jenkins
    • CloudWatch: For monitoring and alerting
    • Simple Notification Service – For sending notification on slack
    • Elastic Container Service: For application deployment
  2. Jenkins – Open source Continuous Integration tool, we used for creating CI/CD Pipeline.
  3. Terraform – Open source infrastructure as code software tool for creating an environment for application deployment.

Solution Architecture

Click to see large view

Results

Following are direct and major results of implementing DevOps pipeline automation:

  1. Exponential reduction in deployment time
  2. Entire commit to deployment cycle gets completed in less than 10 minutes
  3. Multiple (7 to 10) stable deployments on any given day
  4. Testing included in CI workflow to ensure the stability of each build
  5. Predictable deployments; if tests are failing, nothing gets deployed
  6. Slack integration notifies everybody for broken builds
  7. Improved developer’s productivity due to continuous integration and timely failure notifications
  8. Making changes in infrastructure become easy with the implementation of Infrastructure as a Code
  9. Getting insights on performance of application once deployed on AWS through implemented logging, monitoring and notifications