Skip to content

Commit f382390

Browse files
committed
Ensure version tag matches deployed version
When overriding `image.tag` the version label should also show the correct version. Previously, the label would always be AppVersion, even if the user had provided a different image tag (thus deploying a different Nextcloud version). With this change, the version is always first derived from the image tag and only from AppVersion if not tag was provided. For the "nextcloud.image" helper this was already the case, now the "version" label on all resources also does this. Signed-off-by: Florian Ruechel <code@inexplicity.de>
1 parent c478128 commit f382390

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

charts/nextcloud/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v2
22
name: nextcloud
3-
version: 8.6.0
3+
version: 8.7.0
44
# renovate: image=docker.io/library/nextcloud
55
appVersion: 32.0.2
66
description: A file sharing server that puts the control and security of your own data back into your hands.

charts/nextcloud/templates/_helpers.tpl

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,14 @@ Create chart name and version as used by the chart label.
4242
Create image name that is used in the deployment
4343
*/}}
4444
{{- define "nextcloud.image" -}}
45-
{{- if .Values.image.tag -}}
46-
{{- printf "%s/%s:%s" (coalesce .Values.global.image.registry .Values.image.registry) .Values.image.repository .Values.image.tag -}}
47-
{{- else -}}
48-
{{- printf "%s/%s:%s-%s" (coalesce .Values.global.image.registry .Values.image.registry) .Values.image.repository .Chart.AppVersion .Values.image.flavor -}}
45+
{{- printf "%s/%s:%s" (coalesce .Values.global.image.registry .Values.image.registry) .Values.image.repository (include "nextcloud.version" .) -}}
4946
{{- end -}}
47+
48+
{{/*
49+
Return Nextcloud version from either image tag or AppVersion
50+
*/}}
51+
{{- define "nextcloud.version" -}}
52+
{{- .Values.image.tag | default .Chart.AppVersion }}
5053
{{- end -}}
5154

5255

@@ -445,7 +448,7 @@ Parameters:
445448
{{ include "nextcloud.selectorLabels" ( dict "component" .component "rootContext" .rootContext) }}
446449
helm.sh/chart: {{ include "nextcloud.chart" .rootContext }}
447450
app.kubernetes.io/managed-by: {{ .rootContext.Release.Service }}
448-
{{- with .rootContext.Chart.AppVersion }}
451+
{{- with (include "nextcloud.version" .rootContext) }}
449452
app.kubernetes.io/version: {{ quote . }}
450453
{{- end }}
451454
{{- end -}}

0 commit comments

Comments
 (0)