This commit is contained in:
Elio Bischof
2025-06-18 11:54:33 +02:00
parent 6d0bc3583f
commit b3dac52ded
4 changed files with 35 additions and 53 deletions

View File

@@ -31,15 +31,11 @@ jobs:
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- uses: depot/setup-action@v1
- uses: depot/bake-action@v1
with:
project: jp837jn3fm
push: false
targets: login-lint,login-test-unit,login-test-integration,login-test-acceptance
files: |
docker-bake.hcl
docker-bake-ci.hcl
oidc: true
- run: make login-quality-ci
env:
# latest if branch is main, otherwise image version which is the pull request number
BUILD_CACHE_KEY: ${{ github.ref == 'refs/heads/main' && 'latest' || fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
- run: make login-quality
BUILDX_CLI: depot
DEPOT_PROJECT_ID: jp837jn3fm
REF_TAG: ${{ github.ref == 'refs/heads/main' && 'latest' || fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}

View File

@@ -1,21 +1,23 @@
XDG_CACHE_HOME ?= $(HOME)/.cache
export CACHE_DIR ?= $(XDG_CACHE_HOME)/zitadel-make
export LOGIN_TAG ?= login:local
export LOGIN_TEST_UNIT_TAG := login-test-unit:local
export LOGIN_TEST_INTEGRATION_TAG ?= login-test-integration:local
export LOGIN_TEST_ACCEPTANCE_TAG := login-test-acceptance:local
export LOGIN_TEST_ACCEPTANCE_SETUP_TAG := login-test-acceptance-setup:local
export LOGIN_TEST_ACCEPTANCE_SINK_TAG := login-test-acceptance-sink:local
export LOGIN_TEST_ACCEPTANCE_OIDCRP_TAG := login-test-acceptance-oidcrp:local
export LOGIN_TEST_ACCEPTANCE_OIDCOP_TAG := login-test-acceptance-oidcop:local
export LOGIN_TEST_ACCEPTANCE_SAMLSP_TAG := login-test-acceptance-samlsp:local
export LOGIN_TEST_ACCEPTANCE_SAMLIDP_TAG := login-test-acceptance-samlidp:local
export BUILDX_CLI ?= docker buildx
export REF_TAG ?= local
export LOGIN_TAG := login:${REF_TAG}
export LOGIN_TEST_UNIT_TAG := login-test-unit:${REF_TAG}
export LOGIN_TEST_INTEGRATION_TAG ?= login-test-integration:${REF_TAG}
export LOGIN_TEST_ACCEPTANCE_TAG := login-test-acceptance:${REF_TAG}
export LOGIN_TEST_ACCEPTANCE_SETUP_TAG := login-test-acceptance-setup:${REF_TAG}
export LOGIN_TEST_ACCEPTANCE_SINK_TAG := login-test-acceptance-sink:${REF_TAG}
export LOGIN_TEST_ACCEPTANCE_OIDCRP_TAG := login-test-acceptance-oidcrp:${REF_TAG}
export LOGIN_TEST_ACCEPTANCE_OIDCOP_TAG := login-test-acceptance-oidcop:${REF_TAG}
export LOGIN_TEST_ACCEPTANCE_SAMLSP_TAG := login-test-acceptance-samlsp:${REF_TAG}
export LOGIN_TEST_ACCEPTANCE_SAMLIDP_TAG := login-test-acceptance-samlidp:${REF_TAG}
export POSTGRES_TAG := postgres:17.0-alpine3.19
export GOLANG_TAG := golang:1.24-alpine
# TODO: use ghcr.io/zitadel/zitadel:latest
export ZITADEL_TAG ?= ghcr.io/zitadel/zitadel:02617cf17fdde849378c1a6b5254bbfb2745b164
export CORE_MOCK_TAG := core-mock:local
export CORE_MOCK_TAG := core-mock:${REF_TAG}
.PHONY: login-help
login-help:
@@ -31,30 +33,14 @@ login-help:
@echo " show-cache-keys - Show all cache keys with image ids and exit codes."
@echo " clean-cache-keys - Remove all cache keys."
login-lint-build:
docker buildx bake login-lint
login-lint:
$(BUILDX_CLI) bake login-lint
login-lint-run:
docker run --rm $(LOGIN_LINT_TAG) lint
docker run --rm $(LOGIN_LINT_TAG) format --check
.PHONY: login-lint
login-lint: login-lint-build
# ./scripts/run_or_skip.sh login-lint-run $(LOGIN_LINT_TAG)
login-test-unit-build:
docker buildx bake login-test-unit
login-test-unit-run:
docker run --rm $(LOGIN_TEST_UNIT_TAG) test:unit:standalone
.PHONY: login-test-unit
login-test-unit: login-test-unit-build
./scripts/run_or_skip.sh login-test-unit-run $(LOGIN_TEST_UNIT_TAG)
login-test-unit:
$(BUILDX_CLI) bake login-test-unit
login-test-integration-build:
docker buildx bake core-mock
docker buildx bake login-test-integration
$(BUILDX_CLI) bake core-mock login-test-integration
login-test-integration-run: login-test-integration-cleanup
docker compose --file ./apps/login-test-integration/docker-compose.yaml run --rm integration
@@ -71,8 +57,7 @@ login-test-integration: login-standalone-build login-test-integration-build
login-test-acceptance-build:
COMPOSE_BAKE=true docker compose --file ./apps/login-test-acceptance/docker-compose.yaml build
docker buildx bake login-standalone
docker buildx bake login-test-acceptance
$(BUILDX_CLI) bake login-standalone login-test-acceptance
login-test-acceptance-run: login-acceptance-cleanup
docker compose --file ./apps/login-test-acceptance/docker-compose.yaml run --rm --service-ports acceptance
@@ -100,7 +85,7 @@ login-quality: login-lint login-test-unit login-test-integration login-test-acce
.PHONY: login-standalone-build
login-standalone-build:
docker buildx bake login-standalone
$(BUILDX_CLI) bake login-standalone
.PHONY: clean-cache-keys
clean-cache-keys:

View File

@@ -4,13 +4,13 @@ variable "IMAGE_REGISTRY" {
default = "ghcr.io/zitadel"
}
variable "BUILD_CACHE_KEY" {
variable "REF_TAG" {
default = "local"
}
target "login-pnpm" {
cache-from = [
{ "type": "registry", "ref": "${IMAGE_REGISTRY}/login-pnpm-buildcache:${BUILD_CACHE_KEY}" },
{ "type": "registry", "ref": "${IMAGE_REGISTRY}/login-pnpm-buildcache:${REF_TAG}" },
{ "type": "registry", "ref": "${IMAGE_REGISTRY}/login-pnpm-buildcache:latest" },
]
dockerfile = "dockerfiles/login-pnpm.Dockerfile"
@@ -18,7 +18,7 @@ target "login-pnpm" {
target "login-dev-base" {
cache-from = [
{"type": "registry", "ref": "${IMAGE_REGISTRY}/login-dev-base-buildcache:${BUILD_CACHE_KEY}"},
{"type": "registry", "ref": "${IMAGE_REGISTRY}/login-dev-base-buildcache:${REF_TAG}"},
{"type": "registry", "ref": "${IMAGE_REGISTRY}/login-dev-base-buildcache:latest"},
]
dockerfile = "dockerfiles/login-dev-base.Dockerfile"
@@ -29,7 +29,7 @@ target "login-dev-base" {
target "login-lint" {
cache-from = [
{"type": "registry", "ref": "${IMAGE_REGISTRY}/login-lint-buildcache:${BUILD_CACHE_KEY}"},
{"type": "registry", "ref": "${IMAGE_REGISTRY}/login-lint-buildcache:${REF_TAG}"},
{"type": "registry", "ref": "${IMAGE_REGISTRY}/login-lint-buildcache:latest"},
]
dockerfile = "dockerfiles/login-lint.Dockerfile"
@@ -40,7 +40,7 @@ target "login-lint" {
target "login-test-unit" {
cache-from = [
{"type": "registry", "ref": "${IMAGE_REGISTRY}/login-test-unit-buildcache:${BUILD_CACHE_KEY}"},
{"type": "registry", "ref": "${IMAGE_REGISTRY}/login-test-unit-buildcache:${REF_TAG}"},
{"type": "registry", "ref": "${IMAGE_REGISTRY}/login-test-unit-buildcache:latest"},
]
dockerfile = "dockerfiles/login-test-unit.Dockerfile"
@@ -51,7 +51,7 @@ target "login-test-unit" {
target "login-client" {
cache-from = [
{"type": "registry", "ref": "${IMAGE_REGISTRY}/login-client-buildcache:${BUILD_CACHE_KEY}"},
{"type": "registry", "ref": "${IMAGE_REGISTRY}/login-client-buildcache:${REF_TAG}"},
{"type": "registry", "ref": "${IMAGE_REGISTRY}/login-client-buildcache:latest"},
]
dockerfile = "dockerfiles/login-client.Dockerfile"
@@ -97,7 +97,7 @@ variable "LOGIN_TEST_INTEGRATION_TAG" {
target "login-test-integration" {
cache-from = [
{"type": "registry", "ref": "${IMAGE_REGISTRY}/login-test-integration-buildcache:${BUILD_CACHE_KEY}"},
{"type": "registry", "ref": "${IMAGE_REGISTRY}/login-test-integration-buildcache:${REF_TAG}"},
{"type": "registry", "ref": "${IMAGE_REGISTRY}/login-test-integration-buildcache:latest"},
]
dockerfile = "dockerfiles/login-test-integration.Dockerfile"
@@ -114,7 +114,7 @@ variable "LOGIN_TEST_ACCEPTANCE_TAG" {
target "login-test-acceptance" {
cache-from = [
{"type": "registry", "ref": "${IMAGE_REGISTRY}/login-test-acceptance-buildcache:${BUILD_CACHE_KEY}"},
{"type": "registry", "ref": "${IMAGE_REGISTRY}/login-test-acceptance-buildcache:${REF_TAG}"},
{"type": "registry", "ref": "${IMAGE_REGISTRY}/login-test-acceptance-buildcache:latest"},
]
dockerfile = "dockerfiles/login-test-acceptance.Dockerfile"
@@ -132,7 +132,7 @@ variable "LOGIN_TAG" {
# We run integration and acceptance tests against the next standalone server for docker.
target "login-standalone" {
cache-from = [
{"type": "registry", "ref": "${IMAGE_REGISTRY}/login-buildcache:${BUILD_CACHE_KEY}"},
{"type": "registry", "ref": "${IMAGE_REGISTRY}/login-buildcache:${REF_TAG}"},
{"type": "registry", "ref": "${IMAGE_REGISTRY}/login-buildcache:latest"},
]
dockerfile = "dockerfiles/login-standalone.Dockerfile"

View File

@@ -3,3 +3,4 @@ COPY apps/login/package.json ./apps/login/
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
pnpm install --frozen-lockfile --workspace-root --filter zitadel-client
COPY apps/login ./apps/login
RUN pnpm test:unit:standalone