admin管理员组文章数量:1332352
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 fettable. 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:
ctx.actions.run(
executable = ctx.attr.prerequisite[DefaultInfo].files_to_run,
outputs = [],
)
But that fails:
Error in run: param 'outputs' may not be empty
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"?
本文标签: Prerequisite action in custom Bazel ruleStack Overflow
版权声明:本文标题:Pre-requisite action in custom Bazel rule - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742321087a2452798.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论