Skip to content

Add some (opt in) mechanism to share --repository_cache and --repo_contents_cache #527

@malt3

Description

@malt3

I'm using rules_bazel_integration_test quite happily in rules_img, but one issue I'm seeing a lot is rate limiting with various APIs that are accessed in repo rules while running integration tests.

The reason this is happening is the use of TEST_TMPDIR, which silos many of Bazel's default paths:

https://github.com/bazelbuild/bazel/blob/5b14d04f6d74f5a7238110b38e1d338879e4a545/src/main/cpp/startup_options.cc#L645-L656

You can also see this in Bazel's logs:

$TEST_TMPDIR defined, some defaults will be overridden
...
repository_cache: /home/malte/.cache/bazel/_bazel_malte/cd535aca85f70194fa75f44025138530/sandbox/linux-sandbox/3126/execroot/_main/_tmp/4efa138a8530aba334adcf98db25fa9f/_bazel_malte/cache/repos/v1
...

What I would like to do is to add some configuration that allows users to share the repository cache and repo contents cache across integration tests if they like.
This obviously makes tests less hermetic, as some repository rules may use cached results instead of running from scratch, but if that's acceptable for your test case, it can greatly improve test speeds and avoid accidentally hammering public APIs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions