DevOps Classroom notes 17/Mar/2026

CI/CD Pipeline

  • Any CI/CD pipeline is all about
    • when to run
    • where to run
    • what to run

Github Actions Components

  • Workflow
  • Jobs
  • Steps
  • Runner
  • Events

Events

  • Event is something which can trigger the workflow

Workflow

  • This is our pipeline
  • Workflow at a highlevel is collection of jobs

Jobs

  • Job is collection of steps running on a runner (single machine)

Steps/Actions

  • An individual step or command

Runner

  • This is where the job executes

Example 1:

  • Consider the following to be your Continuous Delivery Pipeline

  • Sample yaml
name: CI-CD Pipeline

on:
  push:
    branches:
      - main

env:
  IMAGE_NAME: ghcr.io/${{ github.repository }}/app
  IMAGE_TAG: ${{ github.sha }}

jobs:

  build-and-push:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Login to GHCR
        run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

      - name: Build Docker Image
        run: |
          docker build -t $IMAGE_NAME:$IMAGE_TAG .

      - name: Push Docker Image
        run: |
          docker push $IMAGE_NAME:$IMAGE_TAG

  deploy-system-test:
    runs-on: ubuntu-latest
    needs: build-and-push

    steps:
      - name: Checkout repo
        uses: actions/checkout@v4

      - name: Setup kubectl
        uses: azure/setup-kubectl@v4

      - name: Configure kubeconfig
        run: |
          echo "${{ secrets.SYSTEM_TEST_KUBECONFIG }}" > kubeconfig
          export KUBECONFIG=$PWD/kubeconfig

      - name: Deploy to System Test
        run: |
          kubectl set image deployment/myapp myapp=$IMAGE_NAME:$IMAGE_TAG -n system-test
          kubectl rollout status deployment/myapp -n system-test

  deploy-uat:
    runs-on: ubuntu-latest
    needs: deploy-system-test

    steps:
      - name: Checkout repo
        uses: actions/checkout@v4

      - name: Setup kubectl
        uses: azure/setup-kubectl@v4

      - name: Configure kubeconfig
        run: |
          echo "${{ secrets.UAT_KUBECONFIG }}" > kubeconfig
          export KUBECONFIG=$PWD/kubeconfig

      - name: Deploy to UAT
        run: |
          kubectl set image deployment/myapp myapp=$IMAGE_NAME:$IMAGE_TAG -n uat
          kubectl rollout status deployment/myapp -n uat
Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a comment

Turn on JavaScript to leave a comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Social Media Icons Powered by Acurax Web Design Company
Exit mobile version
%%footer%%