Take two: Make local/docker implementation platform-aware#305
Conversation
7154d6b to
045de7a
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #305 +/- ##
==========================================
+ Coverage 34.06% 34.66% +0.61%
==========================================
Files 39 39
Lines 3301 3359 +58
==========================================
+ Hits 1124 1164 +40
- Misses 1982 2000 +18
Partials 195 195 🚀 New features to boost your workflow:
|
045de7a to
c9be91c
Compare
Signed-off-by: Bozhidar Marinov <bozhidar.marinov1@digits.schwarz>
c9be91c to
1584d5b
Compare
|
Dropped the ball on this for a while, but finally got around to polishing it up. Tested with a lifecycle built with the PRed version of (Unsure if the windows failure is related to my changes.) |
| } | ||
|
|
||
| func defaultPlatform(dockerClient DockerClient) (imgutil.Platform, error) { | ||
| func defaultPlatform(dockerClient DockerClient) (imgutil.Platform, bool, error) { |
There was a problem hiding this comment.
this looks good - do you think we can get some tests with mocks? The new platform aware paths look right but tests mocking out the api version to confirm the called methods would make me feel a bit better.
There was a problem hiding this comment.
I ended up adding a test job that uses containerd in the workflow, plus a test which only gets called in that job and should exercise the platform-aware code paths.
038b1b4 to
f7c1b46
Compare
GitHub actions currently ships an old version of Docker without support for multi-platform images or the containerd storage backend. Signed-off-by: Bozhidar Marinov <bozhidar.marinov1@digits.schwarz>
Signed-off-by: Bozhidar Marinov <bozhidar.marinov1@digits.schwarz>
f7c1b46 to
c36b3eb
Compare
|
Thanks for this! I'll try and bump lifecycle to this commit and see how that lands. |
|
Let's hope it has better luck than last time! 😅 😅 |
Second attempt at #302 after buildpacks/lifecycle#1605.
Poking around the
failed to export: saving image: failed to fetch base layers:error, I discovered that:docker image inspect --platform ...i useless for use with other commands. (See also c8d: unable to reference platform-specific images by ID moby/moby#49995) Hence, we run both a platform-specific inspect for the layer info and a platform-agnostic inspect for the image ID.ImageHistoryalso has a--platformargument. Passing in the same platform as used for inspecting the image seems prudent.ensureLayerscallsImageSavewhich also has a--platformargument. We need to pass that, as otherwise we will try to load layers for the wrong architecture.ImageLoadandImageRemovealso have platform arguments.ImageLoadis going to autodetect the correct platform when we pass it with the tar archive;ImageRemovedeleting the other platforms under the same tag is probably a good thing.I tested locally with creating an
linux/amd64builder from a lifecycle which includes the new changes.linux/amd64linux/amd64linux/amd64linux/amd64linux/arm64- wronglinux/amd64linux/arm64- wronglinux/amd64