Files
k_deploy_workflows/README.md
T
t.behrendt 4e1d3c0090
Release / Release (push) Successful in 12s
feat: add namespace override (#57)
Reviewed-on: #57
Co-authored-by: Timo Behrendt <t.behrendt@t00n.de>
Co-committed-by: Timo Behrendt <t.behrendt@t00n.de>
2026-05-26 20:47:53 +02:00

85 lines
3.4 KiB
Markdown

# Reusable CI/CD Workflows for k\_ Services
This repository contains reusable CI and CD workflows that automatically detect Kubernetes service type (Kubernetes-only vs Helm + Kubernetes) and execute the relevant steps.
## Features
- **Reusable CI and CD**: Separate reusable workflows for validation and deployment
- **Automatic Detection**: Detects whether `helmfile.yaml` exists and whether `k8s/` exists
- **Conditional Execution**: Runs Helm steps only when applicable
- **Flexible Inputs**: Supports custom `k8s_dir` and `helmfile_path`
## Usage
### Basic CI Usage
Call the reusable CI workflow:
```yaml
jobs:
ci:
uses: https://gitea.t000-n.de/t.behrendt/k_deploy_workflows/.gitea/workflows/ci.yaml@main
secrets: inherit
```
### Basic CD Usage
Call the reusable CD workflow:
```yaml
jobs:
deploy:
uses: https://gitea.t000-n.de/t.behrendt/k_deploy_workflows/.gitea/workflows/cd.yaml@main
secrets: inherit
```
### Advanced Usage with Custom Paths and Flags
```yaml
jobs:
ci:
uses: https://gitea.t000-n.de/t.behrendt/k_deploy_workflows/.gitea/workflows/ci.yaml@main
with:
k8s_dir: "kubernetes/"
helmfile_path: "helm/helmfile.yaml"
skip_helm_validation: true
secrets: inherit
```
## Inputs
### CI (`.gitea/workflows/ci.yaml`)
| Parameter | Description | Default | Required |
| ---------------------- | --------------------------------------------------------------- | --------------- | -------- |
| `k8s_dir` | Path to Kubernetes manifests directory | `k8s/` | No |
| `helmfile_path` | Path to helmfile.yaml | `helmfile.yaml` | No |
| `skip_helm_validation` | Skip Helm validation even if helmfile exists | `false` | No |
| `helmfile_env` | JSON object string passed as env to helmfile | `{}` | No |
| `namespace` | Override the default namespace (extracted from repository name) | `""` | No |
### CD (`.gitea/workflows/cd.yaml`)
| Parameter | Description | Default | Required |
| -------------------------------- | --------------------------------------------------------------- | --------------- | -------- |
| `k8s_dir` | Path to Kubernetes manifests directory | `k8s/` | No |
| `helmfile_path` | Path to helmfile.yaml | `helmfile.yaml` | No |
| `skip_helm_deployment` | Skip Helm deployment even if helmfile exists | `false` | No |
| `skip_shared_secrets_deployment` | Skip shared secrets deployment | `false` | No |
| `helmfile_env` | JSON object string passed as env to helmfile | `{}` | No |
| `namespace` | Override the default namespace (extracted from repository name) | `""` | No |
## Directory Structure Requirements
### Full example structure (Helm + Kubernetes):
```
your-service/
├── k8s/
│ ├── deployment.yaml
│ ├── service.yaml
│ └── ...
├── helmfile.yaml
└── .gitea/workflows/your-workflow.yaml
```