You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've implemented a custom Bazel test rule. The test executable pulls a Docker image from a local registry. That image can be pushed to the local registry using oci_push. So, in order to make sure the image is always up-to-date, I have to manually push it before running the test each time. It's a two-step process, sort-of like this:
bazel run //image:push-local
bazel test //tests:test
The first step is annoying and easily forgettable. I'd like to make it so that running bazel test //tests:test always pushes the up-to-date image first, then executes the test which pulls that image. I can't figure out how to do it.
I tried adding a prerequisite attribute to the custom test rule, which gets handled in the implementation like this:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I've implemented a custom Bazel test rule. The test executable pulls a Docker image from a local registry. That image can be pushed to the local registry using
oci_push
. So, in order to make sure the image is always up-to-date, I have to manually push it before running the test each time. It's a two-step process, sort-of like this:bazel run //image:push-local bazel test //tests:test
The first step is annoying and easily forgettable. I'd like to make it so that running
bazel test //tests:test
always pushes the up-to-date image first, then executes the test which pulls that image. I can't figure out how to do it.I tried adding a
prerequisite
attribute to the custom test rule, which gets handled in the implementation like this:But that fails:
Well, there aren't any outputs. The
oci_push
rule just returns an executable.Is there some way to express to Bazel "you should always run this executable rule before running this test rule"?
Beta Was this translation helpful? Give feedback.
All reactions