Skip to content

Commit

Permalink
bazel,ci: propagate TEST_TMPDIR down to go tests and capture artifacts
Browse files Browse the repository at this point in the history
This fulfills a long-standing request to capture left-over artifacts in
`TMPDIR` (see cockroachdb#59045 (comment)).

Bazel sets the `TEST_TMPDIR` environment variable for the temporary
directory and expects all tests to write temporary files to that
directory. In our Go tests, however, we consult the `TMPDIR` environment
variable to find that directory. So we pull in a custom change to
`rules_go` to copy `TEST_TMPDIR` to `TMPDIR`. Update `.bazelrc` to use
`/artifacts/tmp` as the `TEST_TMPDIR`.

Closes cockroachdb#59045.
Closes cockroachdb#69372.

Release justification: Non-production code change
Release note: None
  • Loading branch information
rickystewart committed Aug 26, 2021
1 parent c5e912e commit 976f673
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ build:ci --host_crosstool_top=@toolchain_cross_x86_64-unknown-linux-gnu//:suite
test:ci --test_env=GO_TEST_WRAP_TESTV=1
# Dump all output for failed tests to the build log.
test:ci --test_output=errors
test:ci --test_tmpdir=/artifacts/tmp

# cross-compilation configurations. Add e.g. --config=crosslinux to turn these on
# TODO(ricky): Having to specify both the `platform` and the `crosstool_top` is
Expand Down
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
# Load go bazel tools. This gives us access to the go bazel SDK/toolchains.
git_repository(
name = "io_bazel_rules_go",
commit = "91c4e2b0f233c7031b191b93587f562ffe21f86f",
commit = "4a7bcc9b9051eb6a12bcb03a9bf38138c4bbc2ea",
remote = "https://github.com/cockroachdb/rules_go",
)

Expand Down

0 comments on commit 976f673

Please sign in to comment.