diff --git a/.github/workflows/buildkit.yml b/.github/workflows/buildkit.yml index 3984b98d6c93..8b0ad3f5ba24 100644 --- a/.github/workflows/buildkit.yml +++ b/.github/workflows/buildkit.yml @@ -135,6 +135,51 @@ jobs: path: ${{ env.DESTDIR }}/* if-no-files-found: error + prepare-smoketest: + runs-on: ubuntu-20.04 + outputs: + matrix: ${{ steps.platforms.outputs.matrix }} + steps: + - + name: Checkout + uses: actions/checkout@v4 + - + name: Create matrix + id: platforms + run: | + matrix="$(docker buildx bake binaries-smoketest-cross --print | jq -cr '.target."binaries-smoketest-cross".platforms')" + echo "matrix=$matrix" >> $GITHUB_OUTPUT + + smoketest: + runs-on: ubuntu-20.04 + needs: + - prepare-smoketest + strategy: + fail-fast: false + matrix: + platform: ${{ fromJson(needs.prepare-smoketest.outputs.matrix) }} + steps: + - + name: Checkout + uses: actions/checkout@v4 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + version: ${{ env.SETUP_BUILDX_VERSION }} + driver-opts: image=${{ env.SETUP_BUILDKIT_IMAGE }} + buildkitd-flags: --debug + - + name: Test + uses: docker/bake-action@v4 + with: + targets: binaries-smoketest + set: | + *.platform=${{ matrix.platform }} + image: runs-on: ubuntu-22.04 needs: diff --git a/Dockerfile b/Dockerfile index 94a1ee4b825b..106c4f26d738 100644 --- a/Dockerfile +++ b/Dockerfile @@ -346,5 +346,14 @@ ENV BUILDKIT_HOST=unix:///run/user/1000/buildkit/buildkitd.sock VOLUME /home/user/.local/share/buildkit ENTRYPOINT ["rootlesskit", "buildkitd"] +# smoke tests +FROM --platform=$TARGETPLATFORM buildkit-export AS binaries-smoketest +WORKDIR /usr/local/bin +RUN apk add --no-cache file +COPY --from=binaries / . +RUN set -ex; file buildkitd && buildkitd --version +RUN set -ex; file buildkit-runc && buildkit-runc --version +RUN set -ex; file buildctl && buildctl --version + # buildkit builds the buildkit container image FROM buildkit-$TARGETOS${BUILDKIT_DEBUG:+-debug} AS buildkit diff --git a/docker-bake.hcl b/docker-bake.hcl index f9a6906195a9..e8046b3314ad 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -90,6 +90,24 @@ target "binaries-cross" { ] } +target "binaries-smoketest" { + inherits = ["_common"] + target = "binaries-smoketest" + output = ["type=cacheonly"] +} + +target "binaries-smoketest-cross" { + inherits = ["binaries-smoketest"] + platforms = [ + "linux/amd64", + "linux/arm/v7", + "linux/arm64", + "linux/s390x", + "linux/ppc64le", + "linux/riscv64" + ] +} + target "release" { inherits = ["binaries-cross"] target = "release"