2020-05-06 07:13:34 +00:00
|
|
|
# ofborg
|
2017-10-29 21:10:26 +00:00
|
|
|
|
2017-11-23 15:50:03 +00:00
|
|
|
## Guidelines
|
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
1. Review the code of all PRs before triggering the bot on them.
|
|
|
|
2. Be gentle; try not to run mass rebuilds or massive builds (like Chromium) on
|
|
|
|
it.
|
2017-11-23 15:50:03 +00:00
|
|
|
|
2018-02-03 14:37:37 +00:00
|
|
|
## Automatic Building
|
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
All users will have their PRs automatically trigger builds if their commits
|
|
|
|
follow the well-defined format of Nixpkgs. Specifically: prefixing the commit
|
|
|
|
title with the package attribute. This includes package bumps as well as other
|
|
|
|
changes.
|
2018-03-01 17:58:04 +00:00
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
Example commit titles and the builds they will start:
|
2018-02-03 14:37:37 +00:00
|
|
|
|
2020-02-17 00:09:25 +00:00
|
|
|
| Message | Automatic Build |
|
|
|
|
|-----------------------------------------------------------------------|----------------------------------------------------------|
|
|
|
|
| `vim: 1.0.0 -> 2.0.0` | `vim` |
|
|
|
|
| `vagrant: Fix dependencies for version 2.0.2 ` | `vagrant` |
|
|
|
|
| `python36Packages.requests,python27Packages.requests: 1.0.0 -> 2.0.0` | `python36Packages.requests`, `python27Packages.requests` |
|
|
|
|
| `python{2,3}Packages.requests: 1.0.0 -> 2.0.0` | _nothing_ |
|
2018-02-03 14:37:37 +00:00
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
When opening a PR with multiple commits, ofborg creates a single build job for
|
|
|
|
all detected packages. If multiple commits get pushed to a PR one-by-one, each
|
|
|
|
detected package will get a separate build job.
|
2018-02-03 14:37:37 +00:00
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
If the title of a PR begins with `WIP:`, contains `[WIP]` anywhere, or has the
|
|
|
|
`2.status: work-in-progress` label, its packages are not built automatically.
|
|
|
|
**Note**: Marking a PR as a draft does not prevent automatic builds.
|
2018-02-03 14:37:37 +00:00
|
|
|
|
2017-11-23 13:38:52 +00:00
|
|
|
## Commands
|
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
The comment parser is line-based, so commentary can be interwoven with
|
|
|
|
instructions for ofborg.
|
Support ofborg comments inline with other text
The old design of the parser treated all whitespace the same and
mandated that `grahamcofborg` (plus the `@`) be the first token in the
text. This allowed for some ridiculous but command calls:
grahamcofborg build foo
bar
baz
This used to become a build instruction for foo, bar, and baz. After
this change, it is just an instruction for building foo. This allows
for comments for people to be intertwined with comments for the bot:
grahamcofborg build foo
Let's see what happens!
Before this would unintentionally become a build instruction for
`foo`, `Let's`, `see`, `what`, `happens!`, and is now only going to
build `foo`.
Additionally, this comment would do nothing:
Let's see what happens!
grahamcofborg build foo
Or a more real case where people expected this to work:
/cc grahamc for ^^
GrahamcOfBorg eval
This will continue to not produce a build instruction, because
grahamcofborg must be the first word of a line:
foo bar grahamcofborg build foo
Note: I've removed `@`s from all usernames to avoid accidental email.
2017-12-22 13:51:55 +00:00
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
1. To trigger the bot, the line _must_ start with `@ofborg` (case insensitive).
|
|
|
|
* **Note**: GitHub will not suggest `@ofborg` to you, but it will work all
|
|
|
|
the same. When in doubt, preview your comment and verify that `@ofborg`
|
|
|
|
links to https://github.com/ofborg/.
|
|
|
|
2. To use multiple commands, separate them with whitespace. For examples, see
|
|
|
|
the "[Multiple Commands](#multiple-commands)" section.
|
2017-11-23 13:38:52 +00:00
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
### test
|
2017-11-24 19:08:00 +00:00
|
|
|
|
|
|
|
```
|
2020-05-06 07:13:34 +00:00
|
|
|
@ofborg test list of tests
|
2017-11-24 19:08:00 +00:00
|
|
|
```
|
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
This will run `nix-build ./nixos/release.nix -A tests.list -A tests.of -A
|
|
|
|
tests.tests` from the root of the Nixpkgs checkout.
|
|
|
|
|
|
|
|
Tests will run on all allowed machines. For more information, see the "[Trusted
|
|
|
|
Users](#trusted-users)" section.
|
2017-11-24 19:08:00 +00:00
|
|
|
|
2017-11-24 19:40:53 +00:00
|
|
|
### eval
|
2017-11-24 19:08:00 +00:00
|
|
|
|
2017-11-23 13:38:52 +00:00
|
|
|
```
|
2020-05-06 07:13:34 +00:00
|
|
|
@ofborg eval
|
2017-11-23 13:38:52 +00:00
|
|
|
```
|
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
See "[How does ofborg call
|
|
|
|
`nix-instantiate`?](#how-does-ofborg-call-nix-instantiate)" for what command(s)
|
|
|
|
this will run.
|
|
|
|
|
|
|
|
**Note**: Every PR automatically evaluates both upon creation and when the
|
|
|
|
commits change. There is no reason to run eval on a PR unless the evaluation
|
|
|
|
failed for weird reasons or master was previously broken.
|
2017-11-23 19:25:33 +00:00
|
|
|
|
2017-11-24 19:40:53 +00:00
|
|
|
### build
|
|
|
|
|
|
|
|
```
|
2020-05-06 07:13:34 +00:00
|
|
|
@ofborg build list of attrs
|
2017-11-24 19:40:53 +00:00
|
|
|
```
|
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
This will run `nix-build ./default.nix -A list -A of -A attrs` from the root of
|
|
|
|
the Nixpkgs checkout (see also "[How does ofborg call
|
|
|
|
`nix-build`?](#how-does-ofborg-call-nix-build)").
|
2017-11-24 19:40:53 +00:00
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
Builds will run on all allowed machines. For more information, see the "[Trusted
|
|
|
|
Users](#trusted-users)" section.
|
2017-11-23 19:25:33 +00:00
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
## Multiple Commands
|
2017-11-23 19:25:33 +00:00
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
You can use multiple commands in a variety ways. Here are some valid
|
|
|
|
combinations:
|
2017-11-23 13:38:52 +00:00
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
*
|
|
|
|
```
|
|
|
|
@ofborg build list of attrs
|
|
|
|
@ofborg eval
|
|
|
|
```
|
2017-11-23 13:38:52 +00:00
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
*
|
|
|
|
```
|
|
|
|
@ofborg build list of attrs @ofborg eval
|
|
|
|
```
|
2017-11-23 13:38:52 +00:00
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
*
|
|
|
|
```
|
|
|
|
looks good to me!
|
|
|
|
@ofborg eval
|
|
|
|
@ofborg build list of attrs
|
|
|
|
```
|
2017-11-23 13:38:52 +00:00
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
*
|
|
|
|
```
|
|
|
|
@ofborg eval
|
|
|
|
@ofborg build list of attrs
|
|
|
|
looks good to me!
|
|
|
|
```
|
2017-11-23 13:38:52 +00:00
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
*
|
|
|
|
```
|
|
|
|
@ofborg build list of attrs
|
|
|
|
@ofborg test list of attrs
|
|
|
|
```
|
2017-11-23 13:38:52 +00:00
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
* This will build `list`, `of`, `attrs`, `looks`, `good`, `to`, and `me!` (which is probably not what you want):
|
|
|
|
```
|
|
|
|
@ofborg build list of attrs looks good to me!
|
|
|
|
```
|
2017-11-23 13:38:52 +00:00
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
## Trusted Users
|
2017-11-23 13:38:52 +00:00
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
Trusted users have their builds and tests executed on _all_ available platforms,
|
|
|
|
including those without good sandboxing. Because this exposes the host to a
|
|
|
|
higher risk of security issues, the trusted users list consists of only
|
|
|
|
well-known, trusted members of the community.
|
2018-03-01 17:58:04 +00:00
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
At the time of writing, trusted users have their builds and tests run on these
|
|
|
|
platforms:
|
2018-03-01 17:58:04 +00:00
|
|
|
|
|
|
|
- `x86_64-linux`
|
2020-05-06 07:13:34 +00:00
|
|
|
- `aarch64-linux`
|
2018-03-01 17:58:04 +00:00
|
|
|
- `x86_64-darwin`
|
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
See [`config.public.json`](./config.public.json) for a list of all trusted users.
|
2017-12-20 12:01:32 +00:00
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
# How does ofborg call `nix-build`?
|
2017-12-20 12:01:32 +00:00
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
ofborg runs builds with a command similar to the following:
|
2017-12-16 13:57:30 +00:00
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
```shell
|
|
|
|
$ HOME=/homeless-shelter NIX_PATH=ofborg-nixpkgs-pr=$(pwd) nix-build ./default.nix \
|
|
|
|
-A hello \
|
|
|
|
--no-out-link \
|
|
|
|
--keep-going \
|
|
|
|
--option restrict-eval true \
|
|
|
|
--option build-timeout 1800 \
|
|
|
|
--argstr system thesystem \
|
|
|
|
--show-trace
|
2018-02-19 15:01:58 +00:00
|
|
|
```
|
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
# How does ofborg call `nix-instantiate`?
|
2017-11-23 13:38:52 +00:00
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
ofborg runs NixOS evals with a command similar to the following:
|
2017-10-29 21:10:26 +00:00
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
```shell
|
|
|
|
$ HOME=/homeless-shelter NIX_PATH=ofborg-nixpkgs-pr=$(pwd) nix-instantiate ./nixos/release.nix \
|
|
|
|
-A manual \
|
|
|
|
--option restrict-eval true \
|
|
|
|
--option build-timeout 1800 \
|
|
|
|
--argstr system thesystem \
|
|
|
|
--show-trace
|
2018-03-25 14:10:16 +00:00
|
|
|
```
|
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
ofborg runs Nixpkgs evals with a command similar to the following:
|
2018-03-25 14:10:16 +00:00
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
```shell
|
|
|
|
$ HOME=/homeless-shelter NIX_PATH=ofborg-nixpkgs-pr=$(pwd) nix-instantiate ./pkgs/top-level/release.nix \
|
|
|
|
-A manual \
|
|
|
|
--option restrict-eval true \
|
|
|
|
--option build-timeout 1800 \
|
|
|
|
--argstr system thesystem \
|
|
|
|
--show-trace
|
2017-12-20 02:46:29 +00:00
|
|
|
```
|
2017-10-29 21:10:26 +00:00
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
# Running meta checks locally
|
2017-11-04 16:21:55 +00:00
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
To run the meta checks, you will need the
|
|
|
|
[`outpaths.nix`](./ofborg/src/outpaths.nix) file. You can acquire this file and
|
|
|
|
run the checks themselves like so:
|
2017-12-20 02:46:29 +00:00
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
```shell
|
|
|
|
$ curl -o outpaths.nix https://raw.githubusercontent.com/NixOS/ofborg/released/ofborg/src/outpaths.nix
|
|
|
|
$ GC_INITIAL_HEAP_SIZE=4g nix-env -f ./outpaths.nix -qaP --no-name --out-path --arg checkMeta true > out-paths
|
2017-12-20 02:46:29 +00:00
|
|
|
```
|
|
|
|
|
2020-04-12 11:27:07 +00:00
|
|
|
# Hacking
|
|
|
|
|
|
|
|
```shell
|
|
|
|
$ git clone https://github.com/NixOS/ofborg/
|
|
|
|
$ cd ofborg
|
|
|
|
$ nix-shell ./shell.nix
|
|
|
|
$ cd ofborg # enter the subdirectory with Rust code
|
|
|
|
# make your changes
|
|
|
|
$ cargo build
|
|
|
|
$ cargo check
|
|
|
|
$ cargo test
|
|
|
|
```
|
|
|
|
|
|
|
|
To test whether or not Continuous Integration will pass with your changes, you
|
|
|
|
can run the following commands from the root of your checkout:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
$ nix-shell --run checkPhase -A mozilla-rust-overlay # checks rustfmt and clippy
|
|
|
|
$ nix-shell --run checkPhase # runs the test suite
|
|
|
|
$ nix-build -A ofborg.rs # build ofborg
|
|
|
|
```
|
|
|
|
|
|
|
|
Currently there is no easy way to set up a test instance of ofborg. If `cargo
|
|
|
|
check` and `cargo test` both succeed, feel free to Pull Request your changes.
|
|
|
|
Make sure to format your code with `cargo fmt` and check for additional warnings
|
|
|
|
with `cargo clippy`. If you added, removed, or updated the dependencies, also be
|
2020-05-24 11:24:00 +00:00
|
|
|
sure to update Cargo.nix by running
|
|
|
|
[`./nix/update-crates.sh`](./nix/update-crates.sh).
|
2020-04-12 11:27:07 +00:00
|
|
|
|
|
|
|
To disable warnings as errors, run your command with an empty `RUSTFLAGS`. For
|
|
|
|
example:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
$ RUSTFLAGS= cargo clippy
|
|
|
|
```
|
|
|
|
|
|
|
|
This will override the default of `-D warnings` set in
|
|
|
|
[`shell.nix`](./shell.nix), which tells Rust to error if it detects any
|
|
|
|
warnings.
|
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
# Running a builder
|
2018-02-24 02:28:32 +00:00
|
|
|
|
2020-05-06 07:13:34 +00:00
|
|
|
If you want to run a builder of your own, check out the [wiki page on operating
|
|
|
|
a builder](https://github.com/NixOS/ofborg/wiki/Operating-a-Builder/).
|