-
-
Notifications
You must be signed in to change notification settings - Fork 165
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
How to push image to multiple repositories? #248
Comments
this can be done by simply having two oci_push targets. |
I understand that, but it doesn't scale well. In our case, we have 4 repository / tag variations per image. Even with macros to expand to multiple targets, it is not possible push all from one target / bazel command. (bazelbuild/bazel#10855) I'm looking for feature parity with the functionality of |
this could be done by running all oci_push targets in a sh_binary target.
this is essentially what container_bundle does as I said above. Unfortunately, we are |
You can use https://github.com/keith/rules_multirun to make a single You could write a macro that emulates
WDYT? As a design choice, we want rules_oci to only contain things that aren't already possible by layering with other rulesets, keeping it orthogonal and low-maintenance. |
@alexeagle, thanks for the example, having it in the |
This comment was marked as off-topic.
This comment was marked as off-topic.
@alexeagle sorry for the late reply... Thanks for the suggestion. The use of multi-run works OK, but I am not able to use Edit: My original example was also hardcoded, but we use environment variable from workspace status which worked in rules_docker but does not work here. container_bundle(
name = "image_bundle",
images = {
"gcr.io/prysmaticlabs/prysm/beacon-chain:{DOCKER_TAG}": ":image_with_creation_time",
"index.docker.io/prysmaticlabs/prysm-beacon-chain:{DOCKER_TAG}": ":image_with_creation_time",
},
tags = ["manual"],
visibility = ["//beacon-chain:__pkg__"],
)
docker_push(
name = "push_images",
bundle = ":image_bundle",
tags = ["manual"],
visibility = ["//beacon-chain:__pkg__"],
) See: https://github.com/bazelbuild/rules_docker#stamping |
An example of a "thing that isn't possible by layering other rulesets" might be efficiently pushing multiple images at once. For example, using the It feels like this should eventually be possible when this I don't think |
Building off of #248 (comment), there are arguably two separate but related issues here:
Perhaps (2) should be split off into another issue, as that's the part that it's difficult to do on top of rules_oci. The fact that a solution for it might also resolve (1) is just a bonus. |
IMHO |
There's some discussion of this on some other thread that I'm having trouble finding right now. TBH the maintainers here just don't have time and effort to make progress on a design for that right now. I'm also not clear whether such an experiment necessarily has to be performed in rules_oci, or if you could prove the concept in a separate derivative ruleset to start with. |
Agree with your reasoning. It is all about reproducability, and in my books this includes But with the current (design) limitation of being able to only run a single "run target" per invocation (need to take a crack at |
There shouldn't be a need to list them explicitly. A bazel query command can be piped in a shell one-liner |
correct, but I would now need to maintain this additional "job executor" (even if it is just some Don't get me wrong please, I know it is doable, I am just questioning if it is the right way/design. |
IMO the issue here isn't really about how to push to multiple repositories with a single target, as that's reasonably simple to do with your own wrapper rules or something like rules_multirun. Also I don't think considering changing something fundamental to Bazel like The focus should be on what functionality can either only be provided by implementing this in rules_oci or would be significantly more difficult to do so. I believe that's primarily making it more efficient. There is additionally an argument for having common functionality be in rules_oci so it can be maintained by those who already have experience writing/maintaining Bazel rules. That is to say there has been a general philosophy thus far that only maintainers of Bazel rules repos should need to know how to write a rule. For better or worse, I believe that's an argument that the rules_oci maintainers have rejected. |
Adding to what @SanjayVas said, and replying to @alexeagle:
I agree on low-maintenance and re-using other rulesets but that's precisely the point, implementing it once in Of course there's always a fine line of what functionality should be added to any project but I think that, in this case, this is a really good one to have in |
I am trying to replicate logic from rules_docker where I can have a
container_bundle
given to adocker_push
.The end result was that I pushed an image to multiple repositories with a single target.
The text was updated successfully, but these errors were encountered: