From 21a9772e9883b209d486a2f745e4c4d46e8fde0c Mon Sep 17 00:00:00 2001 From: Nicola Lunghi Date: Thu, 14 Aug 2025 13:23:56 +0200 Subject: [PATCH 1/6] CI: use targets from docker-bake.hcl --- .github/workflows/CI.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index c4ac590..74a47e4 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -20,10 +20,27 @@ concurrency: cancel-in-progress: true jobs: + extract-targets: + runs-on: ubuntu-latest + outputs: + targets: ${{ steps.extract.outputs.targets }} + steps: + - uses: actions/checkout@v4 + - name: Extract targets as JSON array + id: extract + uses: dcarbone/install-jq-action@v2 + - name: Get targets from bake file + id: get-targets + run: | + TARGETS=$(docker buildx bake --file docker-bake.hcl --print | jq -c '[.target | keys[] | select(. != "default")]') + echo "targets=$TARGETS" | tee -a ${GITHUB_OUTPUT} + build: + needs: extract-targets + runs-on: ubuntu-latest strategy: matrix: - target: [ "all", "20", "20-alpine", "19", "19-alpine", "18", "18-alpine", "17", "17-alpine", "16", "16-alpine", "15", "14", "13", "12", "11", "10", "9", "8", "7"] + target: ${{ fromJson(needs.extract-targets.outputs.targets) }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 From d782c06437563135335cf2d14e83d4baaed840a6 Mon Sep 17 00:00:00 2001 From: Xianpeng Shen Date: Thu, 14 Aug 2025 14:44:09 +0300 Subject: [PATCH 2/6] fix: Update CI.yml to fix syntax error --- .github/workflows/CI.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 74a47e4..feae39e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -41,7 +41,6 @@ jobs: strategy: matrix: target: ${{ fromJson(needs.extract-targets.outputs.targets) }} - runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 From 1610324b08b655434d9f8214daa0025154adb5da Mon Sep 17 00:00:00 2001 From: Xianpeng Shen Date: Thu, 14 Aug 2025 14:50:16 +0300 Subject: [PATCH 3/6] fix: Update CI.yml to fix empty input --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index feae39e..32ec874 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -33,7 +33,7 @@ jobs: id: get-targets run: | TARGETS=$(docker buildx bake --file docker-bake.hcl --print | jq -c '[.target | keys[] | select(. != "default")]') - echo "targets=$TARGETS" | tee -a ${GITHUB_OUTPUT} + echo "targets=$TARGETS" >> "$GITHUB_OUTPUT" build: needs: extract-targets From d58103e578bc57af29b29c4f68f1806ed7389da2 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Thu, 14 Aug 2025 11:58:52 +0000 Subject: [PATCH 4/6] fixup! fix: Update CI.yml to fix empty input --- .github/workflows/CI.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 32ec874..1ac5bb5 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -23,11 +23,10 @@ jobs: extract-targets: runs-on: ubuntu-latest outputs: - targets: ${{ steps.extract.outputs.targets }} + targets: ${{ steps.get-targets.outputs.targets }} steps: - uses: actions/checkout@v4 - name: Extract targets as JSON array - id: extract uses: dcarbone/install-jq-action@v2 - name: Get targets from bake file id: get-targets From 2d80a6e7fbdbc25d87e0102e3835a5a8bcf2ce89 Mon Sep 17 00:00:00 2001 From: Xianpeng Shen Date: Thu, 14 Aug 2025 15:07:19 +0300 Subject: [PATCH 5/6] fix: add condition to login step --- .github/workflows/CI.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 1ac5bb5..c8063bb 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -49,17 +49,18 @@ jobs: - name: Check formatting run: make install-deps && make lint - - name: Login container registries - run: | - echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin - echo '${{ secrets.DOCKER_PASSWORD }}' | docker login -u '${{ secrets.DOCKER_USERNAME }}' --password-stdin - - name: Check buildx bake run: docker buildx bake --file docker-bake.hcl --print - name: Build image for tag ${{ matrix.target }} run: docker buildx bake --file docker-bake.hcl ${{ matrix.target }} + - name: Login container registries + if: github.ref == 'refs/heads/master' && github.event_name == 'workflow_dispatch' + run: | + echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + echo '${{ secrets.DOCKER_PASSWORD }}' | docker login -u '${{ secrets.DOCKER_USERNAME }}' --password-stdin + - name: Publish image for tag ${{ matrix.target }} if: github.ref == 'refs/heads/master' && github.event_name == 'workflow_dispatch' run: docker buildx bake --file docker-bake.hcl ${{ matrix.target }} --push From 08dc86c849d1564d768a6e27690ad86ccde55562 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Thu, 14 Aug 2025 12:18:00 +0000 Subject: [PATCH 6/6] fix: update type to image to avoid push=true see: https://docs.docker.com/reference/cli/docker/buildx/build/#output --- docker-bake.hcl | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docker-bake.hcl b/docker-bake.hcl index cf782b0..023ae91 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -45,7 +45,7 @@ target "all" { "${GITHUB_REPO}:all" ] platforms = ["linux/amd64", "linux/arm64"] - output = ["type=registry"] + output = ["type=image"] } target "clang-tools" { @@ -65,7 +65,7 @@ target "clang-tools" { "${GITHUB_REPO}:${tgt}" ] platforms = ["linux/amd64", "linux/arm64"] - output = ["type=registry"] + output = ["type=image"] } target "clang-tools" { @@ -85,7 +85,7 @@ target "clang-tools" { "${GITHUB_REPO}:${tgt}" ] platforms = ["linux/amd64", "linux/arm64"] - output = ["type=registry"] + output = ["type=image"] } target "clang-tools" { @@ -105,7 +105,7 @@ target "clang-tools" { "${GITHUB_REPO}:${tgt}" ] platforms = ["linux/amd64", "linux/arm64"] - output = ["type=registry"] + output = ["type=image"] } target "clang-tools" { @@ -124,7 +124,7 @@ target "clang-tools" { "${GITHUB_REPO}:${tgt}" ] platforms = ["linux/amd64", "linux/arm64"] - output = ["type=registry"] + output = ["type=image"] } target "clang-tools" { @@ -143,7 +143,7 @@ target "clang-tools" { "${GITHUB_REPO}:${tgt}" ] platforms = ["linux/amd64", "linux/arm64"] - output = ["type=registry"] + output = ["type=image"] } target "clang-tools" { @@ -162,7 +162,7 @@ target "clang-tools" { "${GITHUB_REPO}:${tgt}" ] platforms = ["linux/amd64", "linux/arm64"] - output = ["type=registry"] + output = ["type=image"] } target "clang-tools" { @@ -180,6 +180,6 @@ target "clang-tools" { "${DOCKER_REPO}:${tgt}", "${GITHUB_REPO}:${tgt}" ] - platforms = ["linux/amd64", "linux/arm64"] - output = ["type=registry"] + platforms = ["linux/amd64"] + output = ["type=image"] }