From 9c2f9707b85e6855d6ce6a2c8b5b5de1ec498521 Mon Sep 17 00:00:00 2001 From: Elio Bischof Date: Tue, 22 Jul 2025 01:23:40 +0200 Subject: [PATCH] swappable integration login --- .devcontainer/Dockerfile | 6 +++-- .devcontainer/devcontainer.json | 4 ++-- .devcontainer/docker-compose.yml | 4 ++-- .../integration-login/devcontainer.json | 23 +++++++++++++++++++ .../integration-login/docker-compose.yml | 14 +++++++++++ .../zitadel.settings.v2.SettingsService.json | 7 ++++++ apps/login/packages/integration/package.json | 6 ++--- 7 files changed, 54 insertions(+), 10 deletions(-) create mode 100644 .devcontainer/integration-login/devcontainer.json create mode 100644 .devcontainer/integration-login/docker-compose.yml diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 2657b394b2..f802e8619f 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/devcontainers/base:ubuntu +FROM mcr.microsoft.com/devcontainers/base:ubuntu AS dev RUN apt-get update @@ -6,4 +6,6 @@ RUN apt-get --no-install-recommends install -y \ libgtk2.0-0t64 libgtk-3-0t64 libgbm-dev libnotify-dev libnss3 libxss1 libasound2t64 libxtst6 xauth xvfb && \ # clean up rm -rf /var/lib/apt/lists/* && \ - apt-get clean \ No newline at end of file + apt-get clean + +RUN pnpm install --recursive --frozen-lockfile . \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index f724ade04e..f1a504b65a 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,5 +1,6 @@ { - "name": "zitadel", + "$schema": "https://raw.githubusercontent.com/devcontainers/spec/refs/heads/main/schemas/devContainer.schema.json", + "name": "devcontainer", "dockerComposeFile": "docker-compose.yml", "service": "devcontainer", "workspaceFolder": "/workspaces", @@ -12,7 +13,6 @@ }, "ghcr.io/guiyomh/features/golangci-lint:0": {}, "ghcr.io/jungaretti/features/make:1": {}, - "ghcr.io/devcontainers/features/docker-outside-of-docker:1": {} }, "forwardPorts": [ 3000, diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 07bb53b7e9..ab1b3617ce 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -12,8 +12,6 @@ services: environment: ZITADEL_DATABASE_POSTGRES_HOST: db ZITADEL_EXTERNALSECURE: false - ports: - - 3001:3001 db: container_name: db @@ -44,6 +42,8 @@ services: login-integration: container_name: login-integration image: "${LOGIN_TAG:-ghcr.io/zitadel/zitadel-login:v4.0.0-rc.2}" + env_file: + - fileName: ../apps/login/apps/login/.env.test volumes: - ../apps/login/apps/login/.env.test:/env-files/.env:cached network_mode: service:devcontainer diff --git a/.devcontainer/integration-login/devcontainer.json b/.devcontainer/integration-login/devcontainer.json new file mode 100644 index 0000000000..303d6380bc --- /dev/null +++ b/.devcontainer/integration-login/devcontainer.json @@ -0,0 +1,23 @@ +{ + "$schema": "https://raw.githubusercontent.com/devcontainers/spec/refs/heads/main/schemas/devContainer.schema.json", + "name": "login", + "dockerComposeFile": [ + "../docker-compose.yml", + "docker-compose.yml" + ], + "service": "devcontainer", + "workspaceFolder": "/workspaces", + "features": { + "ghcr.io/devcontainers/features/node:1": { + "version": "lts/iron" + } + }, + "forwardPorts": [3001], + "customizations": { + "jetbrains": { + "settings": { + "com.intellij:app:HttpConfigurable.use_proxy_pac": true + } + } + } +} diff --git a/.devcontainer/integration-login/docker-compose.yml b/.devcontainer/integration-login/docker-compose.yml new file mode 100644 index 0000000000..16f8558603 --- /dev/null +++ b/.devcontainer/integration-login/docker-compose.yml @@ -0,0 +1,14 @@ +services: + login-integration: + extends: + file: ../docker-compose.yml + service: devcontainer + container_name: login-integration + command: pnpm turbo @zitadel/login#dev + network_mode: service:devcontainer + environment: + NODE_ENV: 'test' + PORT: 3001 + depends_on: + mock-zitadel: + condition: service_started diff --git a/apps/login/packages/integration/core-mock/initial-stubs/zitadel.settings.v2.SettingsService.json b/apps/login/packages/integration/core-mock/initial-stubs/zitadel.settings.v2.SettingsService.json index 3da4ae999f..50583cb3c6 100644 --- a/apps/login/packages/integration/core-mock/initial-stubs/zitadel.settings.v2.SettingsService.json +++ b/apps/login/packages/integration/core-mock/initial-stubs/zitadel.settings.v2.SettingsService.json @@ -55,5 +55,12 @@ } } } + }, + { + "service": "zitadel.settings.v2.SettingsService", + "method": "GetHostedLoginTranslations", + "out": { + "data": {} + } } ] diff --git a/apps/login/packages/integration/package.json b/apps/login/packages/integration/package.json index 1b9e13f106..78dc694819 100644 --- a/apps/login/packages/integration/package.json +++ b/apps/login/packages/integration/package.json @@ -1,10 +1,8 @@ { "name": "login-test-integration", - "private": true, - "type": "module", + "private": true, "scripts": { - "test:integration": "DISPLAY='' dotenv -e ../../apps/login/.env.test cypress", - "test:integration:setup": "cd .. && make login_test_integration_dev" + "test:integration": "DISPLAY='' dotenv -e ../../apps/login/.env.test cypress" }, "devDependencies": { "@types/node": "^22.14.1",