From 03205124fe4c0e2f718eb837c71b43beb8fa7070 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Tue, 3 Feb 2026 11:04:29 +0100 Subject: [PATCH] ci: use docker/github-builder to build, sign binaries Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- .github/workflows/ci.yml | 133 ++++++++++++++++----------------------- 1 file changed, 55 insertions(+), 78 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7b56277ed..6a5f9f50c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,24 +22,6 @@ permissions: contents: read # to fetch code (actions/checkout) jobs: - prepare: - runs-on: ubuntu-latest - outputs: - matrix: ${{ steps.platforms.outputs.matrix }} - steps: - - - name: Checkout - uses: actions/checkout@v4 - - - name: Create matrix - id: platforms - run: | - echo matrix=$(docker buildx bake binary-cross --print | jq -cr '.target."binary-cross".platforms') >> $GITHUB_OUTPUT - - - name: Show matrix - run: | - echo ${{ steps.platforms.outputs.matrix }} - validate: runs-on: ubuntu-latest strategy: @@ -63,61 +45,68 @@ jobs: make ${{ matrix.target }} binary: + uses: docker/github-builder/.github/workflows/bake.yml@v1 + permissions: + contents: read # same as global permission + id-token: write # for signing attestation(s) with GitHub OIDC Token + with: + runner: amd64 + artifact-name: compose + artifact-upload: true + cache: true + cache-scope: binary + target: release + output: local + sbom: true + sign: ${{ github.event_name != 'pull_request' }} + + binary-finalize: runs-on: ubuntu-latest needs: - - prepare - strategy: - fail-fast: false - matrix: - platform: ${{ fromJson(needs.prepare.outputs.matrix) }} + - binary steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Prepare - run: | - platform=${MATRIX_PLATFORM} - echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV - env: - MATRIX_PLATFORM: ${{ matrix.platform }} - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Build - uses: docker/bake-action@v6 + name: Download artifacts + uses: actions/download-artifact@v7 with: - source: . - targets: release - provenance: mode=max - sbom: true - set: | - *.platform=${{ matrix.platform }} - *.cache-from=type=gha,scope=binary-${{ env.PLATFORM_PAIR }} - *.cache-to=type=gha,scope=binary-${{ env.PLATFORM_PAIR }},mode=max + path: /tmp/compose-output + name: ${{ needs.binary.outputs.artifact-name }} - name: Rename provenance and sbom + run: | + for pdir in /tmp/compose-output/*/; do + ( + cd "$pdir" + binname=$(find . -name 'docker-compose-*') + filename=$(basename "${binname%.exe}") + mv "provenance.json" "${filename}.provenance.json" + mv "sbom-binary.spdx.json" "${filename}.sbom.json" + find . -name 'sbom*.json' -exec rm {} \; + if [ -f "provenance.sigstore.json" ]; then + mv "provenance.sigstore.json" "${filename}.sigstore.json" + fi + ) + done + mkdir -p "./bin/release" + mv /tmp/compose-output/**/* "./bin/release/" + - + name: Create checksum file working-directory: ./bin/release run: | - binname=$(find . -name 'docker-compose-*') - filename=$(basename "$binname" | sed -E 's/\.exe$//') - mv "provenance.json" "${filename}.provenance.json" - mv "sbom-binary.spdx.json" "${filename}.sbom.json" - find . -name 'sbom*.json' -exec rm {} \; - - - name: List artifacts - run: | - tree -nh ./bin/release + find . -type f -print0 | sort -z | xargs -r0 shasum -a 256 -b | sed 's# \*\./# *#' > $RUNNER_TEMP/checksums.txt + shasum -a 256 -U -c $RUNNER_TEMP/checksums.txt + mv $RUNNER_TEMP/checksums.txt . + cat checksums.txt | while read sum file; do + if [[ "${file#\*}" == docker-compose-* && "${file#\*}" != *.provenance.json && "${file#\*}" != *.sbom.json && "${file#\*}" != *.sigstore.json ]]; then + echo "$sum $file" > ${file#\*}.sha256 + fi + done - name: Upload artifacts - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: - name: compose-${{ env.PLATFORM_PAIR }} - path: ./bin/release + name: release + path: ./bin/release/* if-no-files-found: error test: @@ -147,6 +136,7 @@ jobs: with: paths: bin/coverage/unit/report.xml if: always() + e2e: runs-on: ubuntu-latest name: e2e (${{ matrix.mode }}, ${{ matrix.channel }}) @@ -254,6 +244,7 @@ jobs: with: paths: /tmp/report/report.xml if: always() + coverage: runs-on: ubuntu-latest needs: @@ -297,33 +288,19 @@ jobs: release: permissions: contents: write # to create a release (ncipollo/release-action) - runs-on: ubuntu-latest needs: - - binary + - binary-finalize steps: - name: Checkout uses: actions/checkout@v4 - name: Download artifacts - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v7 with: - pattern: compose-* path: ./bin/release - merge-multiple: true - - - name: Create checksums - working-directory: ./bin/release - run: | - find . -type f -print0 | sort -z | xargs -r0 shasum -a 256 -b | sed 's# \*\./# *#' > $RUNNER_TEMP/checksums.txt - shasum -a 256 -U -c $RUNNER_TEMP/checksums.txt - mv $RUNNER_TEMP/checksums.txt . - cat checksums.txt | while read sum file; do - if [[ "${file#\*}" == docker-compose-* && "${file#\*}" != *.provenance.json && "${file#\*}" != *.sbom.json ]]; then - echo "$sum $file" > ${file#\*}.sha256 - fi - done + name: release - name: List artifacts run: |