| 1 |
# How to contribute |
| 2 |
|
| 3 |
Development happens on [GitHub](https://github.com/cilium/ebpf) and contributions in |
| 4 |
all forms are welcome. Please take a look at [the architecture](architecture.md) to get |
| 5 |
a better understanding of the high-level goals. |
| 6 |
|
| 7 |
## Developer Certificate of Origin |
| 8 |
|
| 9 |
The Cilium project requires that all contributions to project repositories carry the |
| 10 |
[Developer Certificate of Origin][DCO]. This is as simple as appending a footer |
| 11 |
to your commits: |
| 12 |
|
| 13 |
``` |
| 14 |
Signed-off-by: Your Name <[email protected]> |
| 15 |
``` |
| 16 |
|
| 17 |
Signing off your contributions this way means that you've read and understood |
| 18 |
the contents of the DCO. |
| 19 |
|
| 20 |
## Running the tests |
| 21 |
|
| 22 |
Many of the tests require privileges to set resource limits and load eBPF code. |
| 23 |
The easiest way to obtain these is to run the tests with `sudo`. |
| 24 |
|
| 25 |
Run all tests with the following command: |
| 26 |
|
| 27 |
```shell-session |
| 28 |
go test -exec sudo ./... |
| 29 |
``` |
| 30 |
|
| 31 |
To test the current package with a different kernel version you can use [vimto]. |
| 32 |
Once you have installed `vimto` and its dependencies you can run all tests on a |
| 33 |
different kernel: |
| 34 |
|
| 35 |
```shell-session |
| 36 |
vimto -- go test ./... |
| 37 |
``` |
| 38 |
|
| 39 |
Use one of the [precompiled kernels](https://github.com/cilium/ci-kernels/pkgs/container/ci-kernels/versions) like so: |
| 40 |
|
| 41 |
```shell-session |
| 42 |
vimto -kernel :mainline -- go test ./... |
| 43 |
``` |
| 44 |
|
| 45 |
## Regenerating testdata and source code |
| 46 |
|
| 47 |
The library includes some binary artifacts which are used for tests and some |
| 48 |
generated source code. Run `make` in the root of the repository to start |
| 49 |
this process. |
| 50 |
|
| 51 |
```shell-session |
| 52 |
make |
| 53 |
``` |
| 54 |
|
| 55 |
This requires Docker, as it relies on a standardized build |
| 56 |
environment to keep the build output stable. |
| 57 |
It is possible to regenerate data using Podman by overriding the `CONTAINER_*` |
| 58 |
variables: |
| 59 |
|
| 60 |
```shell-session |
| 61 |
make CONTAINER_ENGINE=podman CONTAINER_RUN_ARGS= |
| 62 |
``` |
| 63 |
|
| 64 |
## Project Roles |
| 65 |
|
| 66 |
If you'd like to contribute to the library more regularly, one of the |
| 67 |
[maintainers][ebpf-lib-maintainers] can add you to the appropriate team or mark |
| 68 |
you as a code owner. Please create an issue in the repository. |
| 69 |
|
| 70 |
* [ebpf-go-contributors] |
| 71 |
* Have ["Triage"][permissions] role |
| 72 |
* May be asked to review certain parts of code |
| 73 |
* May be asked to help with certain issues |
| 74 |
* [ebpf-go-reviewers] and [ebpf-go-windows-reviewers] |
| 75 |
* Have ["Write"][permissions] role |
| 76 |
* CODEOWNER of a part of the code base |
| 77 |
* In-depth review of code, escalates to maintainers if necessary |
| 78 |
* For bugfixes: review within 1-2 days |
| 79 |
* Otherwise: review within a work week |
| 80 |
* When lacking time: escalate to maintainers, but don’t ignore |
| 81 |
* [ebpf-lib-maintainers] |
| 82 |
* Have ["Admin"][permissions] role |
| 83 |
* Manage releases |
| 84 |
* Triage incoming issues and discussions and pull in CODEOWNERS if needed |
| 85 |
* Maintain CI & project permissions |
| 86 |
* Maintain roadmap and encourage contributions towards it |
| 87 |
* Merge approved PRs |
| 88 |
|
| 89 |
[vimto]: https://github.com/lmb/vimto |
| 90 |
[permissions]: https://docs.github.com/en/organizations/managing-user-access-to-your-organizations-repositories/repository-roles-for-an-organization#permissions-for-each-role |
| 91 |
[ebpf-go-contributors]: https://github.com/cilium/community/blob/main/ladder/teams/ebpf-go-contributors.yaml |
| 92 |
[ebpf-go-reviewers]: https://github.com/cilium/community/blob/main/ladder/teams/ebpf-go-reviewers.yaml |
| 93 |
[ebpf-go-windows-reviewers]: https://github.com/cilium/community/blob/main/ladder/teams/ebpf-go-windows-reviewers.yaml |
| 94 |
[ebpf-lib-maintainers]: https://github.com/cilium/community/blob/main/roles/Maintainers.md#ebpf-lib-maintainers-maintainers-of-ciliumebpf |
| 95 |
[DCO]: https://developercertificate.org/ |