compose works until e2e-setup incl

This commit is contained in:
Elio Bischof 2022-07-25 15:24:16 +02:00
parent 1f955ae3ac
commit e3942a0d9e
No known key found for this signature in database
GPG Key ID: 7B383FDE4DDBF1BD
11 changed files with 62 additions and 27 deletions

View File

@ -6,6 +6,7 @@
**/Dockerfile
/k8s/
/docs/
!/docs/docs/guides/installation/run/docker-compose.yaml
/console/node_modules/
/console/src/app/proto/generated/
/console/tmp/

View File

@ -10,6 +10,7 @@ release:
before:
hooks:
- docker build -f build/grpc/Dockerfile -t zitadel-base:local .
- docker build -f build/zitadel/Dockerfile . -t zitadel-test-base --target go-test
- docker build -f build/zitadel/Dockerfile . -t zitadel-go-test --target go-codecov -o .artifacts/codecov
- docker build -f build/zitadel/Dockerfile . -t zitadel-go-base --target go-copy -o .artifacts/grpc/go-client
- sh -c "cp -r .artifacts/grpc/go-client/* ."

View File

@ -1,11 +1,12 @@
ARG GO_VERSION=1.17
#######################
## run initialize setup step for ZITADEL tests
#######################
FROM golang:${GO_VERSION}
WORKDIR /go/src/github.com/zitadel/zitadel
FROM zitadel-test-base
# Invalidate caches when only test code changes
COPY ./docs/docs/guides/installation/run/docker-compose.yaml ./docs/docs/guides/installation/run/docker-compose.yaml
COPY ./cmd/e2e-setup ./cmd/e2e-setup
COPY ./e2e ./e2e
# copy setup
COPY . .
RUN e2e/e2e-setup-compose.sh
CMD e2e/e2e-setup.sh

View File

@ -8,7 +8,11 @@ shift
export projectRoot=".."
set -a; source $ENVFILE; set +a
if [ -z ${ENVFILE:x} ]; then
echo "Not sourcing any env file"
else
set -a; source $ENVFILE; set +a
fi
NPX=""
if ! command -v cypress &> /dev/null; then

View File

@ -8,5 +8,5 @@ ZITADEL_E2E_LOGINPOLICYUSERPW=Password1!
ZITADEL_E2E_MACHINEKEYPATH="${projectRoot}/.keys/e2e.json"
ZITADEL_E2E_BASEURL="http://zitadel:8080"
ZITADEL_E2E_OTHERZITADELIDPINSTANCE=false
ZITADEL_E2E_ZITADELPROJECTRESOURCEID="bignumber-$(echo -n $(${projectRoot}/e2e/docker-compose.sh exec --no-TTY db cockroach sql --database zitadel --insecure --execute "select aggregate_id from eventstore.events where event_type = 'project.added' and event_data = '{\"name\": \"ZITADEL\"}';" --format tsv) | cut -d " " -f 2)"
ZITADEL_E2E_INSTANCEID="$(echo -n $(${projectRoot}/e2e/docker-compose.sh exec --no-TTY db cockroach sql --database zitadel --insecure --execute "select aggregate_id from eventstore.events where event_type = 'instance.added' and event_data = '{\"name\": \"Localhost\"}';" --format tsv) | cut -d " " -f 2)"
ZITADEL_EXTERNALDOMAIN=zitadel
ZITADEL_S3DEFAULTINSTANCE_CUSTOMDOMAIN=zitadel

View File

@ -1,12 +1,37 @@
services:
zitadel:
image: 'zitadel:${BUILD_DATE}'
environment:
# TODO: ugly
ZITADEL_EXTERNALDOMAIN: zitadel
ZITADEL_S3DEFAULTINSTANCE_CUSTOMDOMAIN: zitadel
e2e-setup:
command: ./e2e/e2e-setup.sh
build:
dockerfile: ./build/e2e/Dockerfile
context: ..
container_name: e2e-setup
env_file:
- ./compose.env
environment:
ZITADEL_DATABASE_HOST: db
depends_on:
zitadel:
condition: service_started
networks:
- 'zitadel'
# TODO: See PR #3816
# condition: 'service_healthy'
e2e:
image: cypress/included:10.3.0
#build: ./e2e
container_name: cypress
depends_on:
- zitadel
e2e-setup:
condition: 'service_completed_successfully'
command: ./cypress.sh run
# note: inside e2e container, the network allows accessing
# "zitadel" host under name "zitadel"
# so "curl http://web" would return whatever the webserver
@ -25,5 +50,6 @@ services:
# rebuild required).
working_dir: /e2e
volumes:
- /Users/christianjakob/caos/internal/zitadel/console:/e2e
# - ./console/cypress.config.js:/e2e/cypress.config.js
- ./console:/e2e
networks:
- 'zitadel'

View File

@ -0,0 +1,5 @@
# By using this file as first --file argument to docker compose, compose uses this directory as working directory
version: '3.8'

View File

@ -1,3 +1,3 @@
#!/bin/bash
COMPOSE_DOCKER_CLI_BUILD=1 docker compose --file ${projectRoot}/docs/docs/guides/installation/run/docker-compose.yaml --file ${projectRoot}/e2e/docker-compose-overwrite.yaml "$@"
COMPOSE_DOCKER_CLI_BUILD=1 docker compose --file ${projectRoot}/e2e/docker-compose-workdir.yaml --file ${projectRoot}/docs/docs/guides/installation/run/docker-compose.yaml --file ${projectRoot}/e2e/docker-compose-overwrite.yaml --env-file ${projectRoot}/e2e/compose.env "$@"

View File

@ -1,11 +0,0 @@
#!/bin/bash
set -ex
export projectRoot="."
set -a
source ./e2e/compose.env
set +a
go run ./cmd/e2e-setup/*.go "$@"

View File

@ -4,8 +4,14 @@ set -ex
export projectRoot="."
set -a
source ./e2e/local.env
set +a
ENVFILE=$1
if [ -z ${ENVFILE:x} ]; then
echo "Not sourcing any env file"
else
set -a; source $ENVFILE; set +a
fi
env
go run ./cmd/e2e-setup/*.go "$@"

View File

@ -1,5 +1,7 @@
#!/bin/bash
# TODO: ONLY BUILD HERE AND PRINT BUILT IMAGE TO STDOUT?
set -e
export projectRoot="."