From 21bb8cc44370c1739a43647b897af7d5872e79ab Mon Sep 17 00:00:00 2001 From: Patrick Gnaegi Date: Thu, 19 Dec 2024 13:06:26 +0100 Subject: [PATCH] feat(common): appVersion as optional value Signed-off-by: Patrick Gnaegi --- charts/common/Chart.yaml | 5 +++-- charts/common/README.md | 2 +- charts/common/templates/helpers/_labels.tpl | 2 +- charts/common/values.schema.json | 11 +++++++++++ charts/common/values.yaml | 3 +++ 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/charts/common/Chart.yaml b/charts/common/Chart.yaml index ee4745f0..c1955fcf 100644 --- a/charts/common/Chart.yaml +++ b/charts/common/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 name: common description: "Bedag's common Helm chart to use for creating other Helm charts" -version: 12.0.0 +version: 12.1.0 # A chart can be either an 'application' or a 'library' chart. # # Application charts are a collection of templates that can be packaged into versioned archives @@ -27,4 +27,5 @@ annotations: artifacthub.io/prerelease: "false" artifacthub.io/license: Apache-2.0 artifacthub.io/changes: | - - "[Changed]: extra annotations and labesl support sprig statements" + - "[Changed]: extra annotations and labels support sprig statements" + - "[Added]: Possibility to optionally set appVersion in values" diff --git a/charts/common/README.md b/charts/common/README.md index 5c501c05..28949f50 100644 --- a/charts/common/README.md +++ b/charts/common/README.md @@ -1,6 +1,6 @@ # common -![Version: 12.0.0](https://img.shields.io/badge/Version-12.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) +![Version: 12.1.0](https://img.shields.io/badge/Version-12.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) Bedag's common Helm chart to use for creating other Helm charts diff --git a/charts/common/templates/helpers/_labels.tpl b/charts/common/templates/helpers/_labels.tpl index ebd937ff..7eaf7d18 100644 --- a/charts/common/templates/helpers/_labels.tpl +++ b/charts/common/templates/helpers/_labels.tpl @@ -21,7 +21,7 @@ app.kubernetes.io/name: {{ template "library.name" . }} helm.sh/chart: {{ template "library.chartrefshort" . }} app.kubernetes.io/managed-by: {{ .Release.Service | quote }} app.kubernetes.io/instance: {{ .Release.Name | quote }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +app.kubernetes.io/version: {{ .Values.appVersion | default .Chart.AppVersion | quote }} {{- end -}} {{- /* diff --git a/charts/common/values.schema.json b/charts/common/values.schema.json index 1afd451d..c457c05c 100644 --- a/charts/common/values.schema.json +++ b/charts/common/values.schema.json @@ -361,6 +361,17 @@ } }, "properties": { + "appVersion": { + "title": "SemVer check", + "description": "https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string using ECMA compatible regex with double escaping (\\)", + "type": "string", + "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$", + "examples": [ + "1.0.0", + "1.0.0-beta", + "1.2.1" + ] + }, "defaultTag": { "title": "SemVer check", "description": "https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string using ECMA compatible regex with double escaping (\\) and option for 'latest' but then be compatible with postgres-tag format of XX.MM (without patch part)", diff --git a/charts/common/values.yaml b/charts/common/values.yaml index e6d4f05c..e030ce8f 100644 --- a/charts/common/values.yaml +++ b/charts/common/values.yaml @@ -10,6 +10,9 @@ # nameSuffix: "" # nameOverride: "" +## appVersion is optional to override the default .Chart.appVersion +# appVersion: "1.0.0" + # defaultTag is used when no imageTag is specified in .Values.components.*.controller.image.tag defaultTag: latest