blob: b490f7945efe25b88a9bba8114f365ee44d43e1f [file] [log] [blame]
Philipp Schrader37fdbb62021-12-18 00:30:37 -08001def _ci_configure_impl(repository_ctx):
2 """This repository rule tells other rules whether we're running in CI.
3
4 Other rules can use this knowledge to make decisions about enforcing certain
5 things on buildkite while relaxing restrictions during local development.
6 """
7 running_in_ci = repository_ctx.os.environ.get("FRC971_RUNNING_IN_CI", "0") == "1"
8 repository_ctx.file("ci.bzl", """\
9RUNNING_IN_CI = {}
10""".format(running_in_ci))
11 repository_ctx.file("BUILD", "")
12
13ci_configure = repository_rule(
14 implementation = _ci_configure_impl,
15 environ = [
16 # This is set in CI via tools/ci/buildkite.yaml.
17 "FRC971_RUNNING_IN_CI",
18 ],
19)