Skip to content

feat: Support Bazel platform mappings#9300

Merged
renzodavid9 merged 6 commits into
GoogleContainerTools:mainfrom
aran:bazel-platforms
Apr 2, 2024
Merged

feat: Support Bazel platform mappings#9300
renzodavid9 merged 6 commits into
GoogleContainerTools:mainfrom
aran:bazel-platforms

Conversation

@aran

@aran aran commented Feb 7, 2024

Copy link
Copy Markdown
Contributor

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.

@aran

aran commented Feb 14, 2024

Copy link
Copy Markdown
Contributor Author

Looking for some feedback on whether I should drop this change, continue with some modifications to the approach, or continue as-is. Let me know! Thanks.

@aran

aran commented Mar 13, 2024

Copy link
Copy Markdown
Contributor Author

@renzodavid9 This is the PR we discussed in the Skaffold office hours call at end of Feb. Would be great to get your feedback if you have a chance. Thanks!

@renzodavid9 renzodavid9 self-requested a review March 13, 2024 00:05
@renzodavid9 renzodavid9 added the kokoro:force-run forces a kokoro re-run on a PR label Mar 13, 2024
@kokoro-team kokoro-team removed the kokoro:force-run forces a kokoro re-run on a PR label Mar 13, 2024
Comment thread pkg/skaffold/schema/latest/config.go Outdated
@renzodavid9

Copy link
Copy Markdown
Contributor

Hey @aran,

I'll get familiar with the Bazel platforms to understand more about how they work. Also I'll check if we need to do changes in other parts of Skaffold in order to fully support this. Thanks!

@aran

aran commented Mar 14, 2024

Copy link
Copy Markdown
Contributor Author

If this looks ok from an API and rough approach standpoint, I can look into details, tests, compliance with Skaffold project standards, etc.

One open edge case question would be how to handle if someone passes --platforms to BazelArtifact BuildArgs as well as PlatformMappings.

Another one would be whether include any special handling for hierarchical skaffold platforms like 'linux/arm64/v8'.

Let me know, thanks!

@pull-request-size pull-request-size Bot added size/L and removed size/M labels Mar 22, 2024
@aran aran changed the title [RFC] Support Bazel platform mappings Mar 22, 2024
@aran

aran commented Mar 22, 2024

Copy link
Copy Markdown
Contributor Author

@renzodavid9 I updated the PR title and top-level comment to meet project guidelines. This is now ready for review.

  • Changes to the configuration are documented to spec.
  • Generated code is checked in.
  • Added unit test.
  • Updated examples/bazel and its duplicate in integration/examples/bazel. These I tested manually.
  • Filed an issue which this closes for project tracking.
@codecov

codecov Bot commented Mar 26, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.21%. Comparing base (290280e) to head (03f8acc).
Report is 1130 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9300      +/-   ##
==========================================
- Coverage   70.48%   63.21%   -7.28%     
==========================================
  Files         515      642     +127     
  Lines       23150    32989    +9839     
==========================================
+ Hits        16317    20853    +4536     
- Misses       5776    10527    +4751     
- Partials     1057     1609     +552     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment thread pkg/skaffold/schema/latest/config.go Outdated
@renzodavid9 renzodavid9 added the kokoro:force-run forces a kokoro re-run on a PR label Mar 27, 2024
@kokoro-team kokoro-team removed the kokoro:force-run forces a kokoro re-run on a PR label Mar 27, 2024
@renzodavid9 renzodavid9 added the kokoro:run runs the kokoro jobs on a PR label Mar 28, 2024
@kokoro-team kokoro-team removed the kokoro:run runs the kokoro jobs on a PR label Mar 28, 2024
Comment thread pkg/skaffold/schema/latest/config.go Outdated
aran added 6 commits March 29, 2024 12:58
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.
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`
@renzodavid9 renzodavid9 added the kokoro:run runs the kokoro jobs on a PR label Apr 2, 2024
@kokoro-team kokoro-team removed the kokoro:run runs the kokoro jobs on a PR label Apr 2, 2024
@renzodavid9 renzodavid9 merged commit 4969c22 into GoogleContainerTools:main Apr 2, 2024
@aran aran deleted the bazel-platforms branch April 4, 2024 02:30
renzodavid9 pushed a commit that referenced this pull request Apr 5, 2024
* Update Bazel builder documentation to include an example
 * Update Skaffold cross-platform page to document that Bazel cross-platform builds are now supported.

Depends on #9300.

Tested with `make preview-docs-v2`.
Note unrelated POSTCSS error present in main in `./hack/check-docs.sh`/`make build-docs-preview`
@menahyouyeah menahyouyeah mentioned this pull request Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3 participants