Skip to content

Killingrace/CiCd_Kubernetes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django To-Do List & CI/CD Kubernetes Pipeline

This project is a web-based To-Do list application built with Django, featuring basic capabilities like user accounts, authentication, an API, and an interactive UI (using Skeleton CSS and jQuery).

The primary focus of this repository is its robust CI/CD pipeline, showcasing automated testing, Dockerization, and deployment to Kubernetes using Helm and GitHub Actions.

CI/CD Pipeline Overview

The project features a comprehensive CI/CD workflow defined in GitHub Actions (.github/workflows/main.yml and reusable-deployment.yml). The pipeline is designed to ensure code quality, build container images, and deploy seamlessly to Kubernetes environments.

Key Pipeline Features

  1. Triggers & Concurrency Control

    • Automatically triggered on push and pull_request to the main branch.
    • Supports manual execution (workflow_dispatch) with input variables to select the target OS (ubuntu-latest, windows-latest) and Python version (3.8, 3.9) to deploy.
    • Concurrency is configured to cancel in-progress runs for the same pull request, ensuring only the latest code is tested.
  2. Branch Protection & Quality Gates

    • The main branch is protected, requiring mandatory pull requests.
    • The Python CI job acts as a mandatory status check, ensuring tests pass before any merge is allowed.
  3. Python CI (python-ci)

    • Uses a Matrix Strategy to run unit tests across multiple OS types (Ubuntu, Windows) and Python versions (3.8, 3.9).
    • Generates test coverage reports.
    • Performs code linting and complexity checks using flake8.
    • Uploads necessary artifacts (Python, Helm charts, and Kind cluster configurations) for subsequent jobs.
  4. Docker Build & Push (docker-ci)

    • Authenticates with DockerHub using repository secrets.
    • Builds a Docker container image for the Django application.
    • Pushes the built image to DockerHub.
  5. Helm Validation (helm-ci)

    • Runs helm lint and helm template to validate the Kubernetes manifests.
    • Packages the Helm chart for deployment.
  6. Deployments to Kubernetes (deploy-helm-dev & deploy-helm-stg)

    • Utilizes a reusable deployment workflow (reusable-deployment.yml) to dynamically spin up a Kubernetes Kind (Kubernetes IN Docker) cluster.
    • Development Environment: Automatically deploys the packaged Helm chart to the development environment.
    • Staging Environment: Requires Manual Approval before deploying to the staging environment using specific environment values (stg.yaml).
    • Injects necessary secrets (MySQL credentials, Django Secret Key, etc.) directly into the Helm release from GitHub Environment Secrets.

Local Development

If you want to run the application locally on your machine (requires Python 3.8+ due to Django 4 compatibility):

  1. Install dependencies:

    pip install -r requirements.txt
  2. Create the database schema:

    python manage.py migrate
  3. Start the development server (defaults to http://localhost:8000):

    python manage.py runserver

You can now browse the API or start on the landing page.

About

No description, website, or topics provided.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors