Skip to content

Commit c6f6c11

Browse files
committed
infra: add docs on the bors setup
1 parent 7da64d0 commit c6f6c11

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
- [AWS access for team members](./infra/docs/aws-access.md)
5353
- [AWS access management](./infra/docs/aws-access-management.md)
5454
- [Bastion server](./infra/docs/bastion.md)
55+
- [Bors](./infra/docs/bors.md)
5556
- [Crater agents](./infra/docs/crater-agents.md)
5657
- [Custom GitHub Actions runners](./infra/docs/gha-self-hosted.md)
5758
- [Discord moderation bot](./infra/docs/discord-mods-bot.md)

src/infra/docs/bors.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Bors
2+
3+
The infrastructure team manages an instance of [Homu] called "Bors", to be used
4+
by repositories inside the `rust-lang` organization. The instance is available
5+
at [bors.rust-lang.org], and is backed by the [@bors] GitHub account.
6+
7+
The service is configured [with Terraform][tf], and it's automatically deployed
8+
from the [rust-lang/homu] repository onto our [ECS cluster][ecs].
9+
10+
## Maintenance procedures
11+
12+
### Fixing inconsistencies in the queue
13+
14+
Homu is quite buggy, and it might happen that the queue doesn't reflect the
15+
actual state in the repositories. This can be fixed by pressing the
16+
"Synchronize" button in the queue page. Note that the synchronization process
17+
itself is a bit buggy, and it might happen that PRs which were approved but
18+
failed are re-approved again on their own.
19+
20+
### Adding a new repository to bors
21+
22+
There are multiple steps needed to add a repository to our Bors instance:
23+
24+
1. The [@bors] GitHub account needs to be granted write access to the
25+
repository.
26+
27+
2. Each CI provider needs to have a single GitHub Check Run to gate on. This is
28+
not provided by default on GitHub Actions, but it can be simulated with
29+
these two jobs, which will generate a `bors build finished` check:
30+
31+
```yaml
32+
end-success:
33+
name: bors build finished
34+
if: success()
35+
runs-on: ubuntu-latest
36+
needs: [ALL, OTHER, JOBS]
37+
steps:
38+
- name: Mark the job as successful
39+
run: exit 0
40+
41+
end-failure:
42+
name: bors build finished
43+
if: "!success()"
44+
runs-on: ubuntu-latest
45+
needs: [ALL, OTHER, JOBS]
46+
steps:
47+
- name: Mark the job as a failure
48+
run: exit 1
49+
```
50+
51+
Make sure to replace `[ALL, OTHER, JOBS]` with a list of all the jobs you
52+
want to gate on.
53+
54+
3. Add the repository name to the `permissions!` macro in the [team
55+
repository][team-permissions.rs], and grant the `bors.REPOSITORY.review`
56+
permission to the right people.
57+
58+
3. Add the repository to the `repositories` map in [the Terraform configuration
59+
file][tf-repos]. This will create a webhook and inject its secret key in the
60+
bors execution environment.
61+
62+
4. Add the repository to the [Bors configuration][bors-config], taking
63+
inspiration from other repositories.
64+
65+
[@bors]: https://github.com/bors
66+
[Homu]: https://github.com/rust-lang/homu
67+
[bors-config]: https://github.com/rust-lang/homu/blob/master/cfg.production.toml
68+
[bors.rust-lang.org]: https://bors.rust-lang.org
69+
[ecs]: ./ecs-service.md
70+
[rust-lang/homu]: https://github.com/rust-lang/homu
71+
[team-permissions.rs]: https://github.com/rust-lang/team/blob/master/src/permissions.rs
72+
[tf-repos]: https://github.com/rust-lang/simpleinfra/blob/master/terraform/bors/_config.auto.tfvars
73+
[tf]: https://github.com/rust-lang/simpleinfra/tree/master/terraform/bors/

0 commit comments

Comments
 (0)