Quote image tag (#641)

fix #631

Co-authored-by: justusbunsi <sk.bunsenbrenner@gmail.com>
Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/641
Co-authored-by: pat-s <patrick.schratz@gmail.com>
Co-committed-by: pat-s <patrick.schratz@gmail.com>
This commit is contained in:
pat-s 2024-05-02 08:05:26 +00:00 committed by pat-s
parent dd304c1c1a
commit 0b2f3d6eb9
2 changed files with 18 additions and 1 deletions

View File

@ -40,7 +40,7 @@ Create image name and tag used by the deployment.
{{- $registry := .Values.global.imageRegistry | default .Values.image.registry -}} {{- $registry := .Values.global.imageRegistry | default .Values.image.registry -}}
{{- $repository := .Values.image.repository -}} {{- $repository := .Values.image.repository -}}
{{- $separator := ":" -}} {{- $separator := ":" -}}
{{- $tag := .Values.image.tag | default .Chart.AppVersion -}} {{- $tag := .Values.image.tag | default .Chart.AppVersion | toString -}}
{{- $rootless := ternary "-rootless" "" (.Values.image.rootless) -}} {{- $rootless := ternary "-rootless" "" (.Values.image.rootless) -}}
{{- $digest := "" -}} {{- $digest := "" -}}
{{- if .Values.image.digest }} {{- if .Values.image.digest }}

View File

@ -91,3 +91,20 @@ tests:
- equal: - equal:
path: spec.template.spec.containers[0].image path: spec.template.spec.containers[0].image
value: "global.example.com/gitea/gitea:1.19.3-rootless@sha256:b28e8f3089b52ebe6693295df142f8c12eff354e9a4a5bfbb5c10f296c3a537a" value: "global.example.com/gitea/gitea:1.19.3-rootless@sha256:b28e8f3089b52ebe6693295df142f8c12eff354e9a4a5bfbb5c10f296c3a537a"
- it: correctly renders floating tag references
template: templates/gitea/deployment.yaml
set:
image.tag: 1.21 # use non-quoted value on purpose. See: https://gitea.com/gitea/helm-chart/issues/631
asserts:
- equal:
path: spec.template.spec.initContainers[0].image
value: "gitea/gitea:1.21-rootless"
- equal:
path: spec.template.spec.initContainers[1].image
value: "gitea/gitea:1.21-rootless"
- equal:
path: spec.template.spec.initContainers[2].image
value: "gitea/gitea:1.21-rootless"
- equal:
path: spec.template.spec.containers[0].image
value: "gitea/gitea:1.21-rootless"