Skip to content

strict_action_env equivalent for repository rules #10996

@uri-canva

Description

@uri-canva

Description of the problem / feature request:

An equivalent of --incompatible_strict_action_env that affects repository_ctx.execute.

Feature requests: what underlying problem are you trying to solve with this feature?

When I write repository rule implementations I often forget to declare the environment variables they depend on, so they are not reevaluated when those change, leading to incorrect builds, and requiring users to call bazel clean --expunge when the environment changes.

I have tried to filter the environment down to what I need before passing it to repository_ctx.execute, but the full environment is always added anyway:

return SkylarkExecutionResult.builder(osObject.getEnvironmentVariables())
.

A way to enforce the environment to be strict would be very helpful to avoid these kind of bugs in repository rules.

Have you found anything relevant by searching the web?

#7026

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3We're not considering working on this, but happy to review a PR. (No assignee)not staleIssues or PRs that are inactive but not considered staleteam-ExternalDepsExternal dependency handling, remote repositiories, WORKSPACE file.type: feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions