Skip to content

Commit

Permalink
dockerfile: smoke tests for binaries
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
  • Loading branch information
crazy-max committed Oct 20, 2023
1 parent 0946624 commit 4527c75
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/buildkit.yml
Expand Up @@ -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:
Expand Down
9 changes: 9 additions & 0 deletions Dockerfile
Expand Up @@ -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
18 changes: 18 additions & 0 deletions docker-bake.hcl
Expand Up @@ -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"
Expand Down

0 comments on commit 4527c75

Please sign in to comment.