From 41ca21491cbed0a8c4281234bedb262f42a7b4e7 Mon Sep 17 00:00:00 2001 From: Elio Bischof Date: Tue, 5 Aug 2025 17:28:47 +0200 Subject: [PATCH] pipelin --- .../login-acceptance/docker-compose.yaml | 7 +- .../login-integration/docker-compose.yaml | 2 +- .github/workflows/login-acceptance-test.yml | 64 +++++++++++++++++++ .github/workflows/login-integration-test.yml | 10 +-- package.json | 1 + 5 files changed, 76 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/login-acceptance-test.yml diff --git a/.devcontainer/login-acceptance/docker-compose.yaml b/.devcontainer/login-acceptance/docker-compose.yaml index 779073a712..d9c6388da0 100644 --- a/.devcontainer/login-acceptance/docker-compose.yaml +++ b/.devcontainer/login-acceptance/docker-compose.yaml @@ -32,7 +32,7 @@ services: zitadel: container_name: zitadel - image: "${ZITADEL_TAG:-ghcr.io/zitadel/zitadel:v4.0.0-rc.2}" + image: "${ZITADEL_TAG:-zitadel:local}" command: 'start-from-init --masterkey "MasterkeyNeedsToHave32Characters" --config /zitadel.yaml --steps /zitadel.yaml' volumes: - ../../apps/login/acceptance/pat:/pat:delegated @@ -56,7 +56,10 @@ services: login-acceptance: container_name: login - image: "${LOGIN_TAG:-ghcr.io/zitadel/zitadel-login:v4.0.0-rc.2}" + image: "${LOGIN_TAG:-zitadel-login:local}" + build: + context: ../.. + dockerfile: build/login/Dockerfile network_mode: service:zitadel environment: NEXT_PUBLIC_BASE_PATH: /ui/v2/login diff --git a/.devcontainer/login-integration/docker-compose.yaml b/.devcontainer/login-integration/docker-compose.yaml index 44b4891e7e..2fd85f132f 100644 --- a/.devcontainer/login-integration/docker-compose.yaml +++ b/.devcontainer/login-integration/docker-compose.yaml @@ -19,7 +19,7 @@ services: image: "${LOGIN_TAG:-zitadel-login:local}" build: context: ../.. - dockerfile: build/login/Dockerfile + dockerfile: build/login/Dockerfile env_file: ../../apps/login/.env.test network_mode: service:mock-zitadel diff --git a/.github/workflows/login-acceptance-test.yml b/.github/workflows/login-acceptance-test.yml new file mode 100644 index 0000000000..8f53435288 --- /dev/null +++ b/.github/workflows/login-acceptance-test.yml @@ -0,0 +1,64 @@ +name: Acceptance Test Login + +on: + workflow_call: + inputs: + login_build_image: + required: true + type: string + zitadel_build_image: + required: true + type: string + +permissions: + packages: write + +jobs: + login-acceptance-test: + name: login-acceptance-test + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install Dev Container CLI + run: npm install -g @devcontainers/cli@0.80.0 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Pull Login Build Image + run: docker compose --file .devcontainer/login-acceptance/docker-compose.yaml pull + env: + LOGIN_TAG: ${{ inputs.login_build_image }} + ZITADEL_TAG: ${{ inputs.zitadel_build_image }} + - name: Run Integration Tests against the Login and a Mocked Zitadel API + run: npm run devcontainer:acceptance:login + env: + LOGIN_TAG: ${{ inputs.login_build_image }} + ZITADEL_TAG: ${{ inputs.zitadel_build_image }} + DOCKER_BUILDKIT: 1 + - name: Fix Failures + if: failure() + run: | + echo "Reproduce this check locally:" + echo "LOGIN_TAG=${{ inputs.login_build_image }} ZITADEL_TAG=${{ inputs.login_build_image }} npm run devcontainer:acceptance:login" + echo "To fix the failures, open the dev container called \"Login Acceptance\"." + echo "You will have the same environment as the pipeline check as well as some guidance on how to fix the errors." + - name: Show Compose Status + if: failure() + run: docker compose --file .devcontainer/base/docker-compose.yaml --file .devcontainer/login-acceptance/docker-compose.yaml ps + - name: Print Config + if: failure() + run: COMPOSE_BAKE=1 docker compose --file .devcontainer/login-acceptance/docker-compose.yaml config login-acceptance + env: + LOGIN_TAG: ${{ inputs.login_build_image }} + ZITADEL_TAG: ${{ inputs.zitadel_build_image }} + - name: Show Container Logs + if: failure() + run: docker compose --file .devcontainer/login-acceptance/docker-compose.yaml logs --timestamps --no-color --tail 100 login-acceptance + - name: Inspect All Failed Containers + if: failure() + run: | + docker ps -a --filter "status=exited" --filter "status=created" --format "table {{.ID}}\t{{.Names}}\t{{.Status}}\t{{.Image}}" + for container in $(docker ps -a --filter "status=exited" --filter "status=created" -q); do + echo "Inspecting container $container" + docker inspect $container || true + done diff --git a/.github/workflows/login-integration-test.yml b/.github/workflows/login-integration-test.yml index e082d88432..31a203a96a 100644 --- a/.github/workflows/login-integration-test.yml +++ b/.github/workflows/login-integration-test.yml @@ -1,4 +1,4 @@ -name: Integration test core +name: Integration Test Login on: workflow_call: @@ -35,19 +35,19 @@ jobs: run: | echo "Reproduce this check locally:" echo "LOGIN_TAG=${{ inputs.login_build_image }} npm run devcontainer:integration:login" - echo "To fix the failures, open the dev container called \"Login Integration Tests\"." + echo "To fix the failures, open the dev container called \"Login Integration\"." echo "You will have the same environment as the pipeline check as well as some guidance on how to fix the errors." - name: Show Compose Status if: failure() - run: docker compose --file .devcontainer/base/docker-compose.yaml --file .devcontainer/login-integration-ci/docker-compose.yaml ps + run: docker compose --file .devcontainer/login-integration/docker-compose.yaml ps - name: Print Config if: failure() - run: COMPOSE_BAKE=1 docker compose --file .devcontainer/base/docker-compose.yaml --file .devcontainer/login-integration-ci/docker-compose.yaml config login-integration + run: COMPOSE_BAKE=1 docker compose --file .devcontainer/base/docker-compose.yaml --file .devcontainer/login-integration/docker-compose.yaml config login-integration env: LOGIN_TAG: ${{ inputs.login_build_image }} - name: Show Container Logs if: failure() - run: docker compose --file .devcontainer/base/docker-compose.yaml --file .devcontainer/login-integration-ci/docker-compose.yaml logs --timestamps --no-color --tail 100 login-integration + run: docker compose --file .devcontainer/login-integration/docker-compose.yaml logs --timestamps --no-color --tail 100 login-integration - name: Inspect All Failed Containers if: failure() run: | diff --git a/package.json b/package.json index e58164be09..8fe5c1f2d3 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "devcontainer:lint-unit": "FAIL_COMMANDS_ON_ERRORS=true devcontainer up --prebuild --config .devcontainer/turbo-lint-unit/devcontainer.json --workspace-folder .", "devcontainer:integration:login": "FAIL_COMMANDS_ON_ERRORS=true devcontainer up --prebuild --config .devcontainer/login-integration/devcontainer.json --workspace-folder .", "devcontainer:acceptance:login": "FAIL_COMMANDS_ON_ERRORS=true devcontainer up --prebuild --config .devcontainer/login-acceptance/devcontainer.json --workspace-folder .", + "devcontainer:acceptance:login:build": "make docker_image && docker compose --file .devcontainer/login-acceptance/docker-compose.yaml build --pull", "clean": "turbo run clean", "clean:all": "pnpm run clean && rm -rf .turbo node_modules" },