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

feat: improved env substitutions #42

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

peakschris
Copy link

@peakschris peakschris commented Feb 10, 2025

This PR supports additional substitutions on env values supplied in env parameter to itest rules. Substitutions are:

  1. $(location... etc as previously supported
  2. $(OTHERENV)/extra - substitute a different envvar from the input env parameter into this value
  3. $(TESTENV)/extra - substitute TESTENV supplied via bazel's --test_env parameter into this value
  4. $(BINDIR) - relative path to bazel's bin directory

This provides extra flexibility for configuring test cases.

To support this, I found a nicely designed implementation of envvar substitution in environment.bzl in rules_bats, and rather than adding a dependency on rules_bats, I have vendored the file into this repo. It seems that the author has tried to get this file added to bazel_skylib (bazelbuild/bazel-skylib#486), and perhaps it has a future in bazel-lib. If this happened, this vendored copy could be deleted.

This PR is draft for now for feedback/guidance.

(there is also included a minor fix to windows path which prevents bazel run //service from working on windows at present)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant