diff --git a/.changeset/align-otel-collector-tag.md b/.changeset/align-otel-collector-tag.md new file mode 100644 index 0000000..6509c78 --- /dev/null +++ b/.changeset/align-otel-collector-tag.md @@ -0,0 +1,5 @@ +--- +"helm-charts": patch +--- + +fix: align otel-collector image tag with chart appVersion diff --git a/.github/workflows/helm-test.yaml b/.github/workflows/helm-test.yaml index c848801..eb7b1c9 100644 --- a/.github/workflows/helm-test.yaml +++ b/.github/workflows/helm-test.yaml @@ -37,6 +37,32 @@ jobs: helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts helm dependency build charts/clickstack + - name: Validate appVersion matches collector image tag + run: | + set -euo pipefail + APP_VERSION=$(awk '$1 == "appVersion:" { print $2 }' charts/clickstack/Chart.yaml) + COLLECTOR_TAG=$(awk ' + $1 == "repository:" && $2 == "docker.clickhouse.com/clickhouse/clickstack-otel-collector" { in_image = 1; next } + in_image && $1 == "tag:" { + gsub(/"/, "", $2) + print $2 + exit + } + ' charts/clickstack/values.yaml) + + if [ -z "$APP_VERSION" ] || [ -z "$COLLECTOR_TAG" ]; then + echo "Could not read appVersion or otel-collector image tag" + exit 1 + fi + + if [ "$APP_VERSION" != "$COLLECTOR_TAG" ]; then + echo "appVersion ($APP_VERSION) does not match otel-collector.image.tag ($COLLECTOR_TAG)" + exit 1 + fi + + EXPECTED_COLLECTOR_IMAGE="image: \"docker.clickhouse.com/clickhouse/clickstack-otel-collector:${APP_VERSION}\"" + helm template clickstack-version-check charts/clickstack | grep -F "$EXPECTED_COLLECTOR_IMAGE" + - name: Validate example values render run: | helm template clickstack-example charts/clickstack \ diff --git a/.github/workflows/update-app-version.yml b/.github/workflows/update-app-version.yml index f93994f..927f782 100644 --- a/.github/workflows/update-app-version.yml +++ b/.github/workflows/update-app-version.yml @@ -22,8 +22,50 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} - name: Update appVersion in Chart.yaml + env: + TAG: ${{ github.event.inputs.tag }} run: | - sed -i "s/^appVersion: .*/appVersion: ${{ github.event.inputs.tag }}/" charts/clickstack/Chart.yaml + set -euo pipefail + tmp=$(mktemp) + awk -v tag="$TAG" ' + /^appVersion:/ { $0 = "appVersion: " tag; updated = 1 } + { print } + END { exit updated ? 0 : 1 } + ' charts/clickstack/Chart.yaml > "$tmp" + mv "$tmp" charts/clickstack/Chart.yaml + + - name: Update otel-collector image tag in values.yaml + env: + TAG: ${{ github.event.inputs.tag }} + run: | + set -euo pipefail + tmp=$(mktemp) + awk -v tag="$TAG" ' + /repository: docker\.clickhouse\.com\/clickhouse\/clickstack-otel-collector[[:space:]]*$/ { + in_collector_image = 1 + print + next + } + in_collector_image && /^[[:space:]]{0,2}[[:alnum:]_-]+:/ { + in_collector_image = 0 + } + in_collector_image && /^[[:space:]]*tag:/ { + sub(/tag: .*/, "tag: \"" tag "\"") + updated = 1 + in_collector_image = 0 + } + { print } + END { exit updated ? 0 : 1 } + ' charts/clickstack/values.yaml > "$tmp" + mv "$tmp" charts/clickstack/values.yaml + awk -v tag="$TAG" ' + /repository: docker\.clickhouse\.com\/clickhouse\/clickstack-otel-collector/ { in_image = 1; next } + in_image && /^[[:space:]]*tag:/ { + if ($0 ~ "tag: \"" tag "\"") found = 1 + in_image = 0 + } + END { exit found ? 0 : 1 } + ' charts/clickstack/values.yaml - name: Create changeset run: | @@ -43,8 +85,9 @@ jobs: commit-message: "chore: Update appVersion to ${{ github.event.inputs.tag }}" title: "Update appVersion to ${{ github.event.inputs.tag }}" body: | - This PR updates the appVersion in Chart.yaml to `${{ github.event.inputs.tag }}`. + This PR updates the appVersion in Chart.yaml to `${{ github.event.inputs.tag }}` and aligns the otel-collector image tag in values.yaml. - Updated `charts/clickstack/Chart.yaml` + - Updated `otel-collector.image.tag` in `charts/clickstack/values.yaml` branch: update-app-version-${{ github.event.inputs.tag }} delete-branch: true diff --git a/AGENTS.md b/AGENTS.md index 707a139..a452035 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -153,7 +153,7 @@ tests: | Helm Chart Tests | `helm-test.yaml` | push/PR to main | Unit tests + example validation | | Integration Test | `chart-test.yml` | push/PR/nightly | Kind-based integration suites | | Release | `release.yml` | after tests pass on main | Changeset version + chart release | -| Update App Version | `update-app-version.yml` | workflow_dispatch | Bump `appVersion` in Chart.yaml | +| Update App Version | `update-app-version.yml` | workflow_dispatch | Bump `appVersion` in Chart.yaml and align `otel-collector.image.tag` in values.yaml | ## Key File Locations @@ -163,5 +163,5 @@ tests: - Unit tests: `charts/clickstack/tests/*_test.yaml` - Integration suites: `integration-tests/*/` - Example values: `examples/*/values.yaml` -- Version sync script: `scripts/update-chart-versions.js` +- Chart version sync script: `scripts/update-chart-versions.js` - Smoke test: `scripts/smoke-test.sh` diff --git a/charts/clickstack/values.yaml b/charts/clickstack/values.yaml index 4b68915..edd375c 100644 --- a/charts/clickstack/values.yaml +++ b/charts/clickstack/values.yaml @@ -371,7 +371,7 @@ otel-collector: mode: deployment image: repository: docker.clickhouse.com/clickhouse/clickstack-otel-collector - tag: "2.19.0" + tag: "2.28.0" extraEnvsFrom: - configMapRef: name: clickstack-config @@ -412,4 +412,3 @@ otel-collector: enabled: false zipkin: enabled: false -