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

Support bazel platforms #9360

Closed
aran opened this issue Mar 22, 2024 · 0 comments · Fixed by #9300
Closed

Support bazel platforms #9360

aran opened this issue Mar 22, 2024 · 0 comments · Fixed by #9300

Comments

@aran
Copy link
Contributor

aran commented Mar 22, 2024

Skaffold uses github.com/opencontainers/image-spec/specs-go/v1 and containerd strings like "linux/amd64" or "linux/arm64/v7" to represent platforms.

Bazel's platform system uses bazel targets to define platforms (https://bazel.build/extending/platforms). While there are common cpu and os definitions available, each Bazel project defines its own target platforms (!)

Currently, when skaffold invokes bazel, skaffold's platform information is not passed to Bazel. Bazel defaults to the host platform, unless the target skaffold is building explicitly specifies a platform.

To allow a Bazel + Skaffold project to flexibly target multiple platforms, skaffold should provide a mechanism to invoke bazel with --platforms when cross-compiling, based on its own --platform setting.

renzodavid9 pushed a commit that referenced this issue Apr 2, 2024
* feat: Support Bazel platform mappings

This change introduces an artifact-level setting for configuring Bazel and
defines a platform mapping from Skaffold platforms to Bazel platforms.
The Bazel artifact builder then passes the --platforms flag to Bazel if applicable.

Fixes #9360.

* Update examples/bazel

* Copy examples/bazel to integration/examples/bazel

* Add unit test

* Remove bazel platforms from examples/bazel

Summary: According to ./hack/check-samples.sh,

'''
# /examples should use the latest released version
LATEST_RELEASED="skaffold/$(go run ./hack/versions/cmd/latest_released/version.go)"
'''

The new 'platforms' field is in v4beta10 and not available in a released version yet, so CI fails.

It can be added to /examples/bazel later, after a release.

Test Plan: `./hack/check-samples.sh`

* Remove yaml block that breaks docs
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 a pull request may close this issue.

1 participant