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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update hardcoded error message to pull images without architecture #2318

Merged
merged 2 commits into from
Jan 15, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions pkg/image/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,9 @@ func (f *Fetcher) Fetch(ctx context.Context, name string, options FetchOptions)
// FIXME: this matching is brittle and the fallback should be removed when https://github.com/buildpacks/pack/issues/2079
// has been fixed for a sufficient amount of time.
// Sample error from docker engine:
// `image with reference <image> was found but does not match the specified platform: wanted linux/amd64, actual: linux`
if strings.Contains(err.Error(), "does not match the specified platform") &&
(strings.HasSuffix(strings.TrimSpace(err.Error()), "actual: linux") ||
strings.HasSuffix(strings.TrimSpace(err.Error()), "actual: windows")) {
// `image with reference <image> was found but does not match the specified platform: wanted linux/amd64, actual: linux` or
// `image with reference <image> was found but its platform (linux) does not match the specified platform (linux/amd64)`
if strings.Contains(err.Error(), "does not match the specified platform") {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this meant as a quick fix? Because it would break again if docker decides to change the wording. But a quick fix would be highly appreciated since this is really critical for us.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah! I can take a look later and try to find a better solution, but I wanted to unblock end-users with it

f.logger.Debugf(fmt.Sprintf("Pulling image %s", style.Symbol(name)))
err = f.pullImage(ctx, name, "")
}
Expand Down
Loading