Merge commit 'e7bce8a1d236af1a88c53dc8cbe03cc78bf59870' into integrate-login

This commit is contained in:
Elio Bischof
2025-06-23 23:39:11 +02:00
2 changed files with 39 additions and 34 deletions

View File

@@ -1,10 +1,11 @@
XDG_CACHE_HOME ?= $(HOME)/.cache XDG_CACHE_HOME ?= $(HOME)/.cache
export CACHE_DIR ?= $(XDG_CACHE_HOME)/zitadel-make export CACHE_DIR ?= $(XDG_CACHE_HOME)/zitadel-make
export LOGIN_DIR := $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))) LOGIN_DIR ?= ./
LOGIN_BAKE_CLI ?= docker buildx bake
export LOGIN_BAKE_CLI ?= docker buildx bake
LOGIN_BAKE_CLI_WITH_COMMON_ARGS := $(LOGIN_BAKE_CLI) --file $(LOGIN_DIR)docker-bake.hcl --file $(LOGIN_DIR)apps/login-test-acceptance/docker-compose.yaml LOGIN_BAKE_CLI_WITH_COMMON_ARGS := $(LOGIN_BAKE_CLI) --file $(LOGIN_DIR)docker-bake.hcl --file $(LOGIN_DIR)apps/login-test-acceptance/docker-compose.yaml
LOGIN_BAKE_CLI_ADDITIONAL_ARGS ?=
LOGIN_BAKE_CLI_WITH_COMMON_ARGS += $(LOGIN_BAKE_CLI_ADDITIONAL_ARGS)
export COMPOSE_BAKE=true export COMPOSE_BAKE=true
export UID := $(id -u) export UID := $(id -u)
@@ -26,7 +27,7 @@ export LOGIN_TEST_ACCEPTANCE_SAMLIDP_TAG := login-test-acceptance-samlidp:${DOCK
export POSTGRES_TAG := postgres:17.0-alpine3.19 export POSTGRES_TAG := postgres:17.0-alpine3.19
export GOLANG_TAG := golang:1.24-alpine export GOLANG_TAG := golang:1.24-alpine
export ZITADEL_TAG ?= ghcr.io/zitadel/zitadel:v3.3.0 export ZITADEL_TAG ?= ghcr.io/zitadel/zitadel:v3.3.0
export CORE_MOCK_TAG := core-mock:${DOCKER_METADATA_OUTPUT_VERSION} export CORE_MOCK_TAG := login-core-mock:${DOCKER_METADATA_OUTPUT_VERSION}
.PHONY: login-help .PHONY: login-help
login-help: login-help:
@@ -49,10 +50,10 @@ login-test-unit:
$(LOGIN_BAKE_CLI_WITH_COMMON_ARGS) login-test-unit $(LOGIN_BAKE_CLI_WITH_COMMON_ARGS) login-test-unit
login-test-integration-build: login-test-integration-build:
$(LOGIN_BAKE_CLI_WITH_COMMON_ARGS) core-mock login-test-integration login-standalone $(LOGIN_BAKE_CLI_WITH_COMMON_ARGS) login-core-mock login-test-integration login-standalone
login-test-integration-dev: login-test-integration-cleanup login-test-integration-dev: login-test-integration-cleanup
$(LOGIN_BAKE_CLI_WITH_COMMON_ARGS) core-mock && docker compose --file $(LOGIN_DIR)apps/login-test-integration/docker-compose.yaml run --service-ports --rm core-mock $(LOGIN_BAKE_CLI_WITH_COMMON_ARGS) login-core-mock && docker compose --file $(LOGIN_DIR)apps/login-test-integration/docker-compose.yaml run --service-ports --rm login-core-mock
login-test-integration-run: login-test-integration-cleanup login-test-integration-run: login-test-integration-cleanup
docker compose --file $(LOGIN_DIR)apps/login-test-integration/docker-compose.yaml run --rm integration docker compose --file $(LOGIN_DIR)apps/login-test-integration/docker-compose.yaml run --rm integration

View File

@@ -1,19 +1,40 @@
variable "LOGIN_DIR" {
default = "./"
}
variable "DOCKERFILES_DIR" { variable "DOCKERFILES_DIR" {
default = "dockerfiles/" default = "dockerfiles/"
} }
# typescript-proto-client is used to generate the client code for the login service.
# It is not login-prefixed, so it is easily extendable.
# To extend this bake-file.hcl, set the context of all login-prefixed targets to a different directory.
# For example docker bake --file login/docker-bake.hcl --file docker-bake.hcl --set login-*.context=./login/
# The zitadel repository uses this to generate the client and the mock server from local proto files.
target "typescript-proto-client" {
dockerfile = "${DOCKERFILES_DIR}typescript-proto-client.Dockerfile"
contexts = {
# We directly generate and download the client server-side with buf, so we don't need the proto files
login-pnpm = "target:login-pnpm"
}
output = ["type=docker"]
}
# proto-files is only used to build login-core-mock against which the integration tests run.
# To build the proto-client, we use buf to generate and download the client code directly.
# It is not login-prefixed, so it is easily extendable.
# To extend this bake-file.hcl, set the context of all login-prefixed targets to a different directory.
# For example docker bake --file login/docker-bake.hcl --file docker-bake.hcl --set login-*.context=./login/
# The zitadel repository uses this to generate the client and the mock server from local proto files.
target "proto-files" {
dockerfile = "${DOCKERFILES_DIR}proto-files.Dockerfile"
contexts = {
login-pnpm = "target:login-pnpm"
}
}
target "login-pnpm" { target "login-pnpm" {
context = "${LOGIN_DIR}"
dockerfile = "${DOCKERFILES_DIR}login-pnpm.Dockerfile" dockerfile = "${DOCKERFILES_DIR}login-pnpm.Dockerfile"
} }
target "login-dev-base" { target "login-dev-base" {
dockerfile = "${DOCKERFILES_DIR}login-dev-base.Dockerfile" dockerfile = "${DOCKERFILES_DIR}login-dev-base.Dockerfile"
context = "${LOGIN_DIR}"
contexts = { contexts = {
login-pnpm = "target:login-pnpm" login-pnpm = "target:login-pnpm"
} }
@@ -21,7 +42,6 @@ target "login-dev-base" {
target "login-lint" { target "login-lint" {
dockerfile = "${DOCKERFILES_DIR}login-lint.Dockerfile" dockerfile = "${DOCKERFILES_DIR}login-lint.Dockerfile"
context = "${LOGIN_DIR}"
contexts = { contexts = {
login-dev-base = "target:login-dev-base" login-dev-base = "target:login-dev-base"
} }
@@ -29,7 +49,6 @@ target "login-lint" {
target "login-test-unit" { target "login-test-unit" {
dockerfile = "${DOCKERFILES_DIR}login-test-unit.Dockerfile" dockerfile = "${DOCKERFILES_DIR}login-test-unit.Dockerfile"
context = "${LOGIN_DIR}"
contexts = { contexts = {
login-client = "target:login-client" login-client = "target:login-client"
} }
@@ -37,7 +56,6 @@ target "login-test-unit" {
target "login-client" { target "login-client" {
dockerfile = "${DOCKERFILES_DIR}login-client.Dockerfile" dockerfile = "${DOCKERFILES_DIR}login-client.Dockerfile"
context = "${LOGIN_DIR}"
contexts = { contexts = {
login-pnpm = "target:login-pnpm" login-pnpm = "target:login-pnpm"
typescript-proto-client = "target:typescript-proto-client" typescript-proto-client = "target:typescript-proto-client"
@@ -46,7 +64,6 @@ target "login-client" {
target "typescript-proto-client" { target "typescript-proto-client" {
dockerfile = "${DOCKERFILES_DIR}typescript-proto-client.Dockerfile" dockerfile = "${DOCKERFILES_DIR}typescript-proto-client.Dockerfile"
context = "${LOGIN_DIR}"
contexts = { contexts = {
# We directly generate and download the client server-side with buf, so we don't need the proto files # We directly generate and download the client server-side with buf, so we don't need the proto files
login-pnpm = "target:login-pnpm" login-pnpm = "target:login-pnpm"
@@ -54,26 +71,16 @@ target "typescript-proto-client" {
output = ["type=docker"] output = ["type=docker"]
} }
# proto-files is only used to build core-mock against which the integration tests run. variable "LOGIN_CORE_MOCK_TAG" {
# To build the proto-client, we use buf to generate and download the client code directly. default = "login-core-mock:local"
target "proto-files" {
dockerfile = "${DOCKERFILES_DIR}proto-files.Dockerfile"
context = "${LOGIN_DIR}"
contexts = {
login-pnpm = "target:login-pnpm"
}
} }
variable "CORE_MOCK_TAG" { target "login-core-mock" {
default = "core-mock:local" context = "/apps/login-test-integration/core-mock"
}
target "core-mock" {
context = "${LOGIN_DIR}apps/login-test-integration/core-mock"
contexts = { contexts = {
protos = "target:proto-files" protos = "target:proto-files"
} }
tags = ["${CORE_MOCK_TAG}"] tags = ["${LOGIN_CORE_MOCK_TAG}"]
output = ["type=docker"] output = ["type=docker"]
} }
@@ -83,7 +90,6 @@ variable "LOGIN_TEST_INTEGRATION_TAG" {
target "login-test-integration" { target "login-test-integration" {
dockerfile = "${DOCKERFILES_DIR}login-test-integration.Dockerfile" dockerfile = "${DOCKERFILES_DIR}login-test-integration.Dockerfile"
context = "${LOGIN_DIR}"
contexts = { contexts = {
login-pnpm = "target:login-pnpm" login-pnpm = "target:login-pnpm"
} }
@@ -97,7 +103,6 @@ variable "LOGIN_TEST_ACCEPTANCE_TAG" {
target "login-test-acceptance" { target "login-test-acceptance" {
dockerfile = "${DOCKERFILES_DIR}login-test-acceptance.Dockerfile" dockerfile = "${DOCKERFILES_DIR}login-test-acceptance.Dockerfile"
context = "${LOGIN_DIR}"
contexts = { contexts = {
login-pnpm = "target:login-pnpm" login-pnpm = "target:login-pnpm"
} }
@@ -115,7 +120,6 @@ target "docker-metadata-action" {}
target "login-standalone" { target "login-standalone" {
inherits = ["docker-metadata-action"] inherits = ["docker-metadata-action"]
dockerfile = "${DOCKERFILES_DIR}login-standalone.Dockerfile" dockerfile = "${DOCKERFILES_DIR}login-standalone.Dockerfile"
context = "${LOGIN_DIR}"
contexts = { contexts = {
login-client = "target:login-client" login-client = "target:login-client"
} }