diff --git a/README.md.gotmpl b/README.md.gotmpl index 22983df..4dbf142 100644 --- a/README.md.gotmpl +++ b/README.md.gotmpl @@ -9,6 +9,7 @@ This chart is used to set up the basic building blocks in [Validated Patterns](h ### Notable changes +* v0.9.49: Boolean Templates in override values now also render correctly * v0.9.48: Templates in override values now render * v0.9.45: Default value of `resourceTrackingMethod` is now `annotation` * v0.9.44: Default value of `resourceTrackingMethod` is now `annotation` diff --git a/templates/plumbing/applications.yaml b/templates/plumbing/applications.yaml index 8d6f5bc..46835d7 100644 --- a/templates/plumbing/applications.yaml +++ b/templates/plumbing/applications.yaml @@ -81,7 +81,7 @@ spec: {{- end }} {{- range .overrides }} - name: {{ .name }} - value: {{ tpl .value $ | quote }} + value: {{ tpl (toString .value) $ | quote }} {{- if .forceString }} forceString: true {{- end }} @@ -154,7 +154,7 @@ spec: {{- end }} {{- range .overrides }} - name: {{ .name }} - value: {{ tpl .value $ | quote }} + value: {{ tpl (toString .value) $ | quote }} {{- if .forceString }} forceString: true {{- end }} diff --git a/tests/application_override_test.yaml b/tests/application_override_test.yaml index 54c58ac..da74276 100644 --- a/tests/application_override_test.yaml +++ b/tests/application_override_test.yaml @@ -101,3 +101,56 @@ tests: content: name: test_override value: https://github.com/validatedpatterns/multicloud-gitops + + - it: should stringify boolean override values for multisource applications + set: + global: + repoURL: https://github.com/validatedpatterns/multicloud-gitops + multiSourceRepoUrl: https://charts.validatedpatterns.io + clusterGroup: + applications: + acm: + name: acm + namespace: open-cluster-management + project: hub + chart: acm + chartVersion: 0.1.* + overrides: + - name: test_bool_true + value: true + - name: test_bool_false + value: false + asserts: + - hasDocuments: + count: 1 + - contains: + path: spec.sources[1].helm.parameters + content: + name: test_bool_true + value: "true" + - contains: + path: spec.sources[1].helm.parameters + content: + name: test_bool_false + value: "false" + + - it: should stringify boolean override values for single-source applications + set: + clusterGroup: + applications: + test-app: + name: test-app + namespace: test-ns + project: default + path: charts/test + overrides: + - name: test_bool_true + value: true + asserts: + - hasDocuments: + count: 1 + - contains: + path: spec.source.helm.parameters + content: + name: test_bool_true + value: "true"