Blaze-cicd
Blaze CI/CD is a Command Line Interface (CLI) tool designed to automate the creation of production-ready CI/CD pipelines.
Overview
Blaze CI/CD is a Command Line Interface (CLI) tool designed to automate the creation of production-ready CI/CD pipelines. The tool integrates with Kubernetes, Docker, DockerHub, GitHub, GitHub Actions, and ArgoCD to provide a seamless setup experience. Users provide essential details such as project name, API keys, and application configurations, and the tool handles the creation of namespaces, repositories, and CI/CD pipelines.
Installation
You can install the Blaze CI/CD CLI tool using pip:
pip install blaze-cicd
Architecture Diagram
Below is a high-level architecture diagram of blaze CI/CD:
Key Features
- Automated Pipeline Creation: Automates the setup of CI/CD pipelines using Kubernetes (
kubectl), Docker, GitHub, and ArgoCD. - YAML Configuration: Users provide project and application details via a YAML configuration file that will be used to construct the entire CI/CD pipeline with a single command.
- Multi-Service Integration: Integrates with DockerHub, GitHub, and ArgoCD to create repositories, projects, and applications. Can handle pipelines for multiple services.
- CLI Interface: Simple command-line interface with
initandbuildcommands. - Minimal Setup: Other than configuring
kubectl, Python, installing the package, and providing API keys, there are no additional steps other than filling out theconfig.yaml. - Graceful Degradation: Blaze CI/CD ensures robust pipeline creation by verifying the existence of resources at each step. If a resource (e.g., repository, project, or application) already exists, Blaze skips its creation to avoid redundancy. If a resource is missing, it creates it automatically.
In case of failure, Blaze stops the process and provides detailed error messages, enabling users to troubleshoot and resolve issues efficiently. This step-by-step approach ensures that subsequent operations rely on successful completion of the previous steps, maintaining the integrity of the CI/CD pipeline while empowering users with actionable insights.
Targeted Stack
- Kubernetes: For container orchestration and namespace management.
- Docker: For containerization of applications.
- DockerHub: For Docker image storage and management.
- GitHub: For source code management and version control.
- GitHub Actions: For CI/CD workflows.
- ArgoCD: For GitOps-based continuous delivery.
Prerequisites
Before using blaze CI/CD, ensure the following prerequisites are met:
-
Kubernetes Cluster:
- A running Kubernetes cluster with
kubectlconfigured on the machine you plan to run this CLI tool from. - Ensure you have the necessary permissions to create namespaces and manage resources in the cluster.
- A running Kubernetes cluster with
-
DockerHub Account:
- A DockerHub account with an API key for creating and managing Docker repositories, with write/read access.
-
GitHub Account:
- A GitHub account with an API key for creating repositories and managing GitHub Actions workflows.
- A GitHub private key for integrating with ArgoCD config repositories.
-
ArgoCD:
- An ArgoCD instance with an API key account for creating projects and applications.
- Ensure the ArgoCD URL is accessible from the machine where you plan to run the tool from.
-
Python:
- Python 3.7 or higher installed on your machine.
- Required Python libraries:
argparse,yaml,subprocess, andrequests.
-
blaze CI/CD Installation:
- Install the blaze CI/CD CLI tool using pip:
pip install blaze-cicd
- Install the blaze CI/CD CLI tool using pip:
User Input
The user also creates a YAML file with the following format:
project:
name: "your-project-name"
namespace: "your-namespace"
argocd:
apiKey: "%ARGOCD_API_KEY%"
url: "%ARGOCD_URL%"
dockerHub:
username: "your-docker-registery-username"
apiKey: "%DOCKER_HUB_API_KEY%"
github:
apiKey: "%GITHUB_API_KEY%"
privateKey: "%GITHUB_SSH_PRIVATE_KEY%"
apps:
- name: "your-app-name"
templates:
source:
name: "source-code-github-template-name"
owner: "source-code-github-owner-name"
argocd:
name: "source-code-github-template-name"
owner: "source-code-github-owner-name"
docker:
private: true # true -> private repo, false -> public repo
name: "your-docker-image-name"
github:
private: true
name: "your-github-repo-name"
owner: "your-github-repo-owner-name"
argocd:
project:
name: "your-argocd-project-name"
description: "Your ArgoCD project description"
app:
name: "your-argocd-app-name"
path: "path/to/manifests"
clusterUrl: "https://kubernetes.default.svc"
namespace: "your-namespace"
repo:
connectionType: "ssh"
name: "your-repo-name"
projectName: "your-project-name"
githubRepoUrl: "git@github.com:your-org/your-repo.git"
sshPrivateKeyData: "%GITHUB_SSH_PRIVATE_KEY%"
You must set enviroment variables in config.yaml with %ENV_VARIABLE%, also in your OS: windows
$env:ARGOCD_API_KEY = "your-argocd-api-key"
$env:ARGOCD_URL = "https://argocd.example.com"
$env:DOCKER_HUB_API_KEY = "your-docker-registery-apikey"
$env:GITHUB_API_KEY = "your-github-developer-apikey"
$env:GITHUB_SSH_PRIVATE_KEY = "your-ssh-key"
note on windows you need to set multi-line ssh key as follow
$sshKey = (Get-Content -Path "C:\Users\User\.ssh\id_rsa" -Raw) -replace "`r`n", "\n"
$env:GITHUB_SSH_PRIVATE_KEY = $sshKey
linux
export ARGOCD_API_KEY="your-argocd-api-key"
export ARGOCD_URL="https://argocd.example.com"
export DOCKER_HUB_API_KEY="your-docker-registery-apikey"
export GITHUB_API_KEY="your-github-developer-apikey"
export GITHUB_SSH_PRIVATE_KEY="your-ssh-key"
export ARGOCD_SSH_PRIVATE_KEY="your-github-account-ssh-key-to-pull-private-repos"
You should also create dkr registery secret in your k8s cluster :
kubectl -n blazecicd create secret docker-registry dkr-registry --docker-server=docker.io --docker-username="" --docker-password="" --docker-email=""
Workflow
- Initialization: The user runs the
initcommand to generate a YAML template which the user will fill with the needed information. - Setup needed API keys in GitHub, ArgoCD, DockerHub.
- Kubernetes Cluster with configured kubectl on machine.
- Configuration: The user fills in the YAML file with project and application details.
- Build: The user runs the
buildcommand to create the CI/CD pipeline.
Important note: your tempalte repo should not have any github workflow in it, or should be triggered when you push to prod branch, this allow for no accidental resource creation.
CLI Commands
init Command
- Purpose: Generates a YAML template for the user to fill in.
- Usage:
blaze init --file blaze-config.yaml - Output: Creates a
blaze-config.yamlfile with the predefined template.
build Command
- Purpose: Reads the YAML configuration and creates the CI/CD pipeline.
- Usage:
blaze build --file blaze-config.yaml - Output:
- Creates a Kubernetes namespace using current context configured to kubectl.
- Creates DockerHub repositories.
- Creates GitHub repositories.
- Configures repositories in ArgoCD.
- Creates an ArgoCD project.
- Creates ArgoCD applications.
DEMO
DEMO cleanup checklist :
if you followed the demo, you might want to clean up the resources in the dev cluster
- [] remove created repos by blaze-cicd : 1. blazecicd-client, 2. blazecicd-client-argocd.
- [] remove argocd resources application, project, repo.
- [] remove dockerhub repository blazecicd-client
- [] remove namespace from cluster.
Metadata
Release files for blaze-cicd 1.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| blaze_cicd-1.0.8.tar.gz | 12.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| blaze_cicd-1.0.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.3 kB
Release files / blaze_cicd-1.0.8.tar.gz
| Download URL | blaze_cicd-1.0.8.tar.gz |
|---|---|
| Size | 12.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7c76e1404d191b10be4393863cf75e1f27979da4ae7d5e01982010c5e042597d
|
|
BLAKE2b-256 checksum How to use checksums |
aca21f32d1c41b955ced8fc4ee98c41bebcf6b78050883c765f73e4c1696051b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.21
|
Release files / blaze_cicd-1.0.8-py3-none-any.whl
| Download URL | blaze_cicd-1.0.8-py3-none-any.whl |
|---|---|
| Size | 12.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1a7222aac7a15a28ec1fda12da020e37ef311f68b9ba57bd7589c66762008e9f
|
|
BLAKE2b-256 checksum How to use checksums |
0bc64ee6f1bb74ca828898b73e90402aa3feea5680b832004e8fd7f8b4ad9947
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.21
|
Security for blaze-cicd 1.0.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.