Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced Dockerfile for cross compilation (test Jenkinsfile changes) #43613

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
5bede30
Dockerfile: use TARGETPLATFORM with scopeo for frozen images stage
crazy-max Aug 19, 2022
3d58373
Dockerfile: handle multi base image for riscv64 and armel support
crazy-max Aug 19, 2022
f6cccc7
Dockerfile: remove hardcoded platform for vpnkit stage
crazy-max Aug 20, 2022
cbe9d62
Dockerfile: add cross compilation helper
crazy-max Aug 19, 2022
27831cd
Dockerfile: pin criu version and build from source
crazy-max Aug 19, 2022
94a1e3e
Dockerfile: add dummy stage
crazy-max Aug 19, 2022
e14fc4f
Dockerfile: containerd cross
crazy-max Aug 19, 2022
97b3b09
Dockerfile: runc cross
crazy-max Aug 19, 2022
1e3d1eb
Dockerfile: tini cross
crazy-max Aug 19, 2022
28ea210
Dockerfile: rootlesskit cross
crazy-max Aug 19, 2022
39e131d
Dockerfile: containerutility cross
crazy-max Aug 19, 2022
3fbcb7e
Dockerfile: verify and better cache for go-swagger stage
crazy-max Aug 19, 2022
32b446b
Dockerfile: align deps format and output
crazy-max Aug 19, 2022
1e13269
Dockerfile: use TARGETPLATFORM for delve stage and verify
crazy-max Aug 19, 2022
03cb6ce
Dockerfile: verify and better cache for dockercli stage
crazy-max Aug 19, 2022
0924ec1
Dockerfile: use global scope platform args for registry stage and verify
crazy-max Aug 19, 2022
385502e
Dockerfile: better cache for crun stage
crazy-max Aug 19, 2022
f045cf8
Dockerfile: GO111MODULE=on by default
crazy-max Aug 19, 2022
0c99378
Dockerfile: enhanced for cross compilation
crazy-max Aug 20, 2022
0bf53ff
Dockerfile: add "all" stage to build binaries and extra tools
crazy-max Aug 20, 2022
454233a
ci: add job to test building dev image
crazy-max Aug 20, 2022
7517f97
Jenkinsfile: remove cross stage (moved to gha)
crazy-max Aug 20, 2022
55ef5ec
Dockerfile: smoke test stage and gha workflow
crazy-max Aug 20, 2022
f87e91b
Dockerfile: refactor Dockerfile.simple and create gha workflow
crazy-max Aug 20, 2022
c9c4bf7
riscv64 support
crazy-max Aug 20, 2022
01ca536
docs: contributing docs update for cross comp
crazy-max Aug 20, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.git
.go-pkg-cache
.gopath
bundles
Expand Down
123 changes: 96 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,22 @@ on:
pull_request:

env:
BUNDLES_OUTPUT: ./bundles
PLATFORM: "Moby Engine"
PRODUCT: "Moby"
DEFAULT_PRODUCT_LICENSE: "Moby"
PACKAGER_NAME: "Moby"

jobs:
build:
binary:
runs-on: ubuntu-20.04
env:
DESTDIR: ./build
strategy:
fail-fast: false
matrix:
target:
- binary
- dynbinary
linkmode:
- static
- dynamic
steps:
-
name: Checkout
Expand All @@ -39,34 +44,57 @@ jobs:
name: Build
uses: docker/bake-action@v1
with:
targets: ${{ matrix.target }}
targets: binary
set: |
*.cache-from=type=gha,scope=build-${{ matrix.target }}
*.cache-to=type=gha,scope=build-${{ matrix.target }}
*.cache-from=type=gha,scope=build-${{ matrix.linkmode }}
*.cache-to=type=gha,scope=build-${{ matrix.linkmode }},mode=max
env:
DOCKER_LINKMODE: ${{ matrix.linkmode }}
-
name: List artifacts
run: |
tree -nh ${{ env.DESTDIR }}
-
name: Check artifacts
run: |
find ${{ env.DESTDIR }} -type f -exec file -e ascii -- {} +
-
name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.target }}
path: ${{ env.BUNDLES_OUTPUT }}
name: binary-${{ matrix.linkmode }}
path: ${{ env.DESTDIR }}
if-no-files-found: error
retention-days: 7

prepare:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.platforms.outputs.matrix }}
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Create matrix
id: platforms
run: |
echo ::set-output name=matrix::$(docker buildx bake binary-cross --print | jq -cr '.target."binary-cross".platforms')
-
name: Show matrix
run: |
echo ${{ steps.platforms.outputs.matrix }}

cross:
runs-on: ubuntu-20.04
needs:
- prepare
env:
DESTDIR: ./build
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
platform: ${{ fromJson(needs.prepare.outputs.matrix) }}
steps:
-
name: Checkout
Expand All @@ -78,31 +106,41 @@ jobs:
run: |
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Build
uses: docker/bake-action@v1
with:
targets: cross
targets: all
set: |
*.platform=${{ matrix.platform }}
*.cache-from=type=gha,scope=cross-${{ env.PLATFORM_PAIR }}
*.cache-to=type=gha,scope=cross-${{ env.PLATFORM_PAIR }}
env:
DOCKER_CROSSPLATFORMS: ${{ matrix.platform }}
-
name: List artifacts
run: |
tree -nh ${{ env.DESTDIR }}
-
name: Check artifacts
run: |
find ${{ env.DESTDIR }} -type f -exec file -e ascii -- {} +
-
name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: cross-${{ env.PLATFORM_PAIR }}
path: ${{ env.BUNDLES_OUTPUT }}
path: ${{ env.DESTDIR }}
if-no-files-found: error
retention-days: 7

test-buildkit:
needs:
- build
- binary
runs-on: ubuntu-20.04
strategy:
fail-fast: false
Expand Down Expand Up @@ -147,7 +185,7 @@ jobs:
name: Download binary artifacts
uses: actions/download-artifact@v3
with:
name: binary
name: binary-static
path: ./buildkit/build/moby/
-
name: Update daemon.json
Expand All @@ -163,8 +201,39 @@ jobs:
env:
CONTEXT: "."
TEST_DOCKERD: "1"
TEST_DOCKERD_BINARY: "./build/moby/binary-daemon/dockerd"
TEST_DOCKERD_BINARY: "./build/moby/dockerd"
TESTPKGS: "${{ matrix.pkg }}"
TESTFLAGS: "-v --parallel=1 --timeout=30m --run=//worker=dockerd$"
SKIP_INTEGRATION_TESTS: "${{ matrix.skip-integration-tests }}"
working-directory: buildkit

dev:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
mode:
- ""
- systemd
steps:
- name: Prepare
run: |
if [ "${{ matrix.mode }}" = "systemd" ]; then
echo "SYSTEMD=true" >> $GITHUB_ENV
fi
-
name: Checkout
uses: actions/checkout@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Build dev image
uses: docker/bake-action@v2
with:
targets: dev
set: |
*.cache-from=type=gha,scope=cross-linux-amd64
*.cache-from=type=gha,scope=dev${{ matrix.mode }}
*.cache-to=type=gha,scope=dev${{ matrix.mode }},mode=max
*.output=type=cacheonly
33 changes: 33 additions & 0 deletions .github/workflows/simple.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: simple

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
workflow_dispatch:
push:
branches:
- 'master'
- '[0-9]+.[0-9]{2}'
pull_request:

jobs:
build:
runs-on: ubuntu-20.04
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Build simple image
uses: docker/bake-action@v2
with:
targets: simple
-
name: Build dynbinary
run: |
docker run --rm docker:simple hack/make.sh dynbinary
69 changes: 69 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: test

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
workflow_dispatch:
push:
branches:
- 'master'
- '[0-9]+.[0-9]{2}'
tags:
- 'v*'
pull_request:

jobs:
prepare:
runs-on: ubuntu-20.04
outputs:
matrix: ${{ steps.platforms.outputs.matrix }}
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Create matrix
id: platforms
run: |
echo ::set-output name=matrix::$(docker buildx bake binary-smoketest --print | jq -cr '.target."binary-smoketest".platforms')
-
name: Show matrix
run: |
echo ${{ steps.platforms.outputs.matrix }}

smoke:
runs-on: ubuntu-20.04
needs:
- prepare
strategy:
fail-fast: false
matrix:
platform: ${{ fromJson(needs.prepare.outputs.matrix) }}
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