Set chart appVersion with 'helm package' on release

Use the '--app-version' parameter to 'helm package' to dynamically
set the chart 'appVersion' field. We can then omit the hardcoded
'appVersion' field in the Chart.yaml file.

The chart 'version' field is also set by 'helm package' but we still
need to define it in the Chart.yaml file since 'help dep update'
requires it. The placeholder 'version' field is now set to 0.0.0 just
to give it some value.

For E2E, since the version fields are no longer hardcoded, it now
simulates a release by running 'helm package' and extracting the tar
files to HELM_REPO_LOCATION, now set to ./helm_repo.

Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
This commit is contained in:
Tom Pantelis
2022-11-14 14:10:26 +01:00
committed by Stephen Kitt
parent ce27971323
commit 5179a1de02
6 changed files with 21 additions and 10 deletions
+3
View File
@@ -53,6 +53,9 @@ jobs:
- name: Set up helm/chart-testing - name: Set up helm/chart-testing
uses: helm/chart-testing-action@afea100a513515fbd68b0e72a7bb0ae34cb62aec uses: helm/chart-testing-action@afea100a513515fbd68b0e72a7bb0ae34cb62aec
- name: Set up local helm repo
run: make local-helm-repo
- name: Run helm/chart-testing (lint) - name: Run helm/chart-testing (lint)
run: ct lint --config ct.yaml run: ct lint --config ct.yaml
+1
View File
@@ -4,3 +4,4 @@
*.tgz *.tgz
Makefile.dapper Makefile.dapper
Dockerfile.* Dockerfile.*
helm_repo
+13 -4
View File
@@ -1,6 +1,6 @@
BASE_BRANCH ?= devel BASE_BRANCH ?= devel
export BASE_BRANCH export BASE_BRANCH
export HELM_REPO_LOCATION=. export HELM_REPO_LOCATION=./helm_repo
ifneq (,$(DAPPER_HOST_ARCH)) ifneq (,$(DAPPER_HOST_ARCH))
@@ -25,11 +25,20 @@ export SUBCTL_VERSION
# Targets to make # Targets to make
e2e: E2E_ARGS=cluster1 cluster2 CHART_PACKAGES := submariner-k8s-broker-$(CHARTS_VERSION).tgz submariner-operator-$(CHARTS_VERSION).tgz
local-helm-repo: $(CHART_PACKAGES)
mkdir -p $(HELM_REPO_LOCATION)
for archive in $^; do \
tar xzf $$archive -C $(HELM_REPO_LOCATION); \
done
e2e: local-helm-repo
$(SCRIPTS_DIR)/e2e.sh
%.tgz: %.tgz:
helm dep update $(subst -$(CHARTS_VERSION),,$(basename $(@F))) helm dep update $(subst -$(CHARTS_VERSION),,$(basename $(@F)))
helm package --version $(CHARTS_VERSION) $(subst -$(CHARTS_VERSION),,$(basename $(@F))) helm package --version $(CHARTS_VERSION) --app-version $(CHARTS_VERSION) $(subst -$(CHARTS_VERSION),,$(basename $(@F)))
helm-docs: helm-docs:
# Avoid polluting repo with helm-docs' README/LICENSE or other files in the release archive # Avoid polluting repo with helm-docs' README/LICENSE or other files in the release archive
@@ -45,7 +54,7 @@ helm-docs:
exit 1; \ exit 1; \
fi fi
release: submariner-k8s-broker-$(CHARTS_VERSION).tgz submariner-operator-$(CHARTS_VERSION).tgz release: $(CHART_PACKAGES)
git checkout gh-pages git checkout gh-pages
mv *.tgz $(CHARTS_DIR) mv *.tgz $(CHARTS_DIR)
if [ -f $(CHARTS_DIR)/index.yaml ]; then \ if [ -f $(CHARTS_DIR)/index.yaml ]; then \
+2 -2
View File
@@ -1,7 +1,7 @@
--- ---
charts: charts:
- submariner-operator - ./helm_repo/submariner-operator
- submariner-k8s-broker - ./helm_repo/submariner-k8s-broker
# Tests that maintainer name is valid GitHub account, which isn't what we want # Tests that maintainer name is valid GitHub account, which isn't what we want
# See: https://github.com/helm/chart-testing/issues/192 # See: https://github.com/helm/chart-testing/issues/192
validate-maintainers: false validate-maintainers: false
+1 -2
View File
@@ -1,8 +1,7 @@
--- ---
name: submariner-k8s-broker name: submariner-k8s-broker
version: 0.14.0-rc2 version: 0.0.0
apiVersion: v2 apiVersion: v2
appVersion: 0.14.0-rc2
description: Submariner Kubernetes Broker description: Submariner Kubernetes Broker
keywords: keywords:
home: https://submariner-io.github.io/ home: https://submariner-io.github.io/
+1 -2
View File
@@ -1,8 +1,7 @@
--- ---
name: submariner-operator name: submariner-operator
version: 0.14.0-rc2 version: 0.0.0
apiVersion: v2 apiVersion: v2
appVersion: 0.14.0-rc2
description: Submariner enables direct networking between Pods and Services in different Kubernetes clusters description: Submariner enables direct networking between Pods and Services in different Kubernetes clusters
keywords: keywords:
home: https://submariner-io.github.io/ home: https://submariner-io.github.io/