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

Support for "runs-before" executable rule dependencies #24468

Open
ouillie opened this issue Nov 22, 2024 · 0 comments
Open

Support for "runs-before" executable rule dependencies #24468

ouillie opened this issue Nov 22, 2024 · 0 comments
Labels
team-Rules-API API for writing rules/aspects: providers, runfiles, actions, artifacts type: feature request untriaged

Comments

@ouillie
Copy link

ouillie commented Nov 22, 2024

Description of the feature request:

Bazel executable and test rules should be able to express dependencies on other executable rules that should always run before the given exe/test rule. This could probably be implemented as an extension to DefaultInfo that allows specifying "runs-before" executable dependencies for executable and test rules. This should only be available to executable and test rules, not build rules.

Which category does this issue belong to?

Rules API

What underlying problem are you trying to solve with this feature?

Bazel hates side effects. Fair enough. But bazel also supports side effects with bazel run for executable rules. There are use-cases where the side effects of one executable rule are important for the execution of another executable rule. I have a motivating case where the system I'm testing insists on pulling an image from an OCI container registry. AFAIK bazel cannot realistically support container registry artifacts as build outputs, so I'm stuck with manually running the side-effectful oci_push to create the necessary conditions for the test to run. It's error-prone and makes Bazel IDE integrations much less usable.

Which operating system are you running Bazel on?

Linux / x86_64

What is the output of bazel info release?

release 7.3.1

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?

I haven't meaningfully explored the implementation yet. Just gathering feedback for now.

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

@github-actions github-actions bot added the team-Rules-API API for writing rules/aspects: providers, runfiles, actions, artifacts label Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Rules-API API for writing rules/aspects: providers, runfiles, actions, artifacts type: feature request untriaged
Projects
None yet
Development

No branches or pull requests

4 participants