Skip to content

Commit 1d8e98c

Browse files
XeJasonLovesDoggo
andauthored
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>
1 parent 8800200 commit 1d8e98c

5 files changed

Lines changed: 50 additions & 54 deletions

File tree

test/docker-registry/docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ services:
1414
ports:
1515
- 3004:3004
1616
volumes:
17-
- ../pki/registry.local.cetacean.club:/etc/techaro/pki/registry.local.cetacean.club
17+
- ./pki/registry.local.cetacean.club:/etc/techaro/pki/registry.local.cetacean.club
1818

1919
anubis:
2020
image: ko.local/anubis

test/lib/lib.sh

Lines changed: 41 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,56 @@
11
REPO_ROOT=$(git rev-parse --show-toplevel)
22
(cd $REPO_ROOT && go install ./utils/cmd/...)
33

4+
mkdir -p pki
5+
echo '*' >>./pki/.gitignore
6+
47
function cleanup() {
5-
set +e
8+
set +e
69

7-
pkill -P $$
10+
pkill -P $$
811

9-
if [ -f "docker-compose.yaml" ]; then
10-
docker compose down -t 1 || :
11-
docker compose rm -f || :
12-
fi
12+
if [ -f "docker-compose.yaml" ]; then
13+
docker compose down -t 1 || :
14+
docker compose rm -f || :
15+
fi
1316
}
1417

1518
trap cleanup EXIT SIGINT
1619

1720
function build_anubis_ko() {
18-
(
19-
cd $REPO_ROOT && npm ci && npm run assets
20-
)
21-
(
22-
cd $REPO_ROOT &&
23-
VERSION=devel ko build \
24-
--platform=all \
25-
--base-import-paths \
26-
--tags="latest" \
27-
--image-user=1000 \
28-
--image-annotation="" \
29-
--image-label="" \
30-
./cmd/anubis \
31-
--local
32-
)
21+
(
22+
cd $REPO_ROOT && npm ci && npm run assets
23+
)
24+
(
25+
cd $REPO_ROOT &&
26+
VERSION=devel ko build \
27+
--platform=all \
28+
--base-import-paths \
29+
--tags="latest" \
30+
--image-user=1000 \
31+
--image-annotation="" \
32+
--image-label="" \
33+
./cmd/anubis \
34+
--local
35+
)
3336
}
3437

3538
function mint_cert() {
36-
if [ "$#" -ne 1 ]; then
37-
echo "Usage: mint_cert <domain.name>"
38-
fi
39-
40-
domainName="$1"
41-
42-
# If the transient local TLS certificate doesn't exist, mint a new one
43-
if [ ! -f "${REPO_ROOT}/test/pki/${domainName}/cert.pem" ]; then
44-
# Subshell to contain the directory change
45-
(
46-
cd ${REPO_ROOT}/test/pki &&
47-
mkdir -p "${domainName}" &&
48-
go tool minica -domains "${domainName}" &&
49-
cd "${domainName}" &&
50-
chmod 666 *
51-
)
52-
fi
39+
if [ "$#" -ne 1 ]; then
40+
echo "Usage: mint_cert <domain.name>"
41+
fi
42+
43+
domainName="$1"
44+
45+
# If the transient local TLS certificate doesn't exist, mint a new one
46+
if [ ! -f "./pki/${domainName}/cert.pem" ]; then
47+
# Subshell to contain the directory change
48+
(
49+
cd ./pki &&
50+
mkdir -p "${domainName}" &&
51+
go tool minica -domains "${domainName}" &&
52+
cd "${domainName}" &&
53+
chmod 666 *
54+
)
55+
fi
5356
}

test/nginx/test.sh

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,17 @@
11
#!/usr/bin/env bash
22

3-
export VERSION=$GITHUB_COMMIT-test
4-
export KO_DOCKER_REPO=ko.local
5-
63
source ../lib/lib.sh
74

5+
export KO_DOCKER_REPO=ko.local
6+
87
set -euo pipefail
98

10-
build_anubis_ko
119
mint_cert mimi.techaro.lol
1210

1311
docker run --rm \
14-
-v ./conf/nginx:/etc/nginx:ro \
15-
-v ../pki:/techaro/pki:ro \
12+
-v $PWD/conf/nginx:/etc/nginx:ro \
13+
-v $PWD/pki:/techaro/pki:ro \
1614
nginx \
1715
nginx -t
1816

19-
docker compose up -d
20-
21-
docker compose down -t 1 || :
22-
docker compose rm -f || :
23-
2417
exit 0

test/palemoon/amd64/docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ services:
2626
KEY_FNAME: key.pem
2727
PROXY_TO: http://anubis:3000
2828
volumes:
29-
- ../../pki/relayd:/techaro/pki:ro
29+
- ./pki/relayd:/techaro/pki:ro
3030

3131
# novnc:
3232
# image: geek1011/easy-novnc
@@ -42,7 +42,7 @@ services:
4242
environment:
4343
DISPLAY: display:0
4444
volumes:
45-
- ../../pki:/usr/local/share/ca-certificates/minica:ro
45+
- ./pki:/usr/local/share/ca-certificates/minica:ro
4646
- ../scripts:/hack/scripts:ro
4747
depends_on:
4848
- anubis

test/palemoon/i386/docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ services:
2424
KEY_FNAME: key.pem
2525
PROXY_TO: http://anubis:3000
2626
volumes:
27-
- ../../pki/relayd:/techaro/pki:ro
27+
- ./pki/relayd:/techaro/pki:ro
2828

2929
# novnc:
3030
# image: geek1011/easy-novnc
@@ -40,5 +40,5 @@ services:
4040
environment:
4141
DISPLAY: display:0
4242
volumes:
43-
- ../../pki:/usr/local/share/ca-certificates/minica:ro
43+
- ./pki:/usr/local/share/ca-certificates/minica:ro
4444
- ../scripts:/hack/scripts:ro

0 commit comments

Comments
 (0)