2023-01-18 00:58:10 +08:00
|
|
|
suite: Init template
|
|
|
|
release:
|
|
|
|
name: gitea-unittests
|
|
|
|
namespace: testing
|
|
|
|
templates:
|
|
|
|
- templates/gitea/init.yaml
|
|
|
|
tests:
|
|
|
|
- it: runs gpg in batch mode
|
|
|
|
set:
|
2023-06-27 20:32:01 +00:00
|
|
|
image.rootless: false
|
2023-01-18 00:58:10 +08:00
|
|
|
signing.enabled: true
|
2023-04-14 14:45:37 +08:00
|
|
|
signing.privateKey: |-
|
|
|
|
-----BEGIN PGP PRIVATE KEY BLOCK-----
|
|
|
|
{placeholder}
|
|
|
|
-----END PGP PRIVATE KEY BLOCK-----
|
2023-01-18 00:58:10 +08:00
|
|
|
asserts:
|
|
|
|
- equal:
|
2023-03-21 23:53:13 +08:00
|
|
|
path: stringData["configure_gpg_environment.sh"]
|
2023-01-18 00:58:10 +08:00
|
|
|
value: |-
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
gpg --batch --import /raw/private.asc
|
|
|
|
- it: skips gpg script block for disabled signing
|
2023-06-27 20:32:01 +00:00
|
|
|
set:
|
|
|
|
image.rootless: false
|
2023-01-18 00:58:10 +08:00
|
|
|
asserts:
|
|
|
|
- equal:
|
2023-03-21 23:53:13 +08:00
|
|
|
path: stringData["init_directory_structure.sh"]
|
2023-01-18 00:58:10 +08:00
|
|
|
value: |-
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
2024-09-02 13:22:11 +02:00
|
|
|
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
|
2023-01-18 00:58:10 +08:00
|
|
|
|
|
|
|
# prepare temp directory structure
|
2024-09-02 13:22:11 +02:00
|
|
|
mkdir -pv "${GITEA_TEMP}"
|
|
|
|
chown -v 1000:1000 "${GITEA_TEMP}"
|
|
|
|
chmod -v ug+rwx "${GITEA_TEMP}"
|
2023-01-18 00:58:10 +08:00
|
|
|
- it: adds gpg script block for enabled signing
|
|
|
|
set:
|
2023-06-27 20:32:01 +00:00
|
|
|
image.rootless: false
|
2023-01-18 00:58:10 +08:00
|
|
|
signing.enabled: true
|
2023-04-14 14:45:37 +08:00
|
|
|
signing.privateKey: |-
|
|
|
|
-----BEGIN PGP PRIVATE KEY BLOCK-----
|
|
|
|
{placeholder}
|
|
|
|
-----END PGP PRIVATE KEY BLOCK-----
|
2023-01-18 00:58:10 +08:00
|
|
|
asserts:
|
|
|
|
- equal:
|
2023-03-21 23:53:13 +08:00
|
|
|
path: stringData["init_directory_structure.sh"]
|
2023-01-18 00:58:10 +08:00
|
|
|
value: |-
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
2024-09-02 13:46:50 +02:00
|
|
|
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
|
2023-01-18 00:58:10 +08:00
|
|
|
|
|
|
|
# prepare temp directory structure
|
2024-09-02 13:46:50 +02:00
|
|
|
mkdir -pv "${GITEA_TEMP}"
|
|
|
|
chown -v 1000:1000 "${GITEA_TEMP}"
|
|
|
|
chmod -v ug+rwx "${GITEA_TEMP}"
|
2023-01-18 00:58:10 +08:00
|
|
|
|
|
|
|
if [ ! -d "${GNUPGHOME}" ]; then
|
2024-09-02 13:46:50 +02:00
|
|
|
mkdir -pv "${GNUPGHOME}"
|
|
|
|
chmod -v 700 "${GNUPGHOME}"
|
|
|
|
chown -v 1000:1000 "${GNUPGHOME}"
|
2023-01-18 00:58:10 +08:00
|
|
|
fi
|