diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9616df6217..4ace237815 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,10 +35,11 @@ jobs: with: project: jp837jn3fm push: false - targets: login-lint + targets: login-lint,login-test-unit,login-test-integration,login-test-acceptance files: | docker-bake.hcl docker-bake-ci.hcl 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 quality diff --git a/docker-bake-ci.hcl b/docker-bake-ci.hcl index fb6eda78eb..a4aff2e504 100644 --- a/docker-bake-ci.hcl +++ b/docker-bake-ci.hcl @@ -4,25 +4,46 @@ target "login-pnpm" { cache-to = [ { type: "registry", ref: "${IMAGE_REGISTRY}/login-pnpm-buildcache:${BUILD_CACHE_KEY}", mode: "max", oci-mediatypes=true } ] - output = [ - { type : "image", name: "${IMAGE_REGISTRY}/login-pnpm:${BUILD_CACHE_KEY}", push: true }, - ] } target "login-dev-base" { cache-to = [ { type: "registry", ref: "${IMAGE_REGISTRY}/login-dev-base-buildcache:${BUILD_CACHE_KEY}", mode: "max", oci-mediatypes=true } ] - output = [ - { type : "image", name: "${IMAGE_REGISTRY}/login-dev-base:${BUILD_CACHE_KEY}", push: true }, - ] } target "login-lint" { cache-to = [ { type: "registry", ref: "${IMAGE_REGISTRY}/login-lint-buildcache:${BUILD_CACHE_KEY}", mode: "max", oci-mediatypes=true } ] - output = [ - { type : "image", name: "${IMAGE_REGISTRY}/login-lint:${BUILD_CACHE_KEY}", push: true }, +} + +target "login-test-unit" { + cache-to = [ + { type: "registry", ref: "${IMAGE_REGISTRY}/login-test-unit-buildcache:${BUILD_CACHE_KEY}", mode: "max", oci-mediatypes=true } + ] +} + +target "login-test-integration" { + cache-to = [ + { type: "registry", ref: "${IMAGE_REGISTRY}/login-test-integration-buildcache:${BUILD_CACHE_KEY}", mode: "max", oci-mediatypes=true } + ] +} + +target "login-client" { + cache-to = [ + { type: "registry", ref: "${IMAGE_REGISTRY}/login-client-buildcache:${BUILD_CACHE_KEY}", mode: "max", oci-mediatypes=true } + ] +} + +target "login-test-acceptance" { + cache-to = [ + { type: "registry", ref: "${IMAGE_REGISTRY}/login-test-acceptance-buildcache:${BUILD_CACHE_KEY}", mode: "max", oci-mediatypes=true } + ] +} + +target "login-standalone" { + cache-to = [ + { type: "registry", ref: "${IMAGE_REGISTRY}/login-buildcache:${BUILD_CACHE_KEY}", mode: "max", oci-mediatypes=true } ] } diff --git a/docker-bake.hcl b/docker-bake.hcl index 28d2559b6a..b55e1a717b 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -8,12 +8,7 @@ variable "BUILD_CACHE_KEY" { default = "local" } -target "_platforms" { - platforms = ["linux/amd64"] -} - target "login-pnpm" { - inherits = ["_platforms"] cache-from = [ { "type": "registry", "ref": "${IMAGE_REGISTRY}/login-pnpm-buildcache:${BUILD_CACHE_KEY}" }, { "type": "registry", "ref": "${IMAGE_REGISTRY}/login-pnpm-buildcache:latest" }, @@ -22,7 +17,6 @@ target "login-pnpm" { } target "login-dev-base" { - inherits = ["_platforms"] cache-from = [ {"type": "registry", "ref": "${IMAGE_REGISTRY}/login-dev-base-buildcache:${BUILD_CACHE_KEY}"}, {"type": "registry", "ref": "${IMAGE_REGISTRY}/login-dev-base-buildcache:latest"}, @@ -34,7 +28,6 @@ target "login-dev-base" { } target "login-lint" { - inherits = ["_platforms"] cache-from = [ {"type": "registry", "ref": "${IMAGE_REGISTRY}/login-lint-buildcache:${BUILD_CACHE_KEY}"}, {"type": "registry", "ref": "${IMAGE_REGISTRY}/login-lint-buildcache:latest"}, @@ -45,11 +38,11 @@ target "login-lint" { } } -variable "LOGIN_TEST_UNIT_TAG" { - default = "login-test-unit:local" -} - 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:latest"}, + ] dockerfile = "dockerfiles/login-test-unit.Dockerfile" contexts = { login-client = "target:login-client" @@ -59,6 +52,10 @@ 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:latest"}, + ] dockerfile = "dockerfiles/login-client.Dockerfile" contexts = { login-pnpm = "target:login-pnpm" @@ -100,6 +97,10 @@ 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:latest"}, + ] dockerfile = "dockerfiles/login-test-integration.Dockerfile" contexts = { login-pnpm = "target:login-pnpm" @@ -112,6 +113,10 @@ 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:latest"}, + ] dockerfile = "dockerfiles/login-test-acceptance.Dockerfile" contexts = { login-pnpm = "target:login-pnpm" @@ -125,6 +130,10 @@ 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:latest"}, + ] dockerfile = "dockerfiles/login-standalone.Dockerfile" contexts = { login-client = "target:login-client"