-
-
Notifications
You must be signed in to change notification settings - Fork 159
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
Feature Request: Promote multi_arch example to oci_multi_arch_image rule #228
Comments
We have plans to make oci_image_index transition an image for multiple platforms but we avoiding it until the |
for now, the answer for this FR is no, unfortunately. we'll keep the issue open for tracking purposes, however. |
@thesayyn what would you think about adding something like aspect bazel lib's platform_transition_filegroup a first-party rule? As it stands IMHO it's a bit strange that you need to either write your own rule or use a third-party dependency to cover a fairly common use case (building an image index including an image built for a different platform). Maybe we could call it "oci_image_transition" and it would have attributes for an image and a platform and it would transition the image to that platform. I actually prefer this approach to having oci_image_index do the transition since it's more explicit what's going on. It would look like:
This does still introduce a transition but in a pretty locked-down manner. And once you have a better option it could be deprecated if you want. WDYT? |
We want to support this but as I said this will create a lot of confusion around why their cc_binary or go_binary with cgo on doesn't work. I'd rather keep this out of rules_oci until bazel's toolchain support improves. |
Optional toolchains are available in Bazel 6 and 7 but not in 5.4.1. What is the support range for rules_oci? Where are optional toolchains needed? By the way, what is it that doesn't work with cc_binary, go_binary and cgo when using transitions? I don't have the background of the Given architecture, I suggest having an |
@thesayyn @alexeagle, do you have any input on direction for the multi arch issue? |
Sorry, i was out sick. It's not that optional toolchains are not supported but the bazel ecosystem hasn't adopted it yet, and adding the transition to the feature matrix here will increase number of help requests we get from rules_oci users. background on rules_docker
If you are on a mac and trying to use this with rules_go you'll get cgo related toolchain errors or if you have cc_binary somewhere in your dependency graph your build simply starts failing. One could debate that this is an issue with the ruleset failing but unfortunately that's not how majority of users think when their build fails because they used an attribute oci_image_index provided. (#472 is an example of this even though we have no transitions) Another thing is that we can't just get away with implementing this in oci_image_index, as oci_image has to do the right thing with Currently this is all left to the user, by using select and platform_transition_filegroup which makes the user liable for breaking their builds.
We don't care about Bazel 5, it's a nice to have but "not too bad" if some things are broken. When we started we left out the transition part on purpose because of whole set of toolchain issues around Bazel. |
@thesayyn I hope you are better now and thank you for the background story. After reading a lot, I think I get the picture. I think the root cause, in the transition code in rules_docker, is that the default behaviour is to pass In #531, I suggest to let the default |
I find the following example a bit counter intuitive:
Building |
I know the How does your suggestion work for that kind of user? |
When using Where do we set platforms and perform the transition, the
Should there be a provider which tells that this dependency path has gone through a platform transition and disallow a second one? Then it would be possible to add the Thinking outside the box, what about My conclusion:
|
That's a lot of design space to explore, and to be honest I also think there's a high chance that we make a wrong decision and are then semver-committed to whatever we made. As it is, we don't have paying customers asking for this so we haven't prioritized it. Of course I would love to have your help to contribute, but we need a lot of confidence that we have correct answers to all the questions you're raising. |
Hi folks! I feel like building a multi-arch image is a common enough workflow that it merits being a proper rule in the repo instead of just an example:
https://github.com/bazel-contrib/rules_oci/blob/main/examples/multi_arch/BUILD.bazel
This one seems pretty trivial to just pull in as a rule, though I understand it would slightly increase the surface area you have to maintain.
The text was updated successfully, but these errors were encountered: