-
Notifications
You must be signed in to change notification settings - Fork 160
[master] fix and refactor static packages #665
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
826baa6 to
a93d12b
Compare
|
moby engine cross compilation fails for |
fad8dbf to
c34fe89
Compare
10552c8 to
950306c
Compare
thaJeztah
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a first glance over the changes, thought I'd post some initial "thinking out loud" comments
|
|
||
| # current arch/variant | ||
| CUROS="linux" | ||
| case "$(uname -m)" in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
didn't xx also have a utility for something like this? (wondering if we can somehow centralise this effort)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes there is the xx-info one and we should use it in a follow-up when we will be able to be sandboxed inside a Dockerfile. See #665 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be better (and a lot simpler) to use go env GOARCH / go env GOOS here? 😇
If we don't get to assume access to go, maybe something like docker version --format '{{ .Server.Os }}/{{ .Server.Arch }}'?
(not sure how we reliably get "current variant" but that's pretty complicated/a guess regardless, so letting the auto-detection default to v7 seems pretty sane IMO 🙈)
| if (arch == 'armhf') { | ||
| // Running armhf builds on EC2 requires --platform parameter | ||
| // Otherwise it accidentally pulls armel images which then breaks the verify step | ||
| platform = "--platform=linux/${arch}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this no longer needed? was slightly wondering if we must do the reverse and always explicitly specify platform 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't with moby atm unfortunately. only cli, buildx supports it without effort. hence #665 (comment). if it's fixed on moby we can remove the docker_engine_cross logic in build-static script.
7b13168 to
4be12d7
Compare
4be12d7 to
843a6ee
Compare
thaJeztah
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
tianon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thaJeztah asked me to take a look -- had more comments than I expected, but nothing super major 😅
|
|
||
| # current arch/variant | ||
| CUROS="linux" | ||
| case "$(uname -m)" in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be better (and a lot simpler) to use go env GOARCH / go env GOOS here? 😇
If we don't get to assume access to go, maybe something like docker version --format '{{ .Server.Os }}/{{ .Server.Arch }}'?
(not sure how we reliably get "current variant" but that's pretty complicated/a guess regardless, so letting the auto-detection default to v7 seems pretty sane IMO 🙈)
| [ -d "${ENGINE_DIR:?}/bundles" ] && rm -r "${ENGINE_DIR:?}/bundles" | ||
| ( | ||
| cd "${ENGINE_DIR}" | ||
| mkdir -p autogen # FIXME: remove when https://github.com/moby/moby/pull/43431 merged |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That PR is merged -- does that mean this line can go away now? 👀 (or does it need to point somewhere else for the FIXME now? 😅)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes for master or 22.06+ but not with 20.10 😣. Can update the comment though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to take 20.10 into account (we use the 20.10 branch for that)
| scanBuildDir="${buildDir}/docker-scan" | ||
|
|
||
| # create docker-container builder | ||
| docker buildx inspect | grep -q 'Driver: docker-container' || docker buildx create --use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😬
This line has several assumptions baked into it and changes the user's default buildx builder -- at the very least, I think we should probably be explicit about --driver docker-container on the create command, right? (so that it explicitly matches what we checked for with inspect)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes indeed good point
|
Thanks a bunch for the review @tianon!
A bunch of the os, arch and variant detection logic is taken from |
Signed-off-by: CrazyMax <[email protected]> Signed-off-by: Sebastiaan van Stijn <[email protected]>
af71d24 to
59a1875
Compare
|
So, looks like something's still broken; the cross-compiled versions are missing the containerd binaries. It looks like docker buildx build \
--build-arg CGO_ENABLED= \
--build-arg CONTAINERD_VERSION \
--build-arg CROSS=true \
--build-arg DEFAULT_PRODUCT_LICENSE \
--build-arg DOCKER_CROSSPLATFORMS=linux/arm64 \
--build-arg PACKAGER_NAME \
--build-arg PLATFORM \
--build-arg PRODUCT \
--build-arg RUNC_VERSION \
--build-arg VERSION=22.06.0-beta.1 \
--output ./bundles \
--target cross .
tree bundles
bundles
└── cross
└── linux
└── arm64-daemon
├── docker-proxy -> docker-proxy-22.06.0-beta.1
├── docker-proxy-22.06.0-beta.1
├── docker-proxy-22.06.0-beta.1.md5
├── docker-proxy-22.06.0-beta.1.sha256
├── dockerd -> dockerd-22.06.0-beta.1
├── dockerd-22.06.0-beta.1
├── dockerd-22.06.0-beta.1.md5
└── dockerd-22.06.0-beta.1.sha256
3 directories, 8 files |
|
I dug a bit further, and currently;
So, I'll have to dig further to see how feasible that is (given that we hope to build both as part of containerd packaging soon, so it would be temporary). For platforms that we have machines for in Jenkins this won't be an issue (linux/amd64 and linux/arm64), but for other platforms that may be an issue (arm32 variants including) |
|
@thaJeztah moby/moby#43529 would fix this |
Signed-off-by: CrazyMax <[email protected]> Signed-off-by: Sebastiaan van Stijn <[email protected]>
Jenkins may set parameters to an empty value, in which case the build-args may be overriding the default value with an empty value. This patch explicitly unsets variables if they're empty (or not set). Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: CrazyMax <[email protected]> Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: CrazyMax <[email protected]> Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: CrazyMax <[email protected]> Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: CrazyMax <[email protected]> Signed-off-by: Sebastiaan van Stijn <[email protected]>
This splits the CLI, Engine, and containerd packages to allow downloading
the cli separate from the daemon, as well as (in future) allowing us to
do a containerd release without also requiring an engine release.
With this patch:
make REF=v22.06.0-beta.0 VERSION=v22.06.0-beta.0 TARGETPLATFORM=linux/amd64 static
static/build
├── bundles-ce-static-linux-x86_64.tar.gz
└── linux
└── amd64
├── containerd-1.6.4.tgz
├── docker-buildx-plugin-0.8.2.tgz
├── docker-cli-22.06.0-beta.0.tgz
├── docker-engine-22.06.0-beta.0.tgz
├── docker-compose-plugin-2.6.1.tgz
├── docker-rootless-extras-22.06.0-beta.0.tgz
└── docker-scan-plugin-0.17.0.tgz
2 directories, 8 files
ls -lh static/build/linux/amd64/
total 215208
-rw-r--r-- 1 sebastiaan staff 31M Jun 29 00:21 containerd-1.6.4.tgz
-rw-r--r-- 1 sebastiaan staff 14M Jun 29 00:21 docker-buildx-plugin-0.8.2.tgz
-rw-r--r-- 1 sebastiaan staff 8.2M Jun 29 00:21 docker-cli-22.06.0-beta.0.tgz
-rw-r--r-- 1 sebastiaan staff 19M Jun 29 00:21 docker-engine-22.06.0-beta.0.tgz
-rw-r--r-- 1 sebastiaan staff 8.8M Jun 29 00:21 docker-compose-plugin-2.6.1.tgz
-rw-r--r-- 1 sebastiaan staff 19M Jun 29 00:21 docker-rootless-extras-22.06.0-beta.0.tgz
-rw-r--r-- 1 sebastiaan staff 4.4M Jun 29 00:21 docker-scan-plugin-0.17.0.tgz
Signed-off-by: CrazyMax <[email protected]>
Signed-off-by: Sebastiaan van Stijn <[email protected]>
GHA currently only has x86 machines, and the "cross" target in moby does not include containerd and runc. Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: Sebastiaan van Stijn <[email protected]>
59a1875 to
9515153
Compare
fixes an issue introduced by #654 while adding buildx static package. also review the bits that generates the static packages:
--platformwith buildx.TARGETPLATFORM.linux/arm/v6,linux/arm/v7,linux/arm64)Signed-off-by: CrazyMax [email protected]