Skip to content

Commit 8e07def

Browse files
committed
feat: add release badges to chart README templates
- Add version and chart name badges to all chart README.md.gotmpl files - Fix shields.io URL encoding for chart names with dashes - Badges show actual chart version from Chart.yaml - Include documentation guidance about README.md generation
1 parent fbac047 commit 8e07def

6 files changed

Lines changed: 57 additions & 8 deletions

File tree

CONTRIBUTING.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,34 @@ Just two tools needed:
3838
2. Create the required files:
3939
- `Chart.yaml` - Chart metadata
4040
- `values.yaml` - Default configuration values
41-
- `README.md` - Chart documentation
41+
- `README.md.gotmpl` - Chart documentation template (NOT README.md!)
4242
- `templates/` - Kubernetes manifest templates
4343

4444
3. Follow the [chart structure requirements](#chart-structure-requirements)
4545

46+
## Documentation (IMPORTANT)
47+
48+
**DO NOT EDIT `README.md` FILES DIRECTLY!**
49+
50+
All chart README.md files are automatically generated from `README.md.gotmpl` templates:
51+
52+
- Edit `charts/<chart>/README.md.gotmpl` instead of `README.md`
53+
- The `docs.yaml` workflow automatically generates README.md from the template
54+
- Any manual edits to README.md will be overwritten on the next push
55+
56+
To update documentation:
57+
1. Modify the appropriate `.gotmpl` file
58+
2. Run `helm-docs` locally to preview: `helm-docs --chart-search-root=charts`
59+
3. Commit both the template changes and generated README.md
60+
61+
### Adding Documentation to Templates
62+
63+
When editing `README.md.gotmpl`:
64+
- Use Helm template functions: `{{ template "chart.version" . }}`
65+
- Include installation examples with OCI registry
66+
- Add configuration tables with default values
67+
- The template will be processed with chart metadata automatically
68+
4669
## Chart Structure Requirements
4770

4871
Each chart must include:
@@ -51,7 +74,8 @@ Each chart must include:
5174
charts/<chart-name>/
5275
├── Chart.yaml # Required: Chart metadata
5376
├── values.yaml # Required: Default values
54-
├── README.md # Required: Documentation
77+
├── README.md # Generated: Documentation (DO NOT EDIT)
78+
├── README.md.gotmpl # Required: Documentation template
5579
├── templates/ # Required: Template files
5680
│ ├── _helpers.tpl # Template helpers
5781
│ ├── NOTES.txt # Post-install notes
@@ -134,6 +158,16 @@ When making changes:
134158
- Unit tests using helm-unittest
135159
- Integration tests with chart-testing
136160

161+
### Documentation Enforcement
162+
163+
**Important**: The repository has automated safeguards for documentation:
164+
165+
1. **Pre-commit hooks**: Run `helm-docs` automatically to ensure README.md matches templates
166+
2. **CI/CD workflow**: The `docs.yaml` workflow will overwrite any manual README.md changes
167+
3. **PR comments**: If documentation is out of date, the CI will add a warning comment to the PR
168+
169+
**Rule**: Always edit `README.md.gotmpl`, never `README.md` directly!
170+
137171
### Running Tests Locally
138172

139173
```bash

charts/wik-backup/README.md.gotmpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{{ template "chart.header" . }}
22

3+
![Version: {{ template "chart.version" . }}](https://img.shields.io/badge/Version-{{ template "chart.version" . }}-informational?style=flat-square)
4+
![Chart](https://img.shields.io/badge/Chart-wik--backup-blue?style=flat-square)
5+
36
{{ template "chart.description" . }}
47

58
## Installation

charts/wik-cronjob/README.md.gotmpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{{ template "chart.header" . }}
22

3+
![Version: {{ template "chart.version" . }}](https://img.shields.io/badge/Version-{{ template "chart.version" . }}-informational?style=flat-square)
4+
![Chart](https://img.shields.io/badge/Chart-wik--cronjob-blue?style=flat-square)
5+
36
## Introduction
47

58
This charts aims to simplify the deployment of a cronjob.

charts/wik-node-local-dns/README.md.gotmpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{{ template "chart.header" . }}
22

3+
![Version: {{ template "chart.version" . }}](https://img.shields.io/badge/Version-{{ template "chart.version" . }}-informational?style=flat-square)
4+
![Chart](https://img.shields.io/badge/Chart-wik--node--local--dns-blue?style=flat-square)
5+
36
{{ template "chart.description" . }}
47

58
## Introduction

charts/wik-rbac/README.md.gotmpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{{ template "chart.header" . }}
22

3+
![Version: {{ template "chart.version" . }}](https://img.shields.io/badge/Version-{{ template "chart.version" . }}-informational?style=flat-square)
4+
![Chart](https://img.shields.io/badge/Chart-wik--rbac-blue?style=flat-square)
5+
36
{{ template "chart.description" . }}
47

58
## Introduction

charts/wik-webservice/README.md.gotmpl

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{{ template "chart.header" . }}
22

3+
![Version: {{ template "chart.version" . }}](https://img.shields.io/badge/Version-{{ template "chart.version" . }}-informational?style=flat-square)
4+
![Chart](https://img.shields.io/badge/Chart-wik--webservice-blue?style=flat-square)
5+
36
## Introduction
47

58
This chart simplifies the deployment of a webservice on Kubernetes.
@@ -163,26 +166,26 @@ webservice:
163166
image: myapp:latest
164167
hosts:
165168
- app.example.com
166-
169+
167170
# Define persistent storage
168171
storage:
169172
data:
170173
size: 10Gi
171174
storageClass: standard
172-
175+
173176
# Mount volumes
174177
volumes:
175178
# Mount PVC
176179
- name: data
177180
mountPath: /app/data
178181
storage: true
179-
182+
180183
# Mount ConfigMap
181184
- name: config
182185
mountPath: /app/config
183186
configMap:
184187
name: app-config
185-
188+
186189
# Mount Secret file
187190
- name: credentials
188191
mountPath: /app/credentials.json
@@ -210,13 +213,13 @@ webservice:
210213
image: myapp:latest
211214
hosts:
212215
- app.example.com
213-
216+
214217
initContainers:
215218
- name: init-db
216219
container:
217220
image: busybox
218221
command: ["sh", "-c", "echo waiting for db..."]
219-
222+
220223
additionalContainers:
221224
- name: log-shipper
222225
container:

0 commit comments

Comments
 (0)