### Description of the change This is a preparation for #724 (bash script testing) which would be too complex to review if done there. I haven't changed the script contents. ### Benefits Better IDE support, possibility for shell checks, tests. ### Possible drawbacks - ### Additional information I only extracted files that are native bash scripts. There are others, being a mix of Helm templating and shell scripts. Those scripts must be cleared first before extracting them as well. Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/751 Co-authored-by: justusbunsi <sk.bunsenbrenner@gmail.com> Co-committed-by: justusbunsi <sk.bunsenbrenner@gmail.com>
73 lines
2.1 KiB
YAML
73 lines
2.1 KiB
YAML
suite: Init template
|
|
release:
|
|
name: gitea-unittests
|
|
namespace: testing
|
|
templates:
|
|
- templates/gitea/init.yaml
|
|
tests:
|
|
- it: runs gpg in batch mode
|
|
set:
|
|
image.rootless: false
|
|
signing.enabled: true
|
|
signing.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 /raw/private.asc
|
|
- it: skips gpg script block for disabled signing
|
|
set:
|
|
image.rootless: false
|
|
asserts:
|
|
- equal:
|
|
path: stringData["init_directory_structure.sh"]
|
|
value: |-
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
chown -v 1000:1000 /data
|
|
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}"
|
|
chown -v 1000:1000 "${GITEA_TEMP}"
|
|
chmod -v ug+rwx "${GITEA_TEMP}"
|
|
- it: adds gpg script block for enabled signing
|
|
set:
|
|
image.rootless: false
|
|
signing.enabled: true
|
|
signing.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
|
|
chown -v 1000:1000 /data
|
|
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}"
|
|
chown -v 1000:1000 "${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
|