Commit graph

127 commits

Author SHA1 Message Date
Wolfgang Walther 08a47c5d2f ci/eval/compare: fix without owners
Even without relevant owners, the owners.txt file must be created,
otherwise the next job will fail.

(cherry picked from commit c0b6cc9387)
2025-11-02 16:40:00 +00:00
Wolfgang Walther 9f82c498b8 ci/request-reviews: move get-code-owners to eval/compare
This moves the parsing of ci/OWNERS into the Nix sandbox. We also get
rid of checking out the nixpkgs repo another time in the reviewers
workflow - we already have everything we need in the eval/compare job.

The creation of owners.txt in this way is only temporary, it should
eventually be moved further, similar to how maintainers.json is
currently migrating to a maintainer map for the whole repo stored on the
target branch as artifact.

(cherry picked from commit 3bef0dcf65)
2025-11-02 15:45:09 +00:00
Wolfgang Walther 249bef2536 ci/github-script/labels: set maintainer labels from latest maintainer map
Instead of setting the maintainer-related labels based entirely on Eval
results, this uses the new maintainer map from the target branch. This
allows labeling PRs correctly, that had been created *before* a
contributor became a maintainer of the respective package.

(cherry picked from commit 6b5e6cbbee)
2025-11-01 10:11:56 +00:00
Gaetan Lepage a24c7b1a50 ci/eval: add extraNixpkgsConfig argument
(cherry picked from commit 0d5f9e6641)
2025-10-31 23:50:20 +00:00
Wolfgang Walther 469dd9acd1 ci/eval: avoid passing args around
There is no point in passing these arguments around between all the
different parts of the eval chain - these global settings should surely
not be modified between different steps.

This also makes it simpler to add new arguments like extra nixpkgs
configuration.

(cherry picked from commit 11749394df)
2025-10-31 22:42:24 +00:00
Wolfgang Walther 8311fc26fd workflows/eval: upload maintainer list of all packages as artifact
This creates a simple mapping of all packages to github ids of all their
maintainers. This is uploaded as an artifact and is then available for
download on the latest commit of each branch with a merge queue. This
will allow scheduled jobs to use this information for setting
maintainer-related labels, to request reviewers and to implement the
merge-bot.

The advantage over querying this information directly via Nix in each
case: The scheduled job does not need to install Nix and does not need
to checkout the target branch.

Compared to obtaining the maintainer information just for a single PR
during Eval, this will allow retroactively changing maintainers for a
package: For example, it allows to request a new maintainer as reviewer
for a PR that was created before they became maintainer, but is still
open - and similarly for maintainer labels and merge-bot rights.

None of these extensions are implemented by this PR, yet.

(cherry picked from commit 498574f238)
2025-10-31 11:34:39 +00:00
Wolfgang Walther 200b74373a ci/eval/utils: refactor to use lib.init
(cherry picked from commit 5c01bd9df6)
2025-10-31 11:34:39 +00:00
Wolfgang Walther 4629844e0c ci/eval/diff: avoid copying paths.json
Currently the `diff-<system>` artifacts are 6-7 MB in size - and almost
all of that is the `paths.json` file, which is only used to generate the
diff itself. This had been stored in the artifact previously for
debugging purposes. Ever since we moved to Cachix this is not required
anymore, since it's possible to run the same eval locally and thus fetch
the `eval.singleSystem` result, including `paths.json`, from Cachix.

This will be even more helpful when the next step adds `meta.json` -
which is magnitudes bigger than `paths.json`.

(cherry picked from commit 350a469f73)
2025-10-31 11:34:39 +00:00
Matt Sturgeon 8c669392e7 ci/eval/compare/maintainers: simplify meta.position predicate
(cherry picked from commit 9ea88ca354)
2025-10-23 07:54:21 +00:00
Wolfgang Walther a22f53cd59 ci/eval/compare/maintainers: fix maintainer pings without meta.position
In a recent change, the path matching was simplified in maintainers.nix.
This revealed a pre-existing logic bug: Packages without `meta.position`
would get an empty string as their file name. The change would then
cause this empty string to always be matched, which lead to maintainer
pings for these packages in seemingly random PRs, when some of their
dependencies were changed.

(cherry picked from commit 6d564102b7)
2025-10-22 19:45:32 +00:00
Wolfgang Walther d7dd9408c0 ci/eval/compare/maintainers: disable aliases
We should never try to ping maintainers through package aliases, this
can only lead to errors. One example case is, where an attribute is a
throw alias, but then re-introduced in a PR. This would trigger the
throw. By disabling aliases, we can fallback gracefully.

(cherry picked from commit 6a26c66335)
2025-10-22 12:20:03 +00:00
Wolfgang Walther 6a36bd31e8 ci/eval: disable GC warning
This came up more often recently, and breaks Eval because it prints on
stderr.

(cherry picked from commit 2b7ea9379a)
2025-10-18 17:45:22 +00:00
Wolfgang Walther 51fc7cc471 ci/eval/compare/maintainers: ping by-name reviewers for pure refactors
This allows requesting reviewers for pure refactor PRs, which don't
cause a rebuild of the package. This is only possible for by-name,
because only here the package names can be inferred from the filenames.

(cherry picked from commit f33892fcc9)
2025-10-17 14:54:31 +00:00
Wolfgang Walther cd1466e2cd ci/eval/compare/maintainers: ping by-name reviewers for all rebuilds
This adds support to ping maintainers when arbitrary files in by-name
are changed, as long as they still cause a rebuild. For example, this is
the case when changing .json files with version metadata. These were
previously not detected as belonging to the package, and didn't cause
maintainer pings.

(cherry picked from commit 0a5ffcdf31)
2025-10-17 14:54:31 +00:00
Wolfgang Walther 825a5dd168 ci/eval/compare/maintainers: refactor path matching
The only reason for the additional `lib.hasSuffix` check was, that the
`lib.removePrefix` was broken - it was never adjusted when porting this
from ofborg, so the relative path was wrong and no prefix ever removed,
since no packages are in `ci/`.

This additionally strips the leading `/`, so that `relevantFilenames`
will then have paths starting with `pkgs/...`, similar to how git
reports those paths in the `changedpathsjson` file. This allows simple
equality comparison.

(cherry picked from commit 7c865ddd46)
2025-10-17 14:54:31 +00:00
Wolfgang Walther b9f8c01ec4 ci/eval/compare/maintainers: refactor using lib
Removes unused code and comments, uses shorter lib over builtins and
switches to `lib.importJSON`.

Readability is key.

(cherry picked from commit 79029e39a4)
2025-10-17 14:54:31 +00:00
Wolfgang Walther a343dfc609 maintainers/scripts/get-maintainer-pings-between: drop
This has been broken for months, since all the interface to `ci/eval`
changed. Nobody noticed, so nobody is using it.

(cherry picked from commit 44e4c1ba9f)
2025-10-17 14:54:30 +00:00
NAHO 8756682109 treewide: remove optional builtins prefixes from prelude functions
Remove optional builtins prefixes from prelude functions by running:

    builtins=(
      abort
      baseNameOf
      break
      derivation
      derivationStrict
      dirOf
      false
      fetchGit
      fetchMercurial
      fetchTarball
      fetchTree
      fromTOML
      import
      isNull
      map
      null
      placeholder
      removeAttrs
      scopedImport
      throw
      toString
      true
    )

    fd --type file --exec-batch sed --in-place --regexp-extended "
      s/\<builtins\.($(
        printf '%s\n' "${builtins[@]}" |
          paste --delimiter '|' --serial -
      ))\>/\1/g
    "

    nix fmt

(cherry picked from commit dec908b169)
2025-10-04 18:33:51 +00:00
Philip Taron 4de8ee7ab3
ci.eval.compare: split out equivalent values into their own table
(cherry picked from commit d80d4a77b7)
2025-09-18 09:01:07 -07:00
Philip Taron 8004d8c3a1
ci.eval.compare: explain the various metrics under the --explain flag
(cherry picked from commit fb1647ec6e)
2025-09-18 09:01:07 -07:00
Philip Taron 44b98f2061
ci.eval.compare: remove the duplicate cpuTime key
(cherry picked from commit c9860ef95c)
2025-09-18 09:01:07 -07:00
Philip Taron 0bd4b9198e
ci.eval.compare: put things with counts together
(cherry picked from commit 2817f79649)
2025-09-18 09:01:07 -07:00
Philip Taron b76a3c88b5
ci.eval.compare: put things with bytes together
(cherry picked from commit 210e3e1151)
2025-09-18 09:01:07 -07:00
Philip Taron b692055537
ci.eval.compare: make the table format using tabulate not manually
(cherry picked from commit 3edc1e204e)
2025-09-18 09:01:07 -07:00
Philip Taron c84ffaef49
ci.eval.compare: sort time metrics first, then GC metrics, then everything else
(cherry picked from commit 4eaa094f20)
2025-09-18 09:01:07 -07:00
Philip Taron 17decc0429
ci.eval.compare: assert types in flatten_data
(cherry picked from commit e83e900874)
2025-09-18 09:01:07 -07:00
Philip Taron c9156ea263
ci.eval.compare: delete unreferenced global
(cherry picked from commit 9959a4e507)
2025-09-18 09:01:07 -07:00
Philip Taron 59b03676e9
ci.eval.compare: instead of manually tabulating, use tabulate
(cherry picked from commit e4101ea3a9)
2025-09-18 09:01:06 -07:00
Philip Taron 87aef29e19
ci.eval.compare: support passing single files to cmp-stats
(cherry picked from commit 7818a245f7)
2025-09-18 09:01:06 -07:00
Philip Taron 8352e6a4f5
ci.eval.compare: allow before_vals == 1 but avoid the t-test
(cherry picked from commit 4bc54e7a3a)
2025-09-18 09:01:06 -07:00
Philip Taron 24386eb559
ci.eval.compare: require the directories to exist (they always should)
(cherry picked from commit 4c7ec9bf20)
2025-09-18 09:01:06 -07:00
Philip Taron 6183797e12
ci.eval.compare: use argument parsing instead of environment variables to pass before/after to cmp-stats.py
(cherry picked from commit 241bb94b64)
2025-09-18 09:01:06 -07:00
Philip Taron bca0af6384
ci.eval.compare: extract a derivation for cmp-stats
It's not very useful yet.

(cherry picked from commit 2fe7b1cec2)
2025-09-18 09:01:06 -07:00
Philip Taron 647f205057
ci.eval.compare: extract main function in cmp-stats.py
(cherry picked from commit 4c2c6d9c43)
2025-09-18 09:01:06 -07:00
Philip Taron 928e921d7b
ci.eval.compare: sort imports in cmp-stats.py
(cherry picked from commit 6900cf62ee)
2025-09-18 09:01:06 -07:00
Philip Taron cfc365f266
ci.eval.compare: format cmp-stats.py with ruff
(cherry picked from commit a3c01782d3)
2025-09-18 09:01:06 -07:00
Wolfgang Walther 91eb7b6409
ci/eval/compare: add 10.rebuild-nixos-tests label
This indicates that the NixOS test-driver changed and all NixOS tests
have to be rebuilt. It can be used to either re-target to staging or to
batch this with other similar changes, at least.

(cherry picked from commit 63e6fc4c43)
2025-09-15 16:44:32 +02:00
Wolfgang Walther b1fe20fd04
ci/eval: eval nixosTests.simple
We can't eval all nixos tests, this would be way too expensive. But we
can evaluate `nixosTests.simple` as an indication whether the nixos test
driver has changed. If that's the case, this means that *all* NixOS
tests need to be rebuilt.

(cherry picked from commit e3f583c5bf)
2025-09-15 16:44:29 +02:00
Wolfgang Walther aec2d51e7e ci/eval: fix local full eval
The change to use `builtins.storePath` was good - for when the store
path *is* already part of the nix store. In all my tests so far, that
was already the case, because I was iterating on the solution and the
Eval results stayed the same.

But when this is run on a entirely new commit, these the values for
`afterDir` and `combinedDir` are *not* in the store, yet. As part of
running `eval.full` on a new commit they will be created. `eval.full` is
linked up, so that the values passed around there will actually be
derivations, which might not be realized, yet.

Checking whether the input is a path or not fixes this for both cases.

(cherry picked from commit b9d4098221)
2025-09-11 19:22:21 +00:00
Wolfgang Walther 6c105942ca ci/eval: fix local comparison with baseline
Due to how we pass in existing store paths via CLI arguments for the
diff and combine scripts, Nix didn't register a dependency on the store
paths properly. This meant that some of the derivations that were built,
didn't have the right store paths made available in the sandbox -
leading to all kinds of "not found" errors.

We worked around this in CI by resolving the symlinks to the nix store
beforehand. We tried to work around this locally by storing the nix
store path in BASELINE, but this didn't fully work. By explicitly
registering these store paths as dependencies, this should work across
the board - without any magic required by the caller.

(cherry picked from commit 45a765a282)
2025-09-10 17:29:07 +00:00
Ben Siraphob 8bb3b72d53
ci/eval/README.md: adjust wording
(cherry picked from commit 807ce4b7b3)
2025-09-09 10:06:12 +02:00
Philip Taron 2fbedb9402 ci: have eval.full return the report as displayed in CI
Update the README.md to document what gets returned.
We might in the future split these up into other attrsets but I don't see a usecase for that at the moment.

(cherry picked from commit 07916fc3fd)
2025-09-08 14:09:00 +00:00
Wolfgang Walther e654129e96 ci/eval/attrpaths: update cross stdenvs
`pkgsArocc` and `pkgsZig` had been added to `release.nix`, so should be
listed here as well.

(cherry picked from commit 8104100101)
2025-09-03 16:28:31 +00:00
Wolfgang Walther cc8ee67459 treewide: remove __recurseIntoDerivationForReleaseJobs
This attribute was supposed to be set on derivations, to make the
release tools recurse into them. The remaining uses were all on regular
attrsets, though, so this is safe to remove.

(cherry picked from commit d0c0b875f7)
2025-09-03 16:28:30 +00:00
Wolfgang Walther 5c22b88f2b ci/eval: remove unused checkMeta argument
This should always be set anyways.

(cherry picked from commit b627d181e9)
2025-09-03 16:28:30 +00:00
Wolfgang Walther 3c6789fbed ci/eval/attrpaths: refactor
The following changes were made:
- Using `lib.` instead of `builtins.`
- Using `mapAttrsToList` instead of `mapAttrs` + `attrValues`
- Joining two of the if conditions with the same return value
- Using `traceIf` instead of `if` / `else`
- Using `showAttrPath` instead of `concatStringsSep`

(cherry picked from commit 04fcbb45e1)
2025-09-03 16:28:29 +00:00
Wolfgang Walther d332267042 ci/eval/attrpaths: remove left-over condition
This condition doesn't make a difference anymore, ever since we removed
the tryEval code from this file and had already enabled unfree packages
earlier anyway.

(cherry picked from commit 9524a21fe0)
2025-09-03 16:28:29 +00:00
Wolfgang Walther a24803b26f ci/eval: remove ofborg references
By now, these files have been changed enough to not need the "vendored
from" notes anymore. These links would still be there when going through
the history of the file, but today GHA CI has not many similarities
anymore to what ofborg did, so these are not really helpful.

(cherry picked from commit 2aae142529)
2025-09-03 16:28:29 +00:00
Wolfgang Walther 87af6a62ab top-level/release-outpaths: move to ci/eval
These files are tightly coupled with the code in ci/eval and not used
anywhere else. They are subject to the same backporting requirements as
the remaining CI code. They are better placed next here.

(cherry picked from commit 0d51e920d3)
2025-09-03 16:28:29 +00:00
Wolfgang Walther 4198e557f3 ci/eval/compare: handle missing packages
Not all packages that are reported as changed will actually exist on the
platform that the maintainers are colleted on.

This is the case for some attributes that are only available on Darwin
or explicitly set to `null` on Linux. By filtering out packages without
maintainers, these are ignored - and we should potentially get a small
performance improvement as well.

(cherry picked from commit f2ca5796de)
2025-09-01 16:24:43 +00:00