From a79473b652e5fb9a6146caab0cf5ef1b68b468c6 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Wed, 30 Oct 2024 08:46:18 +0100 Subject: [PATCH 1/3] dockerfile validation Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- docker-bake.hcl | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docker-bake.hcl b/docker-bake.hcl index bb4b1d0b..184b6c4a 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -21,7 +21,7 @@ group "pre-checkin" { } group "validate" { - targets = ["lint", "vendor-validate", "license-validate"] + targets = ["lint", "vendor-validate", "dockerfile-validate", "license-validate"] } target "build" { @@ -54,6 +54,18 @@ target "vendor-validate" { output = ["type=cacheonly"] } +target "dockerfile-validate" { + matrix = { + dockerfile = [ + "dev.Dockerfile", + "./hack/dockerfiles/license.Dockerfile" + ] + } + name = "dockerfile-validate-${md5(dockerfile)}" + dockerfile = dockerfile + call = "check" +} + target "test" { dockerfile = "dev.Dockerfile" target = "test" From 991feac6c3dc0493512d9089e276c64343275876 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Wed, 30 Oct 2024 08:46:34 +0100 Subject: [PATCH 2/3] fix dockerfile checks Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- dev.Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dev.Dockerfile b/dev.Dockerfile index e551ab56..0c0afb1e 100644 --- a/dev.Dockerfile +++ b/dev.Dockerfile @@ -74,9 +74,9 @@ RUN --mount=type=bind,target=.,rw \ --mount=type=cache,target=/src/node_modules \ yarn run lint -FROM docker:${DOCKER_VERSION} as docker -FROM docker/buildx-bin:${BUILDX_VERSION} as buildx -FROM crazymax/undock:${UNDOCK_VERSION} as undock +FROM docker:${DOCKER_VERSION} AS docker +FROM docker/buildx-bin:${BUILDX_VERSION} AS buildx +FROM crazymax/undock:${UNDOCK_VERSION} AS undock FROM deps AS test RUN --mount=type=bind,target=.,rw \ From f06ec3b4a189d0ed5241b0cfe9c306c836c7b335 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Wed, 30 Oct 2024 08:47:30 +0100 Subject: [PATCH 3/3] ci: use list-targets subaction Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- .github/workflows/validate.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index e7f23fe3..5910c892 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -17,16 +17,17 @@ jobs: prepare: runs-on: ubuntu-20.04 outputs: - targets: ${{ steps.targets.outputs.matrix }} + targets: ${{ steps.generate.outputs.targets }} steps: - name: Checkout uses: actions/checkout@v4 - - name: Matrix - id: targets - run: | - echo "matrix=$(docker buildx bake validate --print | jq -cr '.group.validate.targets')" >> $GITHUB_OUTPUT + name: List targets + id: generate + uses: docker/bake-action/subaction/list-targets@v5 + with: + target: validate validate: runs-on: ubuntu-latest