Files
authentik/scripts/test_docker.sh
authentik-cherry-pick[bot] 77d7857302 ci: release tag: fix test docker compose project name (cherry-pick #24583 to main) (#24584)
Co-authored-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
2026-07-31 16:45:55 +00:00

32 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e -x -o pipefail
hash="$(git rev-parse HEAD || openssl rand -base64 36 | sha256sum)"
AUTHENTIK_IMAGE="${AUTHENTIK_IMAGE:-authentik.invalid/goauthentik/server}"
AUTHENTIK_TAG="${AUTHENTIK_TAG:-$(echo "$hash" | cut -c1-15)}"
if [ -f lifecycle/container/.env ]; then
echo "Existing .env file, aborting"
exit 1
fi
echo PG_PASS="$(openssl rand -base64 36 | tr -d '\n')" >lifecycle/container/.env
echo AUTHENTIK_SECRET_KEY="$(openssl rand -base64 60 | tr -d '\n')" >>lifecycle/container/.env
export COMPOSE_PROJECT_NAME="${COMPOSE_PROJECT_NAME:-authentik-test-${AUTHENTIK_TAG}}"
if [[ -v BUILD ]]; then
echo AUTHENTIK_IMAGE="${AUTHENTIK_IMAGE}" >>lifecycle/container/.env
echo AUTHENTIK_TAG="${AUTHENTIK_TAG}" >>lifecycle/container/.env
# Ensure buildx is installed
docker buildx install
touch lifecycle/container/.env
docker build -t "${AUTHENTIK_IMAGE}:${AUTHENTIK_TAG}" -f lifecycle/container/Dockerfile .
fi
docker compose -f lifecycle/container/compose.yml up --no-start
docker compose -f lifecycle/container/compose.yml start postgresql
docker compose -f lifecycle/container/compose.yml run -u root server test-all
docker compose -f lifecycle/container/compose.yml down -v