Skip to content

fix: warn instead of fail for multi-arch builds #7145

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

Merged

Conversation

gsquared94
Copy link
Contributor

@gsquared94 gsquared94 commented Feb 28, 2022

Fixes: #7132
Related: 6120

Description

For mixed platform kubernetes clusters, skaffold was attempting to build multi-arch images. Since this feature isn't implemented yet, it was throwing an error for docker builder. This effectively breaks backwards compatibility for users of previous skaffold versions that were using mixed platform clusters.

This PR reduces these errors to warning messages asking the user to explicitly set the target platform, but continuing on with the run as before.
User facing changes (remove if N/A)

Get a warning message like:

Starting build...
Building [skaffold-example]...
Target platforms: [linux/amd64,linux/arm64]
WARN[0001] multiple target platforms "linux/amd64,linux/arm64" found for artifact "skaffold-example". Skaffold doesn't yet support multi-platform builds for the docker builder. Consider specifying a single target platform explicitly. See https://skaffold.dev/docs/pipeline-stages/builders/#cross-platform-build-support  subtask=skaffold-example task=Build
[+] Building 0.1s (11/11) FINISHED
...                                                                                            
Starting deploy...
 - pod/getting-started created
Waiting for deployments to stabilize...
 - pods: creating container getting-started
    - pod/getting-started: creating container getting-started
 - pods is ready.
Deployments stabilized in 34.975 seconds

@gsquared94 gsquared94 requested a review from a team as a code owner February 28, 2022 02:52
@codecov
Copy link

codecov bot commented Feb 28, 2022

Codecov Report

Merging #7145 (ce51008) into main (290280e) will decrease coverage by 2.09%.
The diff coverage is 56.96%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #7145      +/-   ##
==========================================
- Coverage   70.48%   68.39%   -2.10%     
==========================================
  Files         515      560      +45     
  Lines       23150    26256    +3106     
==========================================
+ Hits        16317    17957    +1640     
- Misses       5776     7060    +1284     
- Partials     1057     1239     +182     
Impacted Files Coverage Δ
cmd/skaffold/app/cmd/deploy.go 52.00% <ø> (-1.85%) ⬇️
cmd/skaffold/app/cmd/dev.go 84.61% <0.00%> (ø)
cmd/skaffold/app/cmd/render.go 36.66% <0.00%> (-4.72%) ⬇️
cmd/skaffold/skaffold.go 0.00% <0.00%> (ø)
cmd/skaffold/app/cmd/inspect_tests.go 62.50% <14.28%> (-1.14%) ⬇️
cmd/skaffold/app/cmd/lsp.go 28.12% <28.12%> (ø)
cmd/skaffold/app/cmd/fix.go 68.85% <40.00%> (-7.62%) ⬇️
cmd/skaffold/app/cmd/lint.go 42.85% <42.85%> (ø)
cmd/skaffold/app/cmd/find_configs.go 48.88% <50.00%> (+0.24%) ⬆️
cmd/skaffold/app/skaffold.go 76.19% <70.00%> (-8.43%) ⬇️
... and 216 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1dbc7a2...ce51008. Read the comment docs.

@@ -117,7 +117,7 @@ func (b *Builder) dockerCLIBuild(ctx context.Context, out io.Writer, workspace s
} else {
cmd.Env = append(cmd.Env, "DOCKER_BUILDKIT=0")
}
} else if matcher.IsNotEmpty() { // cross-platform builds require buildkit
} else if len(matcher.Platforms) == 1 { // cross-platform builds require buildkit
cmd.Env = append(cmd.Env, "DOCKER_BUILDKIT=1")
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a debug statement here indicating we set Docker_Buildkit=1 and why.

@gsquared94 gsquared94 force-pushed the fix-6120-multi-arch-checks branch from c42e881 to ce51008 Compare March 1, 2022 09:43
@gsquared94 gsquared94 merged commit 2881bd4 into GoogleContainerTools:main Mar 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

unexpected multiplatform error
2 participants