Skip to content

Docker: pass Options.platform to inspect and default local platform to linux/$GOARCH#302

Merged
jabrown85 merged 2 commits into
buildpacks:mainfrom
bojidar-bg:l1599-local-platform
Feb 11, 2026
Merged

Docker: pass Options.platform to inspect and default local platform to linux/$GOARCH#302
jabrown85 merged 2 commits into
buildpacks:mainfrom
bojidar-bg:l1599-local-platform

Conversation

@bojidar-bg

@bojidar-bg bojidar-bg commented Feb 10, 2026

Copy link
Copy Markdown
Contributor

Fixes buildpacks/lifecycle#1599 in my testing.

Possible issues:

  • Changing the default platform of imgutils.local to match the current binary's architecture is a partial revert of Use daemon or runtime provided arch instead of amd64 #232. I'd rather change it to default to linux/$GOARCH always (and not just when daemonInfo.Os == "linux"), for parity with remote, but I don't know if that will break other packages depending on imgutils. 😅
  • If the base image's architecture does not match the architecture of the wanted platform, the old code used to return the base image anyway. With this change, it would instead error out. Fixed!

@bojidar-bg
bojidar-bg requested a review from a team as a code owner February 10, 2026 15:10
@bojidar-bg
bojidar-bg force-pushed the l1599-local-platform branch 2 times, most recently from aac0f96 to 8458ab0 Compare February 10, 2026 15:36
@codecov

codecov Bot commented Feb 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.88889% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 34.06%. Comparing base (08327da) to head (ee231a0).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #302      +/-   ##
==========================================
+ Coverage   33.79%   34.06%   +0.28%     
==========================================
  Files          39       39              
  Lines        3283     3301      +18     
==========================================
+ Hits         1109     1124      +15     
- Misses       1980     1982       +2     
- Partials      194      195       +1     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jabrown85 jabrown85 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a good idea to me! Left a couple comments to address

Comment thread local/new.go
Comment thread local/new.go
Comment thread local/new.go
if err != nil {
return imgutil.Platform{}, err
}
if daemonInfo.Os == "linux" {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have some tests here around not having a platform defined. I was surprised there weren't any correlated test changes. Should there be a test to capture this new behavior?

@bojidar-bg bojidar-bg Feb 10, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm reading #283 correctly, in the test environment, both the Docker daemon and the imgutil tests run on the same architecture, amd64, hence this ends up causing no change.

A new test would be nice, but I'm not very sure how to introduce it.

Comment thread local/new.go
Signed-off-by: Bozhidar Marinov <bozhidar.marinov1@mail.schwarz>
@bojidar-bg

Copy link
Copy Markdown
Contributor Author

Comments should be handled now; unsure how to add a new test for mismatched architecture between imgutil and the Docker host.

@jabrown85
jabrown85 enabled auto-merge February 11, 2026 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong architecture used when running amd64 buildpack on arm64 host with -daemon flag

2 participants