From de02776e7826b67ce876ed3bb101926ddef063ee Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Tue, 24 May 2022 09:18:57 +0200 Subject: [PATCH] Dockerfile: smoke test stage Signed-off-by: CrazyMax --- .github/workflows/test.yml | 49 ++++++++++++++++++++++++++++++++++++++ Dockerfile | 22 +++++++++++++++++ docker-bake.hcl | 12 ++++++++++ 3 files changed, 83 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000000000..51d5ad84bf543 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,49 @@ +name: test + +on: + workflow_dispatch: + push: + branches: + - 'master' + - '[0-9]+.[0-9]{2}' + tags: + - 'v*' + pull_request: + +jobs: + smoke: + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + platform: + - linux/amd64 + - linux/arm64 + - linux/ppc64le + - linux/s390x + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Prepare + run: | + platform=${{ matrix.platform }} + echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV + - + name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - + name: Test + uses: docker/bake-action@v2 + with: + targets: binary-smoketest + set: | + *.platform=${{ matrix.platform }} + *.cache-from=type=gha,scope=binary-smoketest-${{ env.PLATFORM_PAIR }} + *.cache-to=type=gha,scope=binary-smoketest-${{ env.PLATFORM_PAIR }} + env: + DOCKER_LINKMODE: static diff --git a/Dockerfile b/Dockerfile index f6c4e35191f3b..30c9d59428655 100644 --- a/Dockerfile +++ b/Dockerfile @@ -648,6 +648,28 @@ FROM base AS release-all COPY --from=releaser-all / /out RUN find /out/ -type f \( ! -iname "checksums.txt" \) -print0 | sort -z | xargs -r0 shasum -a 256 -b | sed 's# .*/# #' > /out/checksums.txt +# smoke tests +# usage: +# > docker builx bake binary-smoketest +FROM --platform=$TARGETPLATFORM $BASE_IMAGE AS smoketest-binary +WORKDIR /usr/local/bin +COPY --link --from=tini /out/ . +COPY --link --from=runc /out/ . +COPY --link --from=containerd /out/ . +COPY --link --from=rootlesskit /out/ . +COPY --link --from=build /out/ . +RUN < docker buildx bake binary # > DOCKER_LINKMODE=dynamic docker buildx bake binary diff --git a/docker-bake.hcl b/docker-bake.hcl index 27e4f45719801..5da6ad87a0c1d 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -108,6 +108,18 @@ target "binary-cross" { inherits = ["binary", "_platforms"] } +target "binary-smoketest" { + inherits = ["_common"] + target = "smoketest-binary" + output = ["type=cacheonly"] + platforms = [ + "linux/amd64", + "linux/arm64", + "linux/ppc64le", + "linux/s390x" + ] +} + # # all targets build binaries and extra tools as well (containerd, runc, ...) #