Skip to content

Commit 5cbc680

Browse files
authored
Merge pull request #554 from cnvergence/fix-helm-versioning
fix the helm versioning of kube-bind backend Helm chart
2 parents 9aa7dc8 + 1ca08a7 commit 5cbc680

6 files changed

Lines changed: 19 additions & 17 deletions

File tree

.github/workflows/image.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,11 @@ jobs:
5555
echo "org.opencontainers.image.version=${{ github.ref_name }}"
5656
echo 'EOF'
5757
} >> "$GITHUB_ENV"
58-
# Helm chart version: semver from tag, otherwise 0.0.0-<sha>
58+
# App version: full tag (e.g. v0.8.1) for releases, otherwise 0.0.0-<sha>
5959
if [[ "${{ github.ref_type }}" == "tag" ]]; then
60-
chart_version="${{ github.ref_name }}"
61-
echo "CHART_VERSION=${chart_version#v}" >> "$GITHUB_ENV"
60+
echo "APP_VERSION=${{ github.ref_name }}" >> "$GITHUB_ENV"
6261
else
63-
echo "CHART_VERSION=0.0.0-${{ github.sha }}" >> "$GITHUB_ENV"
62+
echo "APP_VERSION=0.0.0-${{ github.sha }}" >> "$GITHUB_ENV"
6463
fi
6564
6665
- name: Login to GitHub Container Registry

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,11 +420,12 @@ build-web:
420420
# Image / release configuration.
421421
# IMAGE_TAGS is the space-separated list of tag suffixes applied to each component image.
422422
# IMAGE_PUSH_PLATFORMS is the platform list for `image-push` (multi-arch by default).
423-
# CHART_VERSION is the helm chart version; defaults to 0.0.0-$REV.
423+
# APP_VERSION is the application version passed to helm-build.sh; defaults to 0.0.0-$REV.
424+
# helm-build.sh strips the leading "v" to derive a valid Helm chart semver.
424425
# IMAGE_METADATA_DIR holds buildx metadata files used by `image-sign`.
425426
export IMAGE_TAGS ?= $(REV)
426427
IMAGE_PUSH_PLATFORMS ?= linux/amd64,linux/arm64
427-
export CHART_VERSION ?= 0.0.0-$(REV)
428+
export APP_VERSION ?= 0.0.0-$(REV)
428429
IMAGE_METADATA_DIR ?= $(BUILD_DIR)/image-metadata
429430

430431
# Example: make IMAGE_REPO=ghcr.io/<username> image-local

cli/pkg/kubectl/dev/plugin/create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ type DevOptions struct {
7070
}
7171

7272
// fallbackAssetVersion is used when unable to fetch the latest version
73-
const fallbackAssetVersion = "0.7.1"
73+
const fallbackAssetVersion = "0.8.1"
7474

7575
// gitHubRelease represents a GitHub release response
7676
type gitHubRelease struct {

deploy/charts/backend/Chart.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 0.1.0
18+
# NOTE: updated by helm-build.sh during the build — do not edit manually.
19+
version: 0.0.0
1920

2021
# This is the version number of the application being deployed. This version number should be
2122
# incremented each time you make changes to the application. Versions are not expected to
2223
# follow Semantic Versioning. They should reflect the version the application is using.
2324
# It is recommended to use it with quotes.
24-
appVersion: "v0.7.1"
25+
# NOTE: updated by helm-build.sh during the build — do not edit manually.
26+
appVersion: "0.0.0"

deploy/charts/backend/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
A Helm chart for kube-bind backend deployment
44

5-
![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.7.1](https://img.shields.io/badge/AppVersion-v0.7.1-informational?style=flat-square)
5+
![Version: 0.0.0](https://img.shields.io/badge/Version-0.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.0.0](https://img.shields.io/badge/AppVersion-0.0.0-informational?style=flat-square)
66

77
## Installation
88

hack/helm-build.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616

1717
set -eu
1818

19-
# Inputs (env vars):
20-
# REV short git sha (required if CHART_VERSION is unset)
21-
# CHART_VERSION chart version string; default: 0.0.0-$REV
19+
APP_VERSION="${APP_VERSION:-0.0.0-${REV:-}}"
20+
if [[ -z "$APP_VERSION" || "$APP_VERSION" == "0.0.0-" ]]; then
21+
echo "ERROR: APP_VERSION or REV must be set" >&2; exit 1
22+
fi
23+
CHART_VERSION="${APP_VERSION#v}"
2224

23-
: "${CHART_VERSION:=0.0.0-${REV:?REV must be set when CHART_VERSION is unset}}"
24-
25-
echo "Building Helm charts (version: $CHART_VERSION)..."
25+
echo "Building Helm charts (appVersion: $APP_VERSION, chartVersion: $CHART_VERSION)..."
2626

2727
HELM="$(UGET_PRINT_PATH=absolute make --no-print-directory install-helm)"
2828

@@ -33,7 +33,7 @@ for chart_dir in deploy/charts/*/; do
3333

3434
cp "${chart_dir}Chart.yaml" "${chart_dir}Chart.yaml.bak"
3535
sed -i.tmp "s/^version:.*/version: $CHART_VERSION/" "${chart_dir}Chart.yaml"
36-
sed -i.tmp "s/^appVersion:.*/appVersion: $CHART_VERSION/" "${chart_dir}Chart.yaml"
36+
sed -i.tmp "s/^appVersion:.*/appVersion: \"$APP_VERSION\"/" "${chart_dir}Chart.yaml"
3737
rm -f "${chart_dir}Chart.yaml.tmp"
3838

3939
"$HELM" package "$chart_dir" --version "$CHART_VERSION" --destination ./bin/

0 commit comments

Comments
 (0)