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>
83 lines
2.5 KiB
YAML
83 lines
2.5 KiB
YAML
suite: Init template
|
|
release:
|
|
name: gitea-unittests
|
|
namespace: testing
|
|
templates:
|
|
- templates/secret_init.yaml
|
|
tests:
|
|
- it: runs gpg in batch mode
|
|
set:
|
|
secrets.gpg.enabled: true
|
|
secrets.gpg.new.privateKey: |-
|
|
-----BEGIN PGP PRIVATE KEY BLOCK-----
|
|
{placeholder}
|
|
-----END PGP PRIVATE KEY BLOCK-----
|
|
asserts:
|
|
- equal:
|
|
path: stringData["configure_gpg_environment.sh"]
|
|
value: |
|
|
#!/usr/bin/env bash
|
|
set -eu
|
|
|
|
gpg --batch --import "$TMP_RAW_GPG_KEY"
|
|
- it: skips gpg script block for disabled signing
|
|
asserts:
|
|
- equal:
|
|
path: stringData["init_directory_structure.sh"]
|
|
value: |-
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
mkdir -pv /data/git/.ssh
|
|
chmod -Rv 700 /data/git/.ssh
|
|
[ ! -d /data/gitea/conf ] && mkdir -pv /data/gitea/conf
|
|
|
|
# prepare temp directory structure
|
|
mkdir -pv "${GITEA_TEMP}"
|
|
chmod -v ug+rwx "${GITEA_TEMP}"
|
|
- it: adds gpg script block for enabled signing
|
|
set:
|
|
secrets.gpg.enabled: true
|
|
secrets.gpg.new.privateKey: |-
|
|
-----BEGIN PGP PRIVATE KEY BLOCK-----
|
|
{placeholder}
|
|
-----END PGP PRIVATE KEY BLOCK-----
|
|
asserts:
|
|
- equal:
|
|
path: stringData["init_directory_structure.sh"]
|
|
value: |-
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
mkdir -pv /data/git/.ssh
|
|
chmod -Rv 700 /data/git/.ssh
|
|
[ ! -d /data/gitea/conf ] && mkdir -pv /data/gitea/conf
|
|
|
|
# prepare temp directory structure
|
|
mkdir -pv "${GITEA_TEMP}"
|
|
chmod -v ug+rwx "${GITEA_TEMP}"
|
|
|
|
if [ ! -d "${GNUPGHOME}" ]; then
|
|
mkdir -pv "${GNUPGHOME}"
|
|
chmod -v 700 "${GNUPGHOME}"
|
|
chown -v 1000:1000 "${GNUPGHOME}"
|
|
fi
|
|
- it: it does not chown /data even when image.fullOverride is set
|
|
template: templates/secret_init.yaml
|
|
set:
|
|
deployment.gitea.image.fullOverride: docker.gitea.com/gitea:1.20.5
|
|
asserts:
|
|
- equal:
|
|
path: stringData["init_directory_structure.sh"]
|
|
value: |-
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
mkdir -pv /data/git/.ssh
|
|
chmod -Rv 700 /data/git/.ssh
|
|
[ ! -d /data/gitea/conf ] && mkdir -pv /data/gitea/conf
|
|
|
|
# prepare temp directory structure
|
|
mkdir -pv "${GITEA_TEMP}"
|
|
chmod -v ug+rwx "${GITEA_TEMP}"
|