Skip to content

Commit 2af5233

Browse files
authored
Move SOP for new repos to more fleshed out repository-structure doc (#137)
We want to describe the desired state, not just the steps for new repos. In particular a goal here is to flesh out how CI/testing should work and lean into the pattern that our projects should provide integration tests and how those should work. Signed-off-by: Colin Walters <walters@verbum.org>
1 parent a9c43f8 commit 2af5233

3 files changed

Lines changed: 87 additions & 64 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This repository provides centralized configuration and automation for the
1313

1414
## Documentation
1515

16-
- [New Repository Setup](docs/SOP-new-repository.md) - Steps for onboarding new repos
16+
- [Repository Structure](docs/repository-structure.md) - Organization-wide repository standards
1717

1818
## Renovate
1919

docs/SOP-new-repository.md

Lines changed: 0 additions & 63 deletions
This file was deleted.

docs/repository-structure.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Repository structure
2+
3+
The bootc-dev organization contains a number of repositories. While not every
4+
repository will function in exactly in the same way, there are
5+
"baseline" configuration and procedures that should generally apply.
6+
7+
## Maintainers
8+
9+
There should be a `maintainers` team with the **Maintain** permission
10+
that is used by repositories by default.
11+
12+
## Renovate
13+
14+
The organization uses a centralized Renovate configuration managed from this
15+
repository. To enable Renovate on a new repository, create a `renovate.json`
16+
file in the repository root:
17+
18+
```json
19+
{
20+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
21+
"extends": [
22+
"local>bootc-dev/infra:renovate-shared-config.json"
23+
]
24+
}
25+
```
26+
27+
## PR gating and merging
28+
29+
Each repository MUST enable the following settings via a branch protection rule for `main`:
30+
31+
- Require a pull request before merging
32+
- Require approvals
33+
34+
### required-checks
35+
36+
Having some kind of CI is also required. Repositories SHOULD enable the automatic merge setting,
37+
and configure at least one gating CI check.
38+
39+
The ["required-checks" pattern](https://github.com/bootc-dev/bootc/blob/main/.github/workflows/ci.yml)
40+
is where the repository configuration gates solely on that check which in turn gates on others, allowing easy dynamic
41+
reconfiguration of the required checks without requiring administrator intervention.
42+
43+
## Language
44+
45+
In this organization, Rust is preferred.
46+
47+
## Developer experience
48+
49+
Repositories SHOULD have a [Justfile](https://just.systems/) which acts as a development entry point. It
50+
is strongly encouraged to follow the pattern in [bootc Justfile](https://github.com/bootc-dev/bootc/blob/main/Justfile)
51+
where e.g. GitHub Actions mostly invoke `just <x>` so all CI flows are easily
52+
replicable outside of GHA.
53+
54+
## Devcontainer
55+
56+
Repositories SHOULD have a `.devcontainer.json` (one is synchronized by default from this repo)
57+
and key targets in the `Justfile` should run in that environment.
58+
59+
## Unit and integration tests
60+
61+
Any nontrivial code SHOULD have unit tests and integration tests. An integration test MUST
62+
be a separately built artifact that tests a production build in a "black box" fashion.
63+
64+
### Integration test environments
65+
66+
Integration tests SHOULD be flexible and adaptable. In particular, there are multiple
67+
"test suite runner environments" which our integration tests should work with.
68+
69+
- [Debian autopkgtest](https://wiki.debian.org/autopkgtest)
70+
- [tmt](https://tmt.readthedocs.io/en/stable/) (and [Fedora CI](https://packit.dev/fedora-ci/))
71+
72+
Privileged and destructive tests should be clearly distinct.
73+
74+
At the current time, bootc has some "bridging" between a custom integration test suite
75+
and tmt. However, a pattern used in other repositories is to have an integration test
76+
binary written in Rust that uses `libtest-mimic` - in this pattern all tests are just
77+
part of a simple single binary.
78+
79+
- [composefs-rs](https://github.com/composefs/composefs-rs/tree/main/crates/integration-tests)
80+
- [bcvk](https://github.com/bootc-dev/bcvk/blob/main/Justfile)
81+
82+
### Future direction
83+
84+
Goal: Convert all repositories to a pattern like this, and create reliable bridging
85+
between it and tmt and Debian autopkgtest. For example, support converting
86+
the tests into the relevant framework format.

0 commit comments

Comments
 (0)