diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7a91ba0297..2aa01f28e6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -43,7 +43,7 @@ jobs: - run: make login-quality env: # latest if branch is main, otherwise image version which is the pull request number - BAKE_CLI: depot bake --file docker-bake.hcl --file docker-bake-ci.hcl + BAKE_CLI: depot bake --file docker-bake.hcl --file docker-bake-ci.hcl --file ./apps/login-test-acceptance/docker-compose.yaml --file ./apps/login-test-acceptance/docker-compose-ci.yaml DEPOT_PROJECT_ID: jp837jn3fm REF_TAG: ${{ github.ref == 'refs/heads/main' && 'latest' || fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }} CACHE_DIR: ${{ runner.temp }}/login-make-cache diff --git a/Makefile b/Makefile index 89479bb463..f48e3729fd 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ XDG_CACHE_HOME ?= $(HOME)/.cache export CACHE_DIR ?= $(XDG_CACHE_HOME)/zitadel-make -export BAKE_CLI ?= docker buildx bake --file ./docker-bake.hcl +export BAKE_CLI ?= docker buildx bake --file ./docker-bake.hcl --file ./apps/login-test-acceptance/docker-compose.yaml export REF_TAG ?= local export LOGIN_TAG := login:${REF_TAG} export LOGIN_TEST_UNIT_TAG := login-test-unit:${REF_TAG} @@ -35,13 +35,13 @@ login-help: @echo " clean-cache-keys - Remove all cache keys." login-lint: - $(BAKE_CLI) login-lint --print && $(BAKE_CLI) login-lint + $(BAKE_CLI) login-lint login-test-unit: - $(BAKE_CLI) login-test-unit --print && $(BAKE_CLI) login-test-unit + $(BAKE_CLI) login-test-unit login-test-integration-build: - $(BAKE_CLI) core-mock login-test-integration --print && $(BAKE_CLI) core-mock login-test-integration + $(BAKE_CLI) 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 @@ -57,7 +57,7 @@ login-test-integration: login-standalone-build login-test-integration-build $(LOGIN_TEST_INTEGRATION_TAG)" login-test-acceptance-build: login-standalone-build - $(BAKE_CLI) --file ./apps/login-test-acceptance/docker-compose.yaml setup sink oidcrp oidcop samlsp samlidp login-test-acceptance + $(BAKE_CLI) setup sink oidcrp samlsp 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 diff --git a/apps/login-test-acceptance/docker-compose-ci.yaml b/apps/login-test-acceptance/docker-compose-ci.yaml new file mode 100644 index 0000000000..12e4c48c2e --- /dev/null +++ b/apps/login-test-acceptance/docker-compose-ci.yaml @@ -0,0 +1,36 @@ +services: + setup: + build: + x-bake: + cache-to: + - type=registry,ref=ghcr.io/zitadel/login-test-acceptance-setup-buildcache:${REF_TAG},mode=max,oci-mediatypes=true + + sink: + build: + x-bake: + cache-to: + - type=registry,ref=ghcr.io/zitadel/login-test-acceptance-sink-buildcache:${REF_TAG},mode=max,oci-mediatypes=true + + oidcrp: + build: + x-bake: + cache-to: + - type=registry,ref=ghcr.io/zitadel/login-test-acceptance-oidcrp-buildcache:${REF_TAG},mode=max,oci-mediatypes=true + + oidcop: + build: + x-bake: + cache-to: + - type=registry,ref=ghcr.io/zitadel/login-test-acceptance-oidcop-buildcache:${REF_TAG},mode=max,oci-mediatypes=true + + samlsp: + build: + x-bake: + cache-to: + - type=registry,ref=ghcr.io/zitadel/login-test-acceptance-samlsp-buildcache:${REF_TAG},mode=max,oci-mediatypes=true + + samlidp: + build: + x-bake: + cache-to: + - type=registry,ref=ghcr.io/zitadel/login-test-acceptance-samlidp-buildcache:${REF_TAG},mode=max,oci-mediatypes=true diff --git a/apps/login-test-acceptance/docker-compose.yaml b/apps/login-test-acceptance/docker-compose.yaml index a409558645..ebfebc978c 100644 --- a/apps/login-test-acceptance/docker-compose.yaml +++ b/apps/login-test-acceptance/docker-compose.yaml @@ -71,11 +71,16 @@ services: condition: "service_completed_successfully" setup: - container_name: acceptance-setup image: ${LOGIN_TEST_ACCEPTANCE_SETUP_TAG:-login-test-acceptance-setup:local} + container_name: acceptance-setup build: context: "${LOGIN_TEST_ACCEPTANCE_BUILD_CONTEXT:-.}/setup" dockerfile: ../go-command.Dockerfile + x-bake: + output: "type=docker" + cache-from: + - type=registry,ref=ghcr.io/zitadel/login-test-acceptance-setup-buildcache:${REF_TAG} + - type=registry,ref=ghcr.io/zitadel/login-test-acceptance-setup-buildcache:latest entrypoint: "./setup.sh" environment: PAT_FILE: /pat/zitadel-admin-sa.pat @@ -120,6 +125,11 @@ services: dockerfile: ../go-command.Dockerfile args: - LOGIN_TEST_ACCEPTANCE_GOLANG_TAG=${LOGIN_TEST_ACCEPTANCE_GOLANG_TAG:-golang:1.24-alpine} + x-bake: + output: "type=docker" + cache-from: + - type=registry,ref=ghcr.io/zitadel/login-test-acceptance-sink-buildcache:${REF_TAG} + - type=registry,ref=ghcr.io/zitadel/login-test-acceptance-sink-buildcache:latest environment: PORT: '3333' command: @@ -145,6 +155,11 @@ services: dockerfile: ../go-command.Dockerfile args: - LOGIN_TEST_ACCEPTANCE_GOLANG_TAG=${LOGIN_TEST_ACCEPTANCE_GOLANG_TAG:-golang:1.24-alpine} + x-bake: + output: "type=docker" + cache-from: + - type=registry,ref=ghcr.io/zitadel/login-test-acceptance-oidcrp-buildcache:${REF_TAG} + - type=registry,ref=ghcr.io/zitadel/login-test-acceptance-oidcrp-buildcache:latest environment: API_URL: 'http://traefik' API_DOMAIN: 'traefik' @@ -172,6 +187,11 @@ services: dockerfile: ../../go-command.Dockerfile args: - LOGIN_TEST_ACCEPTANCE_GOLANG_TAG=${LOGIN_TEST_ACCEPTANCE_GOLANG_TAG:-golang:1.24-alpine} + x-bake: + output: "type=docker" + cache-from: + - type=registry,ref=ghcr.io/zitadel/login-test-acceptance-oidcop-buildcache:${REF_TAG} + - type=registry,ref=ghcr.io/zitadel/login-test-acceptance-oidcop-buildcache:latest environment: API_URL: 'http://traefik' API_DOMAIN: 'traefik' @@ -197,6 +217,11 @@ services: dockerfile: ../go-command.Dockerfile args: - LOGIN_TEST_ACCEPTANCE_GOLANG_TAG=${LOGIN_TEST_ACCEPTANCE_GOLANG_TAG:-golang:1.24-alpine} + x-bake: + output: "type=docker" + cache-from: + - type=registry,ref=ghcr.io/zitadel/login-test-acceptance-samlsp-buildcache:${REF_TAG} + - type=registry,ref=ghcr.io/zitadel/login-test-acceptance-samlsp-buildcache:latest environment: API_URL: 'http://traefik' API_DOMAIN: 'traefik' @@ -221,6 +246,11 @@ services: dockerfile: ../../go-command.Dockerfile args: - LOGIN_TEST_ACCEPTANCE_GOLANG_TAG=${LOGIN_TEST_ACCEPTANCE_GOLANG_TAG:-golang:1.24-alpine} + x-bake: + output: "type=docker" + cache-from: + - type=registry,ref=ghcr.io/zitadel/login-test-acceptance-samlidp-buildcache:${REF_TAG} + - type=registry,ref=ghcr.io/zitadel/login-test-acceptance-samlidp-buildcache:latest environment: API_URL: 'http://traefik:8080' API_DOMAIN: 'traefik' diff --git a/docker-bake.hcl b/docker-bake.hcl index b2eb3e1f5d..01bda1f33a 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -67,6 +67,7 @@ target "typescript-proto-client" { # 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 core-mock against which the integration tests run.