Categorygithub.com/kaizenci/kaizen
module
0.0.0-20250126123450-3dad8b8dff16
Repository: https://github.com/kaizenci/kaizen.git
Documentation: pkg.go.dev

# README

Kaizen CI

Kaizen is a Continuous Integration and Continuous Deployment (CI/CD) pipeline aiming to replicate GitHub Actions workflows. It allows you to run jobs defined in a configuration file within Docker containers triggered by GitHub pull requests.

Features

  • GitHub Integration: Registered as a GitHub App to access repositories, trigger on pull requests, and update statuses/checks.
  • Workflow Configuration: Uses a .kaizen-ci.yaml file in the root of the repository to define workflows.
  • Docker Executor: Executes jobs in Docker containers specified in the configuration.
  • Status Updates: Updates GitHub with the status of workflows and jobs.

Prerequisites

  • Go: Version 1.17 or higher.
  • Docker: Installed and running.
  • PostgreSQL: For storing outputs and job statuses.
  • GitHub App: You need to create a GitHub App with the necessary permissions.
  • Git: Installed on your machine.

Installation

Clone the Repository

Clone the Repository:

git clone https://github.com/glower/kaizen.git
cd kaizen

Build the Application:

make build

Set Up Environment Variables

Create a .env file or set the following environment variables:

  • KAIZEN_CONFIG: Path to the Kaizen configuration file.
  • GITHUB_WEBHOOK_SECRET: Your GitHub webhook secret.
  • GITHUB_CLIENT_ID: Your GitHub App client ID.
  • GITHUB_APP_ID: Your GitHub App ID.
  • Database configuration:
    • DB_HOST
    • DB_PORT
    • DB_DATABASE
    • DB_USERNAME
    • DB_PASSWORD

Example .env file:

KAIZEN_CONFIG=./config.yaml
GITHUB_WEBHOOK_SECRET=your_webhook_secret
GITHUB_CLIENT_ID=your_client_id
GITHUB_APP_ID=123456
DB_HOST=localhost
DB_PORT=5432
DB_DATABASE=kaizen_db
DB_USERNAME=admin
DB_PASSWORD=admin123

Set Up the Configuration File

Create a config.yaml file based on the example below:

server:
  host: "localhost"
  port: 8080
logger:
  level: debug
  format: text
  output_paths:
    - "stdout"
database:
  host: "localhost"
  port: 5432
  username: "admin"
  password: "admin123"
  database: "kaizen_db"
workflow:
  max_concurrency: 5
  executor: docker
  workspace:
    default_config_file: ".kaizen-ci.yaml"
    base_dir: "./workspaces/" # Use a relative path or environment variable
    default_timeout: "30m"
    cleanup:
      enabled: true
      max_age: "1m"

Set Up the Database

Ensure PostgreSQL is running and accessible with the provided credentials. Create the database if it doesn’t exist:

docker run --name my-postgres -e POSTGRES_PASSWORD=mysecretpassword -d -p 5432:5432 postgres
psql -U admin -h localhost -p 5432 -c "CREATE DATABASE kaizen_db;"
docker exec -it postgres-db psql -U admin -d kaizen_db

Add new DB migration file

go install -tags 'postgres' -v github.com/golang-migrate/migrate/v4/cmd/migrate@latest
migrate create -ext sql -dir db/migrations init_schema

Configuration

GitHub App Setup

  1. Create a GitHub App:
    • Go to GitHub settings and create a new GitHub App.
    • Set the Webhook URL to http://yourserver.com/webhook
    • Set the Webhook Secret to the GITHUB_WEBHOOK_SECRET value.
    • Assign necessary permissions:
    • Checks: Read & write
    • Pull requests: Read & write
    • Repository contents: Read-only
  2. Install the App:
    • Install the app on the repositories you want Kaizen to monitor.

Repository Configuration

Add a .kaizen-ci.yaml file to the root of your repository:

name: Test Workflow
jobs:
  build:
    runs-on: golang:1.17
    steps:
      - name: Build
        run: make build

Triggering Workflows

When you create or update a pull request in the connected repositories, Kaizen will:

  • Receive the webhook event.
  • Clone the repository.
  • Parse the .kaizen-ci.yaml file.
  • Execute the defined jobs and steps.
  • Update the status on GitHub.

⚠️ Project Status: In Development

This CI/CD pipeline project is currently under active development and is not yet production-ready.

  • Features may be incomplete: Some critical functionalities required for robust production use are still being implemented or refined.
  • Bugs and limitations: The project may contain unresolved issues and edge cases that could lead to unexpected behavior.
  • Lack of comprehensive testing: The system has not undergone extensive testing in diverse environments and scenarios.
  • Use at your own risk: While it can be explored for learning and experimental purposes, it is not recommended for production environments.

TODO

  • User Authentication and Authorization
  • Web-Based User Interface (UI)
  • Pipeline as Code Enhancements
  • Secret Management Integration
  • Artifact Repository Integration
  • Notification System
  • Metrics and Monitoring
  • Multi-Executor and Multi-Platform Support
  • Plugin/Extension Framework
  • Pipeline Scheduling and Trigger Enhancements

License

This project is licensed under the MIT License.

Installation

  1. Navigate to Developer Settings: https://github.com/settings/personal-access-tokens
  2. Generate a New Token
    1. Click “Generate new token” (or “Generate new token (classic)”).
    2. Provide a name for your token (e.g., Kaizen-CI App Automation).

# Packages

No description provided by the author
No description provided by the author