Skip to content

feat(zot): allow disabling the helm test hooks - #156

Merged
andaaron merged 2 commits into
project-zot:mainfrom
nitrocb:feat/test-enabled
Nov 19, 2026
Merged

andaaron merged 2 commits into
project-zot:mainfrom
nitrocb:feat/test-enabled

Conversation

@nitrocb

@nitrocb nitrocb commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

feature

Which issue does this PR fix:

None.

What does this PR do / Why do we need it:

Adds test.enabled (default true). When it is false, the two helm test hooks (test-connection, test-connection-fails) are not rendered.

With htpasswd auth and no anonymousPolicy, the hooks only pass when authHeader is set. The chart writes authHeader (base64 user:password) into the hook manifest, so the credentials end up in the Helm release secret (helm get hooks) and in the test pod spec. Deployments that check the registry by other means can now leave the hooks out instead of storing credentials in the release. Today there is no way to do that.

The condition uses the same and .Values.x .Values.x.enabled pattern as httproute and listenerset.

If an issue # is not available please add repro steps and logs showing the issue:

helm template zot charts/zot --set authHeader=Zm9vOmJhcg== | grep Authorization
#   wget --no-check-certificate --header "Authorization: Basic Zm9vOmJhcg==" ...

Without authHeader, both hooks get 401 from a registry without anonymous access, so helm test fails.

Testing done on this change:

  • helm unittest --strict --file 'unittests/*.yaml' charts/zot: 13 suites, 104 tests passed. The new suite unittests/test_hooks_test.yaml covers the default (both hooks rendered), test.enabled: false (none) and test: null (none, no render error). Against the templates on main, two of its three cases fail.
  • helm lint --strict charts/zot: no findings.
  • helm template with default values gives the same output as main. With --set test.enabled=false it contains no helm.sh/hook: test resources.

ct lint and ct install were not run locally.

Automation added to e2e:

No, unit tests only.

Will this break upgrades or downgrades?

No. The default is true, so the rendered output does not change. One exception: helm upgrade --reuse-values does not pick up new chart defaults. test.enabled is then missing and the hooks are not rendered until the values are reset or test.enabled: true is set. The zot deployment itself is not affected.

Does this PR introduce any user-facing change?:

Added test.enabled (default true). Set it to false to leave the helm test hooks out of the release.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Add test.enabled (default true) to render the helm test hooks only
when enabled. With htpasswd auth and no anonymous access the hooks
need authHeader, which puts the credentials into the release.

Signed-off-by: Christian Bendieck <chris.bendieck@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block the change to make Helm test hooks optional.

No open issues 🎉

What changed in this PR

Adds an opt-out for the zot chart’s Helm test hooks, allowing deployments with other registry checks to omit the hooks without supplying test credentials. Hooks remain enabled by default.

Changes:

  • Adds test.enabled, defaulting to true, and documents the setting.
  • Conditionally renders both test hooks.
  • Adds unit tests covering default rendering, explicit disabling, and test: null.
File Description
charts/​zot/​values.yaml Defines and describes test.enabled.
charts/​zot/​unittests/​test_hooks_test.yaml Tests default, disabled, and null configurations.
charts/​zot/​templates/​tests/​test-connection.yaml Gates the connection hook on test.enabled.
charts/​zot/​templates/​tests/​test-connection-fails.yaml Gates the failure-check hook on test.enabled.
charts/​zot/​README.md Documents the option and its default.

Review effort: Balanced

@andaaron andaaron left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change the if so a missing test.enabled still renders the hooks. The current check skips them (charts/zot/templates/tests/test-connection.yaml:1, charts/zot/templates/tests/test-connection-fails.yaml:1).

helm upgrade --reuse-values keeps the old values. Those have test.image and no test.enabled, so both hooks disappear and helm test passes without checking the registry. A normal upgrade still gets the default true (charts/zot/values.yaml:414).

Use this on both hooks:

{{- if and .Values.test (ne .Values.test.enabled false) }}

The hook stays when the key is missing. It is skipped when enabled is false or when test is null. Please add a unit test where test.image is set and enabled is unset (charts/zot/unittests/test_hooks_test.yaml).

Signed-off-by: Christian Bendieck <chris.bendieck@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the change allowing Helm test hooks to be disabled.

No open issues 🎉

Review effort: Balanced

@andaaron
andaaron merged commit 7512eed into project-zot:main Nov 19, 2026
5 checks passed
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.

3 participants