From c2dfb60e31f7e3e99d4f6254a313b018d15e7214 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Sat, 9 Apr 2022 02:27:29 +0200 Subject: [PATCH 1/4] ci: update upload-artifact and download-artifact actions to v3 Signed-off-by: CrazyMax --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7fc80621fb..745e2c835e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,7 +41,7 @@ jobs: *.cache-to=type=gha,scope=build-${{ matrix.target }} - name: Upload build artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: ${{ matrix.target }} path: ${{ env.BUNDLES_OUTPUT }}/${{ matrix.target }}-daemon/* @@ -92,7 +92,7 @@ jobs: uses: docker/setup-buildx-action@v1 - name: Download build artifacts - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: binary path: ./buildkit/build/moby/ From d730d550e28ecfce9a336fb7f9f55377a52908e2 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Sat, 9 Apr 2022 02:28:30 +0200 Subject: [PATCH 2/4] ci: set shorter retention period for artifacts Signed-off-by: CrazyMax --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 745e2c835e..75d4e83f2e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,6 +46,7 @@ jobs: name: ${{ matrix.target }} path: ${{ env.BUNDLES_OUTPUT }}/${{ matrix.target }}-daemon/* if-no-files-found: error + retention-days: 7 test-buildkit: needs: From 12558c8d6ea9f388b54eb94ba6b9eb4a9fc5c9f2 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Sun, 10 Apr 2022 21:03:31 +0200 Subject: [PATCH 3/4] fix cross compilation for arm platforms Signed-off-by: CrazyMax --- hack/make/.binary | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/hack/make/.binary b/hack/make/.binary index 371af7536b..0fed4f60ef 100644 --- a/hack/make/.binary +++ b/hack/make/.binary @@ -47,11 +47,25 @@ hash_files() { ;; linux/arm) case "${GOARM}" in - 5 | "") + 5) export CC="${CC:-arm-linux-gnueabi-gcc}" export CGO_ENABLED=1 + export CGO_CFLAGS="-march=armv5t" + export CGO_CXXFLAGS="-march=armv5t" + ;; + 6) + export CC="${CC:-arm-linux-gnueabi-gcc}" + export CGO_ENABLED=1 + export CGO_CFLAGS="-march=armv6" + export CGO_CXXFLAGS="-march=armv6" ;; 7) + export CC="${CC:-arm-linux-gnueabihf-gcc}" + export CGO_ENABLED=1 + export CGO_CFLAGS="-march=armv7-a" + export CGO_CXXFLAGS="-march=armv7-a" + ;; + *) export CC="${CC:-arm-linux-gnueabihf-gcc}" export CGO_ENABLED=1 ;; From 170049225c4014fb103c6a5f6c73655c6c0f2765 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Sun, 10 Apr 2022 21:03:54 +0200 Subject: [PATCH 4/4] ci: add cross job in ci workflow Signed-off-by: CrazyMax --- .github/workflows/ci.yml | 57 +++++++++++++++++++++++++++++++++++++--- docker-bake.hcl | 13 +++++++++ 2 files changed, 66 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 75d4e83f2e..3035410c72 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,11 +40,60 @@ jobs: *.cache-from=type=gha,scope=build-${{ matrix.target }} *.cache-to=type=gha,scope=build-${{ matrix.target }} - - name: Upload build artifacts + name: Upload artifacts uses: actions/upload-artifact@v3 with: name: ${{ matrix.target }} - path: ${{ env.BUNDLES_OUTPUT }}/${{ matrix.target }}-daemon/* + path: ${{ env.BUNDLES_OUTPUT }} + if-no-files-found: error + retention-days: 7 + + cross: + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + platform: + - linux/amd64 + - linux/arm/v5 + - linux/arm/v6 + - linux/arm/v7 + - linux/arm64 + - linux/ppc64le + - linux/s390x + - windows/amd64 + - windows/arm64 + steps: + - + name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - + name: Prepare + run: | + platform=${{ matrix.platform }} + echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV + mkdir -p autogen + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Build + uses: docker/bake-action@v1 + with: + targets: cross + set: | + *.cache-from=type=gha,scope=cross-${{ env.PLATFORM_PAIR }} + *.cache-to=type=gha,scope=cross-${{ env.PLATFORM_PAIR }} + env: + DOCKER_CROSSPLATFORMS: ${{ matrix.platform }} + - + name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: cross-${{ env.PLATFORM_PAIR }} + path: ${{ env.BUNDLES_OUTPUT }} if-no-files-found: error retention-days: 7 @@ -92,7 +141,7 @@ jobs: name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - - name: Download build artifacts + name: Download binary artifacts uses: actions/download-artifact@v3 with: name: binary @@ -111,7 +160,7 @@ jobs: env: CONTEXT: "." TEST_DOCKERD: "1" - TEST_DOCKERD_BINARY: "./build/moby/dockerd" + TEST_DOCKERD_BINARY: "./build/moby/binary-daemon/dockerd" TESTPKGS: "${{ matrix.pkg }}" TESTFLAGS: "-v --parallel=1 --timeout=30m --run=//worker=dockerd$" SKIP_INTEGRATION_TESTS: "${{ matrix.skip-integration-tests }}" diff --git a/docker-bake.hcl b/docker-bake.hcl index a560a2d26f..e05fbec4cf 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -1,10 +1,14 @@ variable "BUNDLES_OUTPUT" { default = "./bundles" } +variable "DOCKER_CROSSPLATFORMS" { + default = "" +} target "_common" { args = { BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1 + APT_MIRROR = "cdn-fastly.deb.debian.org" } } @@ -22,3 +26,12 @@ target "dynbinary" { inherits = ["binary"] target = "dynbinary" } + +target "cross" { + inherits = ["binary"] + args = { + CROSS = "true" + DOCKER_CROSSPLATFORMS = DOCKER_CROSSPLATFORMS + } + target = "cross" +}