bazelbuild / bazelbuild/bazel

Option to disallow rules from including stable-status/volatile-status as action inputs

Open
#14,341 9 comments 1 reaction 1 assignee Claimed by @buildbreaker2021 View on GitHub
P2 team-Rules-API type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

In working on rules_docker, I found that regardless of any configuration of the build, actions were non-deterministic because the presence of a `{` character in certain attributes caused rules like `container_image` to *always* stamp outputs, and since the stable-status.txt file is an input to the action, it was non-deterministic and caused cache misses.

Since there's no real contract between Bazel and rulesets regarding the meaning of `--stamp` and how rules should present a non-deterministic stamping facility to users, there's a lot of inconsistency. (For starters, ctx.info_file and ctx.status_file are undocumented) I think we'd benefit from an `--incompatible` flag on Bazel itself.

As a strawman, call it `--incompatible_prevent_status_files_without_stamp` which, unless `--stamp` is also present, would either prevent the *-status.txt files from being passed as inputs to actions, or would error the build and point to the rule implementation that is including those files as inputs.

Related:
- https://github.com/bazelbuild/bazel/issues/11164
- https://github.com/bazelbuild/bazel/issues/9363
- https://github.com/bazelbuild/bazel/issues/10177

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.