Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 3, 2026

When image.digest is undefined in values, templates render image:tag@null instead of image:tag. The application.tplvalues.render helper converts nil to string "null" via toYaml, which passes {{- with }} checks since "null" is non-empty.

Changes

  • _helpers.tpl: Updated application.tplvalues.render to check for nil/invalid values before processing and return empty string instead of converting to "null"
  • Test files: Added regression tests for cronjob, job, and deployment templates

Technical Details

The helper now short-circuits on nil/invalid values:

{{- define "application.tplvalues.render" -}}
    {{- $value := .value -}}
    {{- if or (not $value) (kindIs "invalid" $value) -}}
        {{- "" -}}
    {{- else if typeIs "string" $value -}}
        {{- tpl $value .context -}}
    {{- else -}}
        {{- tpl ($value | toYaml) .context -}}
    {{- end -}}
{{- end -}}

This fix benefits all uses of tplvalues.render throughout the chart, not just image handling. The {{- with }} checks now behave as expected for undefined values.

Before: nginx:latest@null
After: nginx:latest

Original prompt

This section details on the original issue you should resolve

<issue_title>Image digest @null in rendered for cronjobs when not set</issue_title>
<issue_description>Describe the bug
When enabling cronjob, if a job has image.digest is not set the template will render @null.

To Reproduce
Steps to reproduce the behavior:

cronJob:
  enabled: true
  jobs:
    some-job:
      schedule: "* * * * *"
      image:
        repository: image-name
        tag: image-tag

Running helm template stakater/application -f values.yaml

# Source: application/templates/cronjob.yaml
apiVersion: batch/v1beta1
kind: CronJob
spec:
  schedule: "* * * * *"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: some-job
            image: image-name:image-tag@null

A workaround is to explicitly set digest: ""

Affects 6.14 but I didn't see any mentions in recent releases.

Expected behavior
if digest is not set, it should not display.

Actual behavior
Digest displays with @null
</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…templates

Co-authored-by: aslafy-z <8191198+aslafy-z@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix image digest rendering issue in cronjobs Fix image digest rendering @null when not set in cronjob, job, and deployment templates Feb 3, 2026
Copilot AI requested a review from aslafy-z February 3, 2026 17:53
Copilot AI and others added 2 commits February 3, 2026 17:58
…ctly

Co-authored-by: aslafy-z <8191198+aslafy-z@users.noreply.github.com>
Co-authored-by: aslafy-z <8191198+aslafy-z@users.noreply.github.com>
Copilot AI changed the title Fix image digest rendering @null when not set in cronjob, job, and deployment templates Fix nil value handling in tplvalues.render helper Feb 3, 2026
@aslafy-z aslafy-z changed the title Fix nil value handling in tplvalues.render helper fix: nil value handling in tplvalues.render helper Feb 3, 2026
@aslafy-z aslafy-z marked this pull request as ready for review February 3, 2026 18:01
@aslafy-z aslafy-z requested a review from rasheedamir as a code owner February 3, 2026 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Image digest @null in rendered for cronjobs when not set

3 participants