bazelbuild / bazelbuild/bazel

Allow env file with "bazel test"

Open
#955 16 comments 26 reactions 0 assignees View on GitHub
help wanted not stale P3 team-Core type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

Currently, you can pass environment variables one at a time with `--test_env`. It would be nice to be able to pass an entire file of env variables to bazel test with something like:

```
bazel test --test_env_file=.env //...
```

env are becoming semi-standard, and lots of tools understand how to read them. For example:
- `docker run --env-file`
- `foreman --env`
- https://github.com/bkeepers/dotenv

This improvement would allow people to use their existing env files with bazel.

Contributor guide

Open the contributing guide

Research direction

Start with Bazel's `test` command and the existing `--test_env` handling described in the issue. The payload names no implementation files or tests, so first locate those entry points and determine the supported environment-file syntax; done means `bazel test --test_env_file=.env //...` loads the file consistently with individual environment options.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.