Contents

Day 11: Introduction to CI/CD

Content

Part 1: Introduction to DevOps

Part 2: Version Control Systems

Part 3: Continuous Integration and Continuous Deployment (CI/CD)

  • Day 11: Introduction to CI/CD
  • Day 12: Jenkins - Installation and configuration
  • Day 13: Jenkins - Creating and managing jobs
  • Day 14: Jenkins - Integrating with Git
  • Day 15: Jenkins - Pipelines and best practices

Part 4: Configuration Management

  • Day 16: Introduction to configuration management
  • Day 17: Ansible - Installation and configuration
  • Day 18: Ansible - Ad-hoc commands and playbooks
  • Day 19: Ansible - Roles and best practices
  • Day 20: Puppet and Chef - Overview and comparison

Part 5: Infrastructure as Code

  • Day 21: Introduction to Infrastructure as Code (IaC)
  • Day 22: Terraform - Installation and configuration
  • Day 23: Terraform - Writing and applying configuration files
  • Day 24: Terraform - Modules and best practices
  • Day 25: CloudFormation (AWS) - Overview and comparison

Part 6: Containerization

  • Day 26: Introduction to containerization
  • Day 27: Docker - Installation and configuration
  • Day 28: Docker - Building and managing images
  • Day 29: Docker - Running and managing containers
  • Day 30: Docker Compose and best practices

Part 7: Container Orchestration

  • Day 31: Introduction to container orchestration
  • Day 32: Kubernetes - Architecture and components
  • Day 33: Kubernetes - Deployments, services, and storage
  • Day 34: Kubernetes - ConfigMaps and secrets
  • Day 35: Kubernetes - Best practices and Helm

Part 8: Monitoring and Logging

  • Day 36: Introduction to monitoring and logging
  • Day 37: Prometheus - Installation and configuration
  • Day 38: Prometheus - Querying and alerting
  • Day 39: Grafana - Installation and configuration
  • Day 40: ELK Stack (Elasticsearch, Logstash, Kibana) - Overview and comparison

Part 9: Cloud Platforms

  • Day 41: Introduction to cloud platforms
  • Day 42: AWS - EC2, S3, and RDS
  • Day 43: AWS - IAM, VPC, and ELB
  • Day 44: Azure - Virtual Machines, Storage, and SQL Database
  • Day 45: Google Cloud Platform - Compute Engine, Storage, and Cloud SQL

Part 10: DevOps Security

  • Day 46: Introduction to DevOps security
  • Day 47: Security best practices for CI/CD pipelines
  • Day 48: Infrastructure and application security
  • Day 49: Container and Kubernetes security
  • Day 50: Cloud security and compliance

CI/CD is all about streamlining your software development process.

This is mostly discussed in Day 1 post.


Highlight

  • Continuous Integration (CI): Involves merging code changes from multiple developers into a shared repository (e.g., Git) as frequently as possible. Automated builds and tests are run on each integration to ensure that the merged code is free of errors and conflicts.
  • Continuous Deployment (CD): Involves automating the process of deploying the tested and verified code to production environments. This ensures that new features and bug fixes are delivered to users quickly and efficiently.

Benifits of CI/CD

  • Faster feedback: Automated tests and builds provide immediate feedback on code changes, allowing developers to identify and fix issues early in the development process.
  • Improved collaboration: CI/CD practices encourage frequent code integrations, which help reduce the risk of conflicts and improve collaboration among team members.
  • Higher code quality: Regularly running automated tests ensures that code quality is maintained and that new changes do not introduce regressions.
  • Faster delivery: By automating the deployment process, new features and bug fixes can be delivered to users more quickly and efficiently.

CI/CD Tools options

Jenkins

pipeline {
    agent any
    stages {
        stage('Checkout') {
            steps {
                git branch: 'main', url: 'https://github.com/username/repo.git'
            }
        }
        stage('Build') {
            steps {
                sh 'pip install poetry'
                sh 'poetry install'
            }
        }
        stage('Test') {
            steps {
                sh 'poetry run pytest'
            }
        }
        stage('Deliver') {
            steps {
                echo 'Codebase approved, deliver to production environment'
            }
        }
        stage('Deploy') {
            steps {
                echo 'Deploy changes to production'
                // Add your deployment steps here
            }
        }
    }
}

GitHub Actions

name: CI/CD
on: [push, pull_request]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v2
    - name: Set up Python
      uses: actions/setup-python@v2
      with:
        python-version: "3.8"
    - name: Build
      run: |
        pip install poetry
        poetry install        
    - name: Test
      run: |
        poetry run pytest        
    - name: Deliver
      run: |
        echo 'Codebase approved, deliver to production environment'        
    - name: Deploy
      run: |
        echo 'Deploy changes to production'
        # Add your deployment steps here        

CircleCI

Visual Config Editor
CircleCI has a Visual Config Editor which can help you visualize the pipeline.
version: 2.1
jobs:
  build:
    docker:
      - image: circleci/python:3.8
    steps:
      - checkout
      - run:
          name: Build
          command: |
            pip install poetry
            poetry install            
      - run:
          name: Test
          command: |
            poetry run pytest            
      - run:
          name: Deliver
          command: |
            echo 'Codebase approved, deliver to production environment'            
      - run:
          name: Deploy
          command: |
            echo 'Deploy changes to production'
            # Add your deployment steps here            
workflows:
  version: 2
  build-deploy:
    jobs:
      - build

Tavis CI

language: python
python:
  - "3.8"
install:
  - pip install poetry
  - poetry install
script:
  - poetry run pytest
after_success:
  - echo 'Codebase approved, deliver to production environment'
  - echo 'Deploy changes to production'
  # Add your deployment steps here

Few more resources one can read: