From 8fb1a8cb5254a2a864906dca2654b815d8df0f6c Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Thu, 14 Dec 2023 11:01:56 +0100 Subject: [PATCH] ci(buildkit): set timeout to image job Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- .github/workflows/buildkit.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/buildkit.yml b/.github/workflows/buildkit.yml index a77eef798ea04..653bfa3223129 100644 --- a/.github/workflows/buildkit.yml +++ b/.github/workflows/buildkit.yml @@ -27,6 +27,7 @@ env: IMAGE_NAME: "moby/buildkit" PLATFORMS: "linux/amd64,linux/arm/v7,linux/arm64,linux/s390x,linux/ppc64le,linux/riscv64" DESTDIR: "./bin" + BUILD_TIMEOUT: "900" # 15 minutes jobs: prepare: @@ -160,6 +161,7 @@ jobs: uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx + id: buildx uses: docker/setup-buildx-action@v3 with: version: ${{ env.SETUP_BUILDX_VERSION }} @@ -175,8 +177,14 @@ jobs: - name: Build ${{ needs.prepare.outputs.tag }} run: | - ./hack/images "${{ needs.prepare.outputs.tag }}" "$IMAGE_NAME" "${{ needs.prepare.outputs.push }}" + timeout ${BUILD_TIMEOUT} ./hack/images "${{ needs.prepare.outputs.tag }}" "$IMAGE_NAME" "${{ needs.prepare.outputs.push }}" + if [ $? -eq 124 ]; then + echo "::error::Build timed out after ${BUILD_TIMEOUT} seconds" + docker kill --signal=SIGTERM buildx_buildkit_${{ steps.buildx.outputs.name }} + exit 1 + fi env: + BUILDX_CMD: docker --debug buildx RELEASE: ${{ startsWith(github.ref, 'refs/tags/v') }} TARGET: ${{ matrix.target-stage }} CACHE_FROM: type=gha,scope=image${{ matrix.target-stage }}