-
Notifications
You must be signed in to change notification settings - Fork 40
Automatically update Chart.yaml version for release
#320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,3 +51,6 @@ Thumbs.db | |
| .env.staging | ||
| .env.production | ||
|
|
||
| # Generated Helm chart manifest | ||
| charts/agentregistry/Chart.yaml | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ The fastest way to run the full stack locally is with [Kind](https://kind.sigs.k | |
| - [Docker](https://docs.docker.com/get-docker/) | ||
| - [kubectl](https://kubernetes.io/docs/tasks/tools/) | ||
| - [Helm](https://helm.sh/docs/intro/install/) | ||
| - [envsubst](https://www.gnu.org/software/gettext/manual/html_node/envsubst-Invocation.html) (used to generate `Chart.yaml`) | ||
|
|
||
| > `kind` is installed automatically into `./bin/kind` by `make install-tools` — no manual installation needed. | ||
|
|
||
|
|
@@ -36,6 +37,8 @@ make install-agentregistry | |
| make install-agentregistry BUILD=false | ||
| ``` | ||
|
|
||
| `install-agentregistry` automatically runs `charts-generate` first (see [Helm Chart Generation](#helm-chart-generation) below), so `Chart.yaml` is always up to date before deploying. | ||
|
|
||
| On subsequent runs, `install-agentregistry` reuses the `jwtPrivateKey` already stored in the cluster secret so tokens remain valid across redeploys. | ||
|
|
||
| ### Accessing the services | ||
|
|
@@ -60,6 +63,41 @@ See [`scripts/kind/README.md`](scripts/kind/README.md) for more detail on config | |
|
|
||
| --- | ||
|
|
||
| ## Helm Chart Generation | ||
|
|
||
| `charts/agentregistry/Chart.yaml` is **generated** from `charts/agentregistry/Chart-template.yaml` using `envsubst` and is not committed to the repository. Any `helm` command run directly against the chart directory will fail unless `Chart.yaml` exists. | ||
|
|
||
| ### Generating Chart.yaml locally | ||
|
|
||
| ```bash | ||
| # Generate with version derived from the latest git tag (e.g. 0.3.0) | ||
| make charts-generate | ||
|
|
||
| # Generate with an explicit version | ||
| make charts-generate CHART_VERSION=0.4.0 | ||
| ``` | ||
|
|
||
| `CHART_VERSION` defaults to the output of `git describe --tags --abbrev=0` with the leading `v` stripped. If there are no tags, set it explicitly. | ||
|
|
||
| Any Makefile target that needs `Chart.yaml` (e.g. `charts-lint`, `charts-test`, `charts-package`, `install-agentregistry`) declares `charts-generate` as a prerequisite and will generate it automatically. You only need to run `make charts-generate` directly if you're invoking `helm` commands by hand. | ||
|
Comment on lines
+72
to
+82
|
||
|
|
||
| ### Adding Chart.yaml to your editor's ignore hints | ||
|
|
||
| Because `charts/agentregistry/Chart.yaml` is gitignored, some editors may flag it as untracked. This is expected — treat `Chart-template.yaml` as the source of truth and do not commit the generated `Chart.yaml`. | ||
|
|
||
| ### Helm release pipeline | ||
|
|
||
| The full release pipeline is encapsulated in a single target: | ||
|
|
||
| ```bash | ||
| # Requires HELM_REGISTRY_PASSWORD to be set; optionally HELM_REGISTRY_USERNAME | ||
| make charts-release CHART_VERSION=0.4.0 | ||
| ``` | ||
|
|
||
| This runs in order: `charts-test` → `charts-push` (lint → package → push) → `charts-checksum`. | ||
|
|
||
| --- | ||
|
|
||
| ## Local Docker Compose Environment | ||
|
|
||
| ```bash | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -35,12 +35,12 @@ LOCALARCH ?= $(shell uname -m | sed 's/x86_64/amd64/' | sed 's/aarch64/arm64/') | |||||||||
| ## Helm / Chart settings | ||||||||||
| # Override HELM if your helm binary lives elsewhere (e.g. HELM=/usr/local/bin/helm). | ||||||||||
| HELM ?= helm | ||||||||||
| # CHART_VERSION strips the leading 'v' from VERSION for use in Chart.yaml (Helm requires semver without the prefix). | ||||||||||
| CHART_VERSION ?= $(shell echo $(VERSION) | sed 's/^v//') | ||||||||||
| HELM_CHART_DIR ?= ./charts/agentregistry | ||||||||||
| HELM_PACKAGE_DIR ?= build/charts | ||||||||||
| HELM_REGISTRY ?= ghcr.io | ||||||||||
| HELM_REPO ?= agentregistry-dev/agentregistry | ||||||||||
| # HELM_PUSH_MODE: oci (default, recommended) | repo (legacy chart repo / ChartMuseum) | ||||||||||
| HELM_PUSH_MODE ?= oci | ||||||||||
| HELM_PLUGIN_UNITTEST_URL ?= https://github.com/helm-unittest/helm-unittest | ||||||||||
| # Pin the helm-unittest plugin version for reproducibility and allow install flags | ||||||||||
| HELM_PLUGIN_UNITTEST_VERSION ?= v1.0.3 | ||||||||||
|
|
@@ -309,7 +309,7 @@ install-postgresql: ## Deploy standalone PostgreSQL/pgvector into the Kind clust | |||||||||
| BUILD ?= true | ||||||||||
|
|
||||||||||
| .PHONY: install-agentregistry | ||||||||||
| install-agentregistry: ## Build images and Helm install AgentRegistry into the Kind cluster (BUILD=false to skip image builds) | ||||||||||
| install-agentregistry: charts-generate ## Build images and Helm install AgentRegistry into the Kind cluster (BUILD=false to skip image builds) | ||||||||||
| ifeq ($(BUILD),true) | ||||||||||
| install-agentregistry: docker-server docker-agentgateway | ||||||||||
| endif | ||||||||||
|
|
@@ -412,15 +412,23 @@ _helm-check: | |||||||||
| exit 1; \ | ||||||||||
| fi | ||||||||||
|
|
||||||||||
| # Generate Chart.yaml from Chart-template.yaml using envsubst. | ||||||||||
| .PHONY: charts-generate | ||||||||||
| charts-generate: ## Generate Chart.yaml from Chart-template.yaml (uses CHART_VERSION, default derived from git tags) | ||||||||||
| @echo "Generating $(HELM_CHART_DIR)/Chart.yaml (version=$(CHART_VERSION))..." | ||||||||||
| CHART_VERSION=$(CHART_VERSION) envsubst '$$CHART_VERSION' \ | ||||||||||
| < $(HELM_CHART_DIR)/Chart-template.yaml \ | ||||||||||
| > $(HELM_CHART_DIR)/Chart.yaml | ||||||||||
|
Comment on lines
+415
to
+421
|
||||||||||
|
|
||||||||||
| # Build chart dependencies (resolves Chart.yaml dependencies → charts/ subdir). | ||||||||||
| .PHONY: charts-deps | ||||||||||
| charts-deps: _helm-check ## Build Helm chart dependencies | ||||||||||
| charts-deps: charts-generate _helm-check ## Build Helm chart dependencies | ||||||||||
| @echo "Building Helm chart dependencies for $(HELM_CHART_DIR)..." | ||||||||||
| $(HELM) dependency build $(HELM_CHART_DIR) | ||||||||||
|
|
||||||||||
| # Lint chart with --strict so warnings are treated as errors. | ||||||||||
| .PHONY: charts-lint | ||||||||||
| charts-lint: charts-deps ## Lint the Helm chart with --strict | ||||||||||
| charts-lint: charts-generate charts-deps ## Lint the Helm chart with --strict | ||||||||||
| @echo "Linting Helm chart $(HELM_CHART_DIR)..." | ||||||||||
| $(HELM) lint $(HELM_CHART_DIR) --strict | ||||||||||
|
|
||||||||||
|
|
@@ -437,47 +445,40 @@ charts-render-test: charts-deps ## Render chart templates as a smoke test | |||||||||
|
|
||||||||||
| # Package the chart into $(HELM_PACKAGE_DIR)/. | ||||||||||
| .PHONY: charts-package | ||||||||||
| charts-package: charts-lint ## Package the Helm chart into $(HELM_PACKAGE_DIR) | ||||||||||
| charts-package: charts-generate charts-lint ## Package the Helm chart into $(HELM_PACKAGE_DIR) | ||||||||||
| @mkdir -p $(HELM_PACKAGE_DIR) | ||||||||||
| @echo "Packaging chart $(HELM_CHART_DIR) → $(HELM_PACKAGE_DIR)/" | ||||||||||
| $(HELM) package $(HELM_CHART_DIR) -d $(HELM_PACKAGE_DIR) | ||||||||||
| @echo "Packaged chart(s):" | ||||||||||
| @ls -1 $(HELM_PACKAGE_DIR)/*.tgz | ||||||||||
|
|
||||||||||
| # Push packaged chart(s) to an OCI registry. | ||||||||||
| # Credentials are read from the environment at runtime (never stored in the Makefile): | ||||||||||
| # HELM_REGISTRY_USERNAME – registry username (default: your shell $USER) | ||||||||||
| # HELM_REGISTRY_PASSWORD – registry password / token (required) | ||||||||||
| # Package the chart and push to an OCI registry. Caller must be logged in. | ||||||||||
| # Override registry/repo: make charts-push HELM_REGISTRY=ghcr.io HELM_REPO=org/repo | ||||||||||
| .PHONY: charts-push | ||||||||||
| charts-push: charts-package ## Push packaged charts to the configured registry | ||||||||||
| @echo "Pushing chart(s) to $(HELM_REGISTRY)/$(HELM_REPO)/charts (mode: $(HELM_PUSH_MODE))" | ||||||||||
| ifeq ($(HELM_PUSH_MODE),oci) | ||||||||||
| @if [ -z "$$HELM_REGISTRY_PASSWORD" ]; then \ | ||||||||||
| echo "ERROR: HELM_REGISTRY_PASSWORD is not set. Export it before running this target."; \ | ||||||||||
| exit 1; \ | ||||||||||
| fi | ||||||||||
| @printf "%s" "$$HELM_REGISTRY_PASSWORD" | $(HELM) registry login $(HELM_REGISTRY) \ | ||||||||||
| --username "$${HELM_REGISTRY_USERNAME:-$$USER}" \ | ||||||||||
| --password-stdin | ||||||||||
| @for pkg in $(HELM_PACKAGE_DIR)/*.tgz; do \ | ||||||||||
| [ -f "$$pkg" ] || continue; \ | ||||||||||
| echo " Pushing $$pkg → oci://$(HELM_REGISTRY)/$(HELM_REPO)/charts"; \ | ||||||||||
| $(HELM) push "$$pkg" "oci://$(HELM_REGISTRY)/$(HELM_REPO)/charts"; \ | ||||||||||
| done | ||||||||||
| @$(HELM) registry logout $(HELM_REGISTRY) || true | ||||||||||
| else | ||||||||||
| @echo "Non-OCI push (mode=$(HELM_PUSH_MODE)) — implement repo-specific push logic or use chart-releaser." | ||||||||||
| @exit 1 | ||||||||||
| endif | ||||||||||
| charts-push: charts-package _helm-check ## Package and push chart to the configured OCI registry | ||||||||||
| @echo "Pushing $(HELM_PACKAGE_DIR)/agentregistry-$(CHART_VERSION).tgz → oci://$(HELM_REGISTRY)/$(HELM_REPO)/charts" | ||||||||||
| $(HELM) push "$(HELM_PACKAGE_DIR)/agentregistry-$(CHART_VERSION).tgz" "oci://$(HELM_REGISTRY)/$(HELM_REPO)/charts" | ||||||||||
|
|
||||||||||
| # Generate SHA-256 checksums for all packaged chart files. | ||||||||||
| .PHONY: charts-checksum | ||||||||||
| charts-checksum: ## Generate SHA-256 checksum for the packaged chart in $(HELM_PACKAGE_DIR) | ||||||||||
| sha256sum "$(HELM_PACKAGE_DIR)/agentregistry-$(CHART_VERSION).tgz" > "$(HELM_PACKAGE_DIR)/checksums.txt" | ||||||||||
| @echo "--- checksum ---" | ||||||||||
| @cat $(HELM_PACKAGE_DIR)/checksums.txt | ||||||||||
|
|
||||||||||
| # Full Helm release pipeline: test → push (→ lint → package → generate + deps) → checksum. | ||||||||||
| # Required env vars for the push step: HELM_REGISTRY_PASSWORD (and optionally HELM_REGISTRY_USERNAME). | ||||||||||
| # Override version: make charts-release CHART_VERSION=1.2.3 | ||||||||||
|
Comment on lines
+470
to
+471
|
||||||||||
| # Required env vars for the push step: HELM_REGISTRY_PASSWORD (and optionally HELM_REGISTRY_USERNAME). | |
| # Override version: make charts-release CHART_VERSION=1.2.3 | |
| # Caller must be logged in to the Helm OCI registry before running charts-push/charts-release. | |
| # For example: HELM_REGISTRY_USERNAME=... HELM_REGISTRY_PASSWORD=... helm registry login $(HELM_REGISTRY) |
Copilot
AI
Mar 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
charts-release: charts-test charts-push charts-checksum is described as an ordered pipeline, but Make does not guarantee prerequisite execution order under parallel builds (make -j), and charts-checksum does not depend on charts-package/charts-push to ensure the .tgz exists. To make this robust, enforce sequencing in the charts-release recipe (invoke sub-targets in order) or add explicit dependencies (e.g. charts-checksum: charts-package) and/or mark the target(s) .NOTPARALLEL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The release workflow now runs
make charts-release, which requiresenvsubst(gettext) to generateChart.yaml. There’s no step ensuringenvsubstis installed on the runner, so this job can fail depending on the base image. Add an explicit install step (e.g. install gettext/gettext-base) or adjust chart generation to avoid this external dependency in CI.