Philipp Schrader | 37fdbb6 | 2021-12-18 00:30:37 -0800 | [diff] [blame] | 1 | def _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", """\ |
| 9 | RUNNING_IN_CI = {} |
| 10 | """.format(running_in_ci)) |
| 11 | repository_ctx.file("BUILD", "") |
| 12 | |
| 13 | ci_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 | ) |