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

feat: Support Bazel platform mappings #9300

Merged
merged 6 commits into from Apr 2, 2024

Conversation

aran
Copy link
Contributor

@aran aran commented Feb 7, 2024

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
Copy link
Contributor Author

aran commented Feb 14, 2024

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
Copy link
Contributor Author

aran commented Mar 13, 2024

@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
@renzodavid9
Copy link
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 force-pushed the bazel-platforms branch 2 times, most recently from c51fd3e to 82af6fa Compare March 14, 2024 20:23
@aran
Copy link
Contributor Author

aran commented Mar 14, 2024

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 feat: Support Bazel platform mappings Mar 22, 2024
@aran
Copy link
Contributor Author

aran commented Mar 22, 2024

@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.

Copy link

codecov bot commented Mar 26, 2024

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.

@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
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
15 checks passed
@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`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support bazel platforms
3 participants