-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Support arm builds #1399
Support arm builds #1399
Conversation
I'd like to have a clear scope for this PR defined, even as a draft, as I think it would help me contribute in general to this work - either directly in this PR or in surrounding PRs. Main scope suggestionI suggest that if we can make this PR able to do the following things, we go for a merge.
Out of scope suggestionI suggest we consider it out of scope for this PR to look to actually change the Dockerfiles, but instead focus on building whatever dockerfiles we currently can build using --platform linux/arm64. |
2552034
to
141da2b
Compare
This comment has been minimized.
This comment has been minimized.
222c97c
to
7587c29
Compare
7587c29
to
b4b4472
Compare
I think this may successfully be able to build and publish the images we have made support multiple architectures so far, base + minimal to my knowledge. Some insights:
There are plenty of things that can be improved in general to avoid slowing down the CI build duration etc, but it is also a lot of work and will require significant changes. Review suggestionsTo make our CI system build, test, and publish images compatible with amd64 and arm64 is complicated and bound to include some trade offs.
I have outlined a scope in #1399 (comment) that this PR address. Is the scope reasonable is the first question, and the second if the technical implementation and its associated trade offs is reasonable. I've considered some tweaks to avoid slowing down our CI system too much, such as letting our PRs triggered CI jobs retain the quicker behavior by omitting multi-arch details. At the moment, I think I'd prefer having a slow but thorough CI system while we try get our images arm64 compatible, and perhaps later make it quick and less thorough. I have some ideas on how we can make the CI system a lot more fancy, but it also involves a lot more work. I don't think I can find time to put in that much work at the moment so I hope we can settle for something not yet perfect. Ideas include:
|
@consideRatio I will definitely take a look at this, hope today or in the next few days. @manics may I also ask you to take a look? You seem to be experienced with this kind of changes. |
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.
I think we should improve naming - I'm absolutely fine breaking make build/something
command, it's our implementation detail.
This comment has been minimized.
This comment has been minimized.
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.
Another thing - let's not forget about docs:
- let's explicitly say, that now we support arm for some images
- we need to list all the caveats there
- also, updating tagging/README.md would be nice
Yes, I think it is well described.
I have a question for you. And also, I think we should create at least 2 issues and a new
|
I think the limitations should be resolved by having dedicated self-hosted GitHub arm64-based runners where the performance isn't crap building arm64 images, because then it is reasonable to have two jobs side by side and we don't lose any performance - one for amd64, one for arm64. If I recall correctly, the Thanks for the review @mathbunnyru! I'll go through it more properly later, I think I agree with your points but I need to deliberate a bit more on the naming of makefile commands. |
@mathbunnyru I made a commit (44dfb03) about the naming of the Makefile commands. I don't think of the commands without I created two new issues:
I don't understand what you mean with this. Do you mean that we should tag our multi-platform images with
I looked through it and couldn't figure out what kinds of updates you would like there. Perhaps you can push a commit for that?
I added 5a08154 for this! |
80b7d86
to
5a08154
Compare
Sorry, I meant a label tag in github. I created it and added it to your newly created issues. |
Did the merging, give me 20 minutes to do cleanup. |
Co-authored-by: Erik Sundell <[email protected]>
27c5953
to
7ee6bdb
Compare
@consideRatio I think this change is great and we're almost ready to merge it. You've already seen that I tried to merge style and not related improvements separately. The reason for asking:
|
Maybe this should do it? |
A note to myself that this can be relevant code to add back in the future so it feels fine removing it here. import json
from contextlib import contextmanager
def _gwc(command_name, command_value="", **params):
if not os.environ.get("GITHUB_ACTIONS"):
return
# Assume non-string values are meant to be dumped as JSON
if not isinstance(command_value, str):
command_value = json.dumps(command_value)
print(f"dumped json: {command_value}")
if params:
comma_sep_params = ",".join([f"{k}={v}" for k, v in params.items()])
print(f"::{command_name} {comma_sep_params}::{command_value}")
else:
print(f"::{command_name}::{command_value}")
@contextmanager
def _gwc_group(group_name):
"""
Entering the context prints the group command, and exiting the context
prints the endgroup command.<<
"""
try:
yield _gwc("group", group_name)
finally:
_gwc("endgroup", group_name) |
@consideRatio I think I'm done here and I simplified this PR as much as possible :) @manics could you also take a look, please? |
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 LGTM! Thanks for your work to extract unrelated changes from this PR @mathbunnyru!
(I introduced these changes to simplify the arm64 feature development, as grouping and line breaks helped me read code/logs and think more clearly.)
Btw @mathbunnyru regarding:
If we decide to go with Github self-hosted runners, we might want to more-or-less revert this change.
I think with self-hosted arm64 runners to complement the amd64 runners we get from GitHub, the changes we need are very small.
- For testing, we can instead of using
-multi
we just exclude the suffix and voila we have build + test that is architecture native and high performance running in parallel. - For publishing of the docker images, we should probably run the
push-all-multi
workflow on a single arch and rely on docker buildx to do a multi-platform build from scratch. - For publishing of arm64 manifests, we could let a arm64 job run that doesn't also try to do
push-all-multi
but does indeed do the manifest creation stuff and makes sure it becomes clear it is for the arm64 version rather than amd64 version.
Note that the only change required to use a self-hosted runner, I think, is to declare it as part of a job. I figure we configure our jobs to run twice using a matrix strategy for the job.
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.
Nice work, LGTM 😃
FYI if you wanted to avoid building amd64 twice you could tag each architecture separately and use docker manifest
to create the multi-architecture manifest list https://docs.docker.com/engine/reference/commandline/manifest/`
e.g. docker manifest base-notebook:<tag> base-notebook:<tag>-amd64 base-notebook:<tag>-arm64
but if your long term plan is to support even more architectures your current approach makes sense.
@manics is it Btw we do don't spend 2x time by building the absolute same images twice thanks to cache, so that part isn't a big problem. But, we do build the same image once for each arch, and in the same job - and it takes a much longer time to emulate the non-native arch build. Thanks @manics for your pioneering work on arm64 builds in other repos! ❤️ 🎉 I'm very excited to now let z2jh be fully arm64 compatible!
|
We did it @mathbunnyru @manics!!! 🎉 🌻 ❤️ |
Great news! @consideRatio awesome work 👍 |
Yes thank you @holdenk!!! ❤️ 🎉 |
Complemented this PR with #1408 |
Thank y'all for carrying this all the way to the finish line, I am so thankful and yay arm64 images for all :D |
This is a POC, do not merge.
Based on @holdenk PR, with some fixes and additions.