The `templates/gitea` subdirectory did not group anything meaningful, since every template of this chart belongs to Gitea. It only duplicated the chart name in every path and forced the unit tests to spell out `templates/gitea/<name>.yaml`, while `_helpers.tpl` and `NOTES.txt` already lived directly in `templates`. All templates now live in `templates`, which matches the layout of the bundled sub-charts and the Helm defaults. The checksum helper in `templates/_secrets.tpl` built its include path from `$root.Template.BasePath` and therefore carried the subdirectory in a `printf` format string instead of a literal path. Without adjusting it the chart failed to render with "no template gitea/templates/gitea/secret_config.yaml associated with template gotpl". Co-authored-by: Copilot <copilot@github.com>
88 lines
3.0 KiB
YAML
88 lines
3.0 KiB
YAML
suite: deployment template (extraEnvSourceFile)
|
|
release:
|
|
name: gitea-unittests
|
|
namespace: testing
|
|
templates:
|
|
- templates/deployment.yaml
|
|
- templates/secret_admin.yaml
|
|
- templates/secret_config.yaml
|
|
- templates/secret_gpg.yaml
|
|
- templates/secret_init.yaml
|
|
- templates/secret_inlineConfig.yaml
|
|
- templates/secret_metrics.yaml
|
|
tests:
|
|
- it: uses direct execution when extraEnvSourceFile is not set
|
|
template: templates/deployment.yaml
|
|
asserts:
|
|
- equal:
|
|
path: spec.template.spec.initContainers[1].command
|
|
value: ["/usr/sbinx/config_environment.sh"]
|
|
- notExists:
|
|
path: spec.template.spec.initContainers[1].args
|
|
- equal:
|
|
path: spec.template.spec.initContainers[2].command
|
|
value: ["/usr/sbinx/configure_gitea.sh"]
|
|
- notExists:
|
|
path: spec.template.spec.initContainers[2].args
|
|
|
|
- it: sources env file in init-app-ini when extraEnvSourceFile is set
|
|
template: templates/deployment.yaml
|
|
set:
|
|
gitea:
|
|
extraEnvSourceFile: /vault/secrets/gitea
|
|
asserts:
|
|
- equal:
|
|
path: spec.template.spec.initContainers[1].command
|
|
value: ["/bin/bash", "-c"]
|
|
- matchRegex:
|
|
path: spec.template.spec.initContainers[1].args[0]
|
|
pattern: source /vault/secrets/gitea
|
|
- matchRegex:
|
|
path: spec.template.spec.initContainers[1].args[0]
|
|
pattern: config_environment\.sh
|
|
|
|
- it: sources env file in configure-gitea when extraEnvSourceFile is set
|
|
template: templates/deployment.yaml
|
|
set:
|
|
gitea:
|
|
extraEnvSourceFile: /vault/secrets/gitea
|
|
asserts:
|
|
- equal:
|
|
path: spec.template.spec.initContainers[2].command
|
|
value: ["/bin/bash", "-c"]
|
|
- matchRegex:
|
|
path: spec.template.spec.initContainers[2].args[0]
|
|
pattern: source /vault/secrets/gitea
|
|
- matchRegex:
|
|
path: spec.template.spec.initContainers[2].args[0]
|
|
pattern: configure_gitea\.sh
|
|
|
|
- it: sources env file in configure-gpg when extraEnvSourceFile is set with signing enabled
|
|
template: templates/deployment.yaml
|
|
set:
|
|
secrets.gpg.enabled: true
|
|
secrets.gpg.existingSecret.enabled: true
|
|
secrets.gpg.existingSecret.secretName: "custom-gpg-secret"
|
|
gitea:
|
|
extraEnvSourceFile: /vault/secrets/gitea
|
|
asserts:
|
|
- equal:
|
|
path: spec.template.spec.initContainers[2].command
|
|
value: ["/bin/bash", "-c"]
|
|
- matchRegex:
|
|
path: spec.template.spec.initContainers[2].args[0]
|
|
pattern: source /vault/secrets/gitea
|
|
- matchRegex:
|
|
path: spec.template.spec.initContainers[2].args[0]
|
|
pattern: configure_gpg_environment\.sh
|
|
|
|
- it: includes file existence check in source command
|
|
template: templates/deployment.yaml
|
|
set:
|
|
gitea:
|
|
extraEnvSourceFile: /vault/secrets/gitea
|
|
asserts:
|
|
- matchRegex:
|
|
path: spec.template.spec.initContainers[1].args[0]
|
|
pattern: "test -f /vault/secrets/gitea"
|