Skip to content

Commit

Permalink
ci: fix test_docker.sh failing due to empty .env (cherry-pick #12876) (
Browse files Browse the repository at this point in the history
…#12877)

ci: fix test_docker.sh failing due to empty .env (#12876)

Co-authored-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
  • Loading branch information
gcp-cherry-pick-bot[bot] and rissson authored Jan 29, 2025
1 parent 22eaf97 commit 35ab51e
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions scripts/test_docker.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
#!/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)"

export PG_PASS=$(openssl rand -base64 36 | tr -d '\n')
export AUTHENTIK_SECRET_KEY=$(openssl rand -base64 60 | tr -d '\n')
export AUTHENTIK_IMAGE="xghcr.io/goauthentik/server"
export AUTHENTIK_TAG=$(echo $hash | cut -c1-15)
AUTHENTIK_TAG="$(echo "$hash" | cut -c1-15)" >.env

if [ -f .env ]; then
echo "Existing .env file, aborting"
exit 1
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="xghcr.io/goauthentik/server" >>.env
echo AUTHENTIK_TAG="${AUTHENTIK_TAG}" >>.env
export COMPOSE_PROJECT_NAME="authentik-test-${AUTHENTIK_TAG}"

# Ensure buildx is installed
Expand All @@ -14,7 +21,7 @@ docker buildx install
mkdir -p ./gen-ts-api
touch .env

docker build -t ${AUTHENTIK_IMAGE}:${AUTHENTIK_TAG} .
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
Expand Down

0 comments on commit 35ab51e

Please sign in to comment.