From a9336423b59af17757444ed5bce99753fd078f44 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Fri, 31 Jan 2025 01:06:15 +0100 Subject: [PATCH 1/2] ci: fix daily container test fallback id generation Signed-off-by: Jens Langhammer --- scripts/test_docker.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/test_docker.sh b/scripts/test_docker.sh index eb99d8d0db58..b74ee8b33e70 100755 --- a/scripts/test_docker.sh +++ b/scripts/test_docker.sh @@ -1,6 +1,6 @@ #!/bin/bash set -e -x -o pipefail -hash="$(git rev-parse HEAD || openssl rand -base64 36)" +hash="$(git rev-parse HEAD || openssl rand -base64 36 | sha256sum)" AUTHENTIK_IMAGE="xghcr.io/goauthentik/server" AUTHENTIK_TAG="$(echo "$hash" | cut -c1-15)" From 64be9f31f4520f528f3fe0d48b83043ed5f31f82 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Fri, 31 Jan 2025 01:27:24 +0100 Subject: [PATCH 2/2] only attempt to build images when needed Signed-off-by: Jens Langhammer --- Makefile | 2 +- scripts/test_docker.sh | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index aa802c69b251..07d769f784df 100644 --- a/Makefile +++ b/Makefile @@ -255,7 +255,7 @@ docker: ## Build a docker image of the current source tree DOCKER_BUILDKIT=1 docker build . --progress plain --tag ${DOCKER_IMAGE} test-docker: - ./scripts/test_docker.sh + BUILD=true ./scripts/test_docker.sh ######################### ## CI diff --git a/scripts/test_docker.sh b/scripts/test_docker.sh index b74ee8b33e70..72a42da0862f 100755 --- a/scripts/test_docker.sh +++ b/scripts/test_docker.sh @@ -12,17 +12,21 @@ fi echo PG_PASS="$(openssl rand -base64 36 | tr -d '\n')" >.env echo AUTHENTIK_SECRET_KEY="$(openssl rand -base64 60 | tr -d '\n')" >>.env -echo AUTHENTIK_IMAGE="${AUTHENTIK_IMAGE}" >>.env -echo AUTHENTIK_TAG="${AUTHENTIK_TAG}" >>.env export COMPOSE_PROJECT_NAME="authentik-test-${AUTHENTIK_TAG}" -# Ensure buildx is installed -docker buildx install -# For release builds we have an empty client here as we use the NPM package -mkdir -p ./gen-ts-api -touch .env +if [[ -v BUILD ]]; then + echo AUTHENTIK_IMAGE="${AUTHENTIK_IMAGE}" >>.env + echo AUTHENTIK_TAG="${AUTHENTIK_TAG}" >>.env + + # Ensure buildx is installed + docker buildx install + # For release builds we have an empty client here as we use the NPM package + mkdir -p ./gen-ts-api + touch .env + + docker build -t "${AUTHENTIK_IMAGE}:${AUTHENTIK_TAG}" . +fi -docker build -t "${AUTHENTIK_IMAGE}:${AUTHENTIK_TAG}" . docker compose up --no-start docker compose start postgresql redis docker compose run -u root server test-all