test(nginx): fix tests to work in GHA (#1372)

* test(nginx): fix tests to work in GHA

Closes: #1371
Signed-off-by: Xe Iaso <me@xeiaso.net>

* fix(test): does this work lol

Signed-off-by: Xe Iaso <me@xeiaso.net>

* fix(test): does this other thing work lol

Signed-off-by: Xe Iaso <me@xeiaso.net>

* fix(test): pki folder location

Signed-off-by: Xe Iaso <me@xeiaso.net>

---------

Signed-off-by: Xe Iaso <me@xeiaso.net>
Signed-off-by: Jason Cameron <git@jasoncameron.dev>
Co-authored-by: Jason Cameron <git@jasoncameron.dev>
This commit is contained in:
Xe Iaso 2025-12-28 23:59:48 -05:00 committed by GitHub
parent 880020095c
commit 1d8e98c5ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 48 additions and 52 deletions

View file

@ -14,7 +14,7 @@ services:
ports: ports:
- 3004:3004 - 3004:3004
volumes: volumes:
- ../pki/registry.local.cetacean.club:/etc/techaro/pki/registry.local.cetacean.club - ./pki/registry.local.cetacean.club:/etc/techaro/pki/registry.local.cetacean.club
anubis: anubis:
image: ko.local/anubis image: ko.local/anubis

View file

@ -1,53 +1,56 @@
REPO_ROOT=$(git rev-parse --show-toplevel) REPO_ROOT=$(git rev-parse --show-toplevel)
(cd $REPO_ROOT && go install ./utils/cmd/...) (cd $REPO_ROOT && go install ./utils/cmd/...)
mkdir -p pki
echo '*' >>./pki/.gitignore
function cleanup() { function cleanup() {
set +e set +e
pkill -P $$ pkill -P $$
if [ -f "docker-compose.yaml" ]; then if [ -f "docker-compose.yaml" ]; then
docker compose down -t 1 || : docker compose down -t 1 || :
docker compose rm -f || : docker compose rm -f || :
fi fi
} }
trap cleanup EXIT SIGINT trap cleanup EXIT SIGINT
function build_anubis_ko() { function build_anubis_ko() {
( (
cd $REPO_ROOT && npm ci && npm run assets cd $REPO_ROOT && npm ci && npm run assets
) )
( (
cd $REPO_ROOT && cd $REPO_ROOT &&
VERSION=devel ko build \ VERSION=devel ko build \
--platform=all \ --platform=all \
--base-import-paths \ --base-import-paths \
--tags="latest" \ --tags="latest" \
--image-user=1000 \ --image-user=1000 \
--image-annotation="" \ --image-annotation="" \
--image-label="" \ --image-label="" \
./cmd/anubis \ ./cmd/anubis \
--local --local
) )
} }
function mint_cert() { function mint_cert() {
if [ "$#" -ne 1 ]; then if [ "$#" -ne 1 ]; then
echo "Usage: mint_cert <domain.name>" echo "Usage: mint_cert <domain.name>"
fi fi
domainName="$1" domainName="$1"
# If the transient local TLS certificate doesn't exist, mint a new one # If the transient local TLS certificate doesn't exist, mint a new one
if [ ! -f "${REPO_ROOT}/test/pki/${domainName}/cert.pem" ]; then if [ ! -f "./pki/${domainName}/cert.pem" ]; then
# Subshell to contain the directory change # Subshell to contain the directory change
( (
cd ${REPO_ROOT}/test/pki && cd ./pki &&
mkdir -p "${domainName}" && mkdir -p "${domainName}" &&
go tool minica -domains "${domainName}" && go tool minica -domains "${domainName}" &&
cd "${domainName}" && cd "${domainName}" &&
chmod 666 * chmod 666 *
) )
fi fi
} }

View file

@ -1,24 +1,17 @@
#!/usr/bin/env bash #!/usr/bin/env bash
export VERSION=$GITHUB_COMMIT-test
export KO_DOCKER_REPO=ko.local
source ../lib/lib.sh source ../lib/lib.sh
export KO_DOCKER_REPO=ko.local
set -euo pipefail set -euo pipefail
build_anubis_ko
mint_cert mimi.techaro.lol mint_cert mimi.techaro.lol
docker run --rm \ docker run --rm \
-v ./conf/nginx:/etc/nginx:ro \ -v $PWD/conf/nginx:/etc/nginx:ro \
-v ../pki:/techaro/pki:ro \ -v $PWD/pki:/techaro/pki:ro \
nginx \ nginx \
nginx -t nginx -t
docker compose up -d
docker compose down -t 1 || :
docker compose rm -f || :
exit 0 exit 0

View file

@ -26,7 +26,7 @@ services:
KEY_FNAME: key.pem KEY_FNAME: key.pem
PROXY_TO: http://anubis:3000 PROXY_TO: http://anubis:3000
volumes: volumes:
- ../../pki/relayd:/techaro/pki:ro - ./pki/relayd:/techaro/pki:ro
# novnc: # novnc:
# image: geek1011/easy-novnc # image: geek1011/easy-novnc
@ -42,7 +42,7 @@ services:
environment: environment:
DISPLAY: display:0 DISPLAY: display:0
volumes: volumes:
- ../../pki:/usr/local/share/ca-certificates/minica:ro - ./pki:/usr/local/share/ca-certificates/minica:ro
- ../scripts:/hack/scripts:ro - ../scripts:/hack/scripts:ro
depends_on: depends_on:
- anubis - anubis

View file

@ -24,7 +24,7 @@ services:
KEY_FNAME: key.pem KEY_FNAME: key.pem
PROXY_TO: http://anubis:3000 PROXY_TO: http://anubis:3000
volumes: volumes:
- ../../pki/relayd:/techaro/pki:ro - ./pki/relayd:/techaro/pki:ro
# novnc: # novnc:
# image: geek1011/easy-novnc # image: geek1011/easy-novnc
@ -40,5 +40,5 @@ services:
environment: environment:
DISPLAY: display:0 DISPLAY: display:0
volumes: volumes:
- ../../pki:/usr/local/share/ca-certificates/minica:ro - ./pki:/usr/local/share/ca-certificates/minica:ro
- ../scripts:/hack/scripts:ro - ../scripts:/hack/scripts:ro