From 19c7f0dd5cf82046dda533b7ab4c05249acb12fa Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 3 Feb 2026 17:45:26 +0000 Subject: [PATCH 1/4] Initial plan From df969bc8a603687354213f483fcc804852a234f0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 3 Feb 2026 17:51:03 +0000 Subject: [PATCH 2/4] Fix image digest @null rendering across deployment, job, and cronjob templates Co-authored-by: aslafy-z <8191198+aslafy-z@users.noreply.github.com> --- application/templates/cronjob.yaml | 4 ++-- application/templates/deployment.yaml | 4 ++-- application/templates/job.yaml | 4 ++-- application/tests/cronjob_test.yaml | 17 +++++++++++++++++ application/tests/deployment_test.yaml | 12 ++++++++++++ application/tests/job_test.yaml | 17 +++++++++++++++++ 6 files changed, 52 insertions(+), 6 deletions(-) diff --git a/application/templates/cronjob.yaml b/application/templates/cronjob.yaml index 0240752a..c348275a 100644 --- a/application/templates/cronjob.yaml +++ b/application/templates/cronjob.yaml @@ -84,8 +84,8 @@ spec: {{- $digest := include "application.tplvalues.render" (dict "value" $job.image.digest "context" $) -}} {{- $image := $repo -}} - {{- with $tag }} {{- $image = print $image ":" . }} {{- end }} - {{- with $digest }} {{- $image = print $image "@" . }} {{- end }} + {{- with $tag }} {{- if ne . "null" }} {{- $image = print $image ":" . }} {{- end }} {{- end }} + {{- with $digest }} {{- if ne . "null" }} {{- $image = print $image "@" . }} {{- end }} {{- end }} image: {{ $image }} {{- if $job.image.imagePullPolicy }} imagePullPolicy: {{ $job.image.imagePullPolicy }} diff --git a/application/templates/deployment.yaml b/application/templates/deployment.yaml index 3ae25a07..fa763999 100644 --- a/application/templates/deployment.yaml +++ b/application/templates/deployment.yaml @@ -147,8 +147,8 @@ spec: {{- $digest := include "application.tplvalues.render" (dict "value" .Values.deployment.image.digest "context" $) -}} {{- $image := $repo -}} - {{- with $tag }} {{- $image = print $image ":" . }} {{- end }} - {{- with $digest }} {{- $image = print $image "@" . }} {{- end }} + {{- with $tag }} {{- if ne . "null" }} {{- $image = print $image ":" . }} {{- end }} {{- end }} + {{- with $digest }} {{- if ne . "null" }} {{- $image = print $image "@" . }} {{- end }} {{- end }} image: {{ $image }} imagePullPolicy: {{ .Values.deployment.image.pullPolicy }} {{- with .Values.deployment.lifecycle }} diff --git a/application/templates/job.yaml b/application/templates/job.yaml index a4f84b09..68423b50 100644 --- a/application/templates/job.yaml +++ b/application/templates/job.yaml @@ -64,8 +64,8 @@ spec: {{- $digest := include "application.tplvalues.render" (dict "value" $job.image.digest "context" $) -}} {{- $image := $repo -}} - {{- with $tag }} {{- $image = print $image ":" . }} {{- end }} - {{- with $digest }} {{- $image = print $image "@" . }} {{- end }} + {{- with $tag }} {{- if ne . "null" }} {{- $image = print $image ":" . }} {{- end }} {{- end }} + {{- with $digest }} {{- if ne . "null" }} {{- $image = print $image "@" . }} {{- end }} {{- end }} image: {{ $image }} {{- if $job.image.imagePullPolicy }} imagePullPolicy: {{ $job.image.imagePullPolicy }} diff --git a/application/tests/cronjob_test.yaml b/application/tests/cronjob_test.yaml index e22fbd0d..04d7faf0 100644 --- a/application/tests/cronjob_test.yaml +++ b/application/tests/cronjob_test.yaml @@ -330,6 +330,23 @@ tests: path: spec.jobTemplate.spec.template.spec.containers[0].image value: custom-image + - it: does not render @null when digest field is omitted + set: + cronJob: + enabled: true + jobs: + example: + image: + repository: example-image + tag: example-tag + asserts: + - equal: + path: spec.jobTemplate.spec.template.spec.containers[0].image + value: example-image:example-tag + - notMatchRegex: + path: spec.jobTemplate.spec.template.spec.containers[0].image + pattern: "@null" + - it: configures automount service account token by default set: cronJob: diff --git a/application/tests/deployment_test.yaml b/application/tests/deployment_test.yaml index fb274d01..4dedd736 100644 --- a/application/tests/deployment_test.yaml +++ b/application/tests/deployment_test.yaml @@ -88,6 +88,18 @@ tests: path: spec.template.spec.containers[0].image value: example-image:example-tag@sha256:example-digest + - it: does not render @null when digest field is omitted + set: + deployment.image.repository: example-image + deployment.image.tag: example-tag + asserts: + - equal: + path: spec.template.spec.containers[0].image + value: example-image:example-tag + - notMatchRegex: + path: spec.template.spec.containers[0].image + pattern: "@null" + - it: yields empty service account name when disabled set: rbac.serviceAccount.enabled: false diff --git a/application/tests/job_test.yaml b/application/tests/job_test.yaml index bbe144a5..107e8c92 100644 --- a/application/tests/job_test.yaml +++ b/application/tests/job_test.yaml @@ -329,6 +329,23 @@ tests: path: spec.template.spec.containers[0].image value: custom-image + - it: does not render @null when digest field is omitted + set: + job: + enabled: true + jobs: + example: + image: + repository: example-image + tag: example-tag + asserts: + - equal: + path: spec.template.spec.containers[0].image + value: example-image:example-tag + - notMatchRegex: + path: spec.template.spec.containers[0].image + pattern: "@null" + - it: configures automount service account token by default set: job: From 84e6a34c7f189c8ea02171107cb957db6266a94a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 3 Feb 2026 17:58:07 +0000 Subject: [PATCH 3/4] Better fix: Update tplvalues.render helper to handle nil values correctly Co-authored-by: aslafy-z <8191198+aslafy-z@users.noreply.github.com> --- application/templates/_helpers.tpl | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/application/templates/_helpers.tpl b/application/templates/_helpers.tpl index aae9add3..76ce78ac 100644 --- a/application/templates/_helpers.tpl +++ b/application/templates/_helpers.tpl @@ -21,11 +21,14 @@ Usage: {{ include "application.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }} */}} {{- define "application.tplvalues.render" -}} - {{- if typeIs "string" .value }} - {{- tpl .value .context }} - {{- else }} - {{- tpl (.value | toYaml) .context }} - {{- end }} + {{- $value := .value -}} + {{- if or (not $value) (kindIs "invalid" $value) -}} + {{- "" -}} + {{- else if typeIs "string" $value -}} + {{- tpl $value .context -}} + {{- else -}} + {{- tpl ($value | toYaml) .context -}} + {{- end -}} {{- end -}} {{/* From 3b22c246a3d6971ed59bb63b7e8a4d2044bc6172 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 3 Feb 2026 17:59:07 +0000 Subject: [PATCH 4/4] Remove redundant null checks from templates - helper fix is sufficient Co-authored-by: aslafy-z <8191198+aslafy-z@users.noreply.github.com> --- application/templates/cronjob.yaml | 4 ++-- application/templates/deployment.yaml | 4 ++-- application/templates/job.yaml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/application/templates/cronjob.yaml b/application/templates/cronjob.yaml index c348275a..0240752a 100644 --- a/application/templates/cronjob.yaml +++ b/application/templates/cronjob.yaml @@ -84,8 +84,8 @@ spec: {{- $digest := include "application.tplvalues.render" (dict "value" $job.image.digest "context" $) -}} {{- $image := $repo -}} - {{- with $tag }} {{- if ne . "null" }} {{- $image = print $image ":" . }} {{- end }} {{- end }} - {{- with $digest }} {{- if ne . "null" }} {{- $image = print $image "@" . }} {{- end }} {{- end }} + {{- with $tag }} {{- $image = print $image ":" . }} {{- end }} + {{- with $digest }} {{- $image = print $image "@" . }} {{- end }} image: {{ $image }} {{- if $job.image.imagePullPolicy }} imagePullPolicy: {{ $job.image.imagePullPolicy }} diff --git a/application/templates/deployment.yaml b/application/templates/deployment.yaml index fa763999..3ae25a07 100644 --- a/application/templates/deployment.yaml +++ b/application/templates/deployment.yaml @@ -147,8 +147,8 @@ spec: {{- $digest := include "application.tplvalues.render" (dict "value" .Values.deployment.image.digest "context" $) -}} {{- $image := $repo -}} - {{- with $tag }} {{- if ne . "null" }} {{- $image = print $image ":" . }} {{- end }} {{- end }} - {{- with $digest }} {{- if ne . "null" }} {{- $image = print $image "@" . }} {{- end }} {{- end }} + {{- with $tag }} {{- $image = print $image ":" . }} {{- end }} + {{- with $digest }} {{- $image = print $image "@" . }} {{- end }} image: {{ $image }} imagePullPolicy: {{ .Values.deployment.image.pullPolicy }} {{- with .Values.deployment.lifecycle }} diff --git a/application/templates/job.yaml b/application/templates/job.yaml index 68423b50..a4f84b09 100644 --- a/application/templates/job.yaml +++ b/application/templates/job.yaml @@ -64,8 +64,8 @@ spec: {{- $digest := include "application.tplvalues.render" (dict "value" $job.image.digest "context" $) -}} {{- $image := $repo -}} - {{- with $tag }} {{- if ne . "null" }} {{- $image = print $image ":" . }} {{- end }} {{- end }} - {{- with $digest }} {{- if ne . "null" }} {{- $image = print $image "@" . }} {{- end }} {{- end }} + {{- with $tag }} {{- $image = print $image ":" . }} {{- end }} + {{- with $digest }} {{- $image = print $image "@" . }} {{- end }} image: {{ $image }} {{- if $job.image.imagePullPolicy }} imagePullPolicy: {{ $job.image.imagePullPolicy }}