Skip to content

ci/eval/release-checks: init#406825

Open
winterqt wants to merge 7 commits intoNixOS:masterfrom
winterqt:push-myqponlxmlwz
Open

ci/eval/release-checks: init#406825
winterqt wants to merge 7 commits intoNixOS:masterfrom
winterqt:push-myqponlxmlwz

Conversation

@winterqt
Copy link
Member

@winterqt winterqt commented May 13, 2025

This PR reimplements pkgs/top-level/nixpkgs-basic-release-checks.nix using the chunked evaluator function, in order for it to be efficient enough to run in CI.

Things done

  • Built on platform(s)
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 6.topic: continuous integration Affects continuous integration (CI) in Nixpkgs, including Ofborg and GitHub Actions 6.topic: policy discussion Discuss policies to work in and around Nixpkgs backport release-24.11 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 101-500 This PR causes between 101 and 500 packages to rebuild on Linux. labels May 13, 2025
@winterqt winterqt force-pushed the push-myqponlxmlwz branch 2 times, most recently from 8beae4d to 87c8b4c Compare May 13, 2025 19:32
@winterqt winterqt marked this pull request as ready for review May 13, 2025 19:32
@winterqt winterqt force-pushed the push-myqponlxmlwz branch from 87c8b4c to 5f8eee7 Compare May 13, 2025 19:56
@winterqt

This comment was marked as outdated.

@winterqt

This comment was marked as resolved.

@winterqt
Copy link
Member Author

Alright so average per system is ~6m40s with the actually correct check: https://github.com/winterqt/nixpkgs/actions/runs/15007089150

@emilazy
Copy link
Member

emilazy commented May 13, 2025

IMO the ~doubled eval time here is worth it for peace of mind that we’re catching issues upfront, but it does make it important to replace the existing eval job entirely so that we’re not trashing our concurrency by doubling the number of jobs and having half of them take twice as long.

@winterqt winterqt force-pushed the push-myqponlxmlwz branch from 4f15b39 to 25509d1 Compare May 13, 2025 22:27
@github-actions github-actions bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. and removed 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 101-500 This PR causes between 101 and 500 packages to rebuild on Linux. labels May 13, 2025
winterqt added 5 commits May 17, 2025 18:59
This change reimplements `pkgs/top-level/nixpkgs-basic-release-checks.nix`
using the chunked evaluator function, in order for it to be efficient
enough to run in CI.
I feel like I've done enough work on this that I can effectively review
any changes going forward. :)
Ran into this when comparing two `quickTest` evals.
Currently, the `get-merge-commit` job is inherently racey, as we can't
control whether these jobs will run at the same time, so it's possible
that the merge/target commits will change if the target gets updated
in between `get-merge-commit` runs.

This is bad enough in theory (and maybe has even caused some oddities in
the CI setup in the past), but it essentially makes the release checks
untentable on days where lots of people are merging things.

So, this change fixes it by electing the eval workflow as the "leader,"
and having all other jobs wait for it to determine which commits will be
checked.
@winterqt winterqt force-pushed the push-myqponlxmlwz branch from b266cf0 to be3b40f Compare May 17, 2025 23:02
@@ -5,6 +5,14 @@ on:
paths:
- .github/workflows/get-merge-commit.yml
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might want to consider removing this now that this requires inputs (and apparently defaults don’t apply to non-workflow_run triggers…).

@wolfgangwalther
Copy link
Contributor

The get-merge-commit workflow has increased massively in complexity. I feel like this took a wrong turn after the latest discovery, that different workflows for a single event are not guaranteed to run on the same merge commit (which still puzzles me).

Knowing this, we should just not run those in different workflows anymore. But I think with #406825 (comment), we might not need to anyway. I have thought about this a bit more, and it's quite simple in theory:

  • We know that outpaths on master belong to a state that passes the purity test.
  • If any path-to-nixpkgs dependency sneaks in, an outpath will change (this is what the purity test is based on).
  • Thus, this will cause an added or changed attribute after comparison.
  • It's therefore enough to check those added/changed attributes against a different nixpkgs path. There is no way they can turn bad without changing.

For the big majority of PRs, with only a handful of changed attributes, this will make the purity test take a few seconds maximum. Think about it, with the current approach we are comparing 70k attributes per PR, although only 1 (or none!) might have changed.

Once this is not a big check anymore, we can move it into the main eval workflow. The effect of running on undrafting can thus be ignored for now. Yes, this has consequences: We need to run this after the comparison, which is exactly what I had opposed earlier, because of start-to-finish time for nixpkgs-review. But that's not a problem, if it doesn't take long. It will take much longer on staging, when you cause many rebuilds - but also you're not going to use nixpkgs-review there anyway.

With how eval is currently set up, we'd need to:

  • Run the matrix of 4x jobs for main eval.
  • Run the process job to combine and compare.
  • Run the release-checks job, but possibly on a matrix of 4x jobs as well, otherwise it would take really long on staging.

Running an extra 4x mini jobs, which only re-eval a single package in the extreme case on master seems like waste, though.

Thus, I am currently working on my idea mentioned in #406825 (comment), namely switching up the order of "combine" and "compare". The new workflow would look like this:

  • Run the matrix of 4x jobs for main eval.
  • In those 4x jobs, download the intermediate results from the master branch for the current system.
  • In those 4x jobs, do the diff for added, removed, changed and upload it.
  • In process / tag do the combine and the remaining pieces of comparison.

This has a few benefits, because we'll be able to eventually get rid of a whole job (process), but also we could add the purity release-check into those 4x jobs for eval as well - the numbers for which attributes to run the check would already be known.

@winterqt
Copy link
Member Author

winterqt commented May 18, 2025

The get-merge-commit workflow has increased massively in complexity. I feel like this took a wrong turn after the latest discovery, that different workflows for a single event are not guaranteed to run on the same merge commit (which still puzzles me).

Right, but I think this is a desirable change for consistency, mainly avoiding weird results in the kind of conditions we just observed. I’d be willing to split it into a separate PR. WDYT?

Regarding your idea: I like it in theory, but I’ll need to think about it a bit more.

@wolfgangwalther
Copy link
Contributor

The get-merge-commit workflow has increased massively in complexity. I feel like this took a wrong turn after the latest discovery, that different workflows for a single event are not guaranteed to run on the same merge commit (which still puzzles me).

Right, but I think this is a desirable change for consistency, mainly avoiding weird results in the kind of conditions we just observed. I’d be willing to split it into a separate PR. WDYT?

I'm hoping to go into a different direction instead, but that's currently only an idea and not fully sketched out, yet:

  • Currently, we skip all jobs when there is a merge conflict. This is unfortunate, because we're missing opportunity to provide feedback. We could just return a different targetSha in this case - the merge-base of the head and target branches. This would also allow to run all the comparisons and give 99% correct feedback. The missing 1% is not a concern, because when the merge conflicts are resolved, CI runs again anyway.
  • With this, the get-merge-commit part doesn't need to be in a separate job / workflow anymore. It can become just a regular step, because there is no "skipped" case that we need to consider anymore (this is the main reason why this is a separate job). This saves quite a few jobs and also cleans up the output in the check list.
  • I just merged workflows/eval: run when base branch changed #372475, which means that the workflows don't react to edited events anymore. IIUC, this means that we don't need the special error cases in get-merge-commit anymore: The "PR is not open anymore" would only happen for edits anyway. This means that we might be able to go back to the GitHub special branch refs/pull/xxx/merge in the checkout action, which would reduce complexity massively.

If we go this way, then there is no other get-merge-commit workflow / job to wait on, so the artifact idea won't work. However, I think that's not really a problem - we just need to make sure that different workflows don't depend on each other like we tried here.

Comment on lines -18 to +22
/.github/workflows @NixOS/Security @Mic92 @zowoq @infinisil @azuwis @wolfgangwalther
/.github/workflows @NixOS/Security @Mic92 @zowoq @infinisil @azuwis @winterqt @wolfgangwalther
/.github/workflows/check-format.yml @infinisil @wolfgangwalther
/.github/workflows/codeowners-v2.yml @infinisil @wolfgangwalther
/.github/workflows/nixpkgs-vet.yml @infinisil @philiptaron @wolfgangwalther
/ci @infinisil @philiptaron @NixOS/Security @wolfgangwalther
/ci @infinisil @philiptaron @NixOS/Security @winterqt @wolfgangwalther
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to merge this commit separately already. I'm trying to already request reviews from you in CI PRs, so that you are aware of all the changes happening, but sometimes I forget :D

@wolfgangwalther
Copy link
Contributor

Regarding your idea: I like it in theory, but I’ll need to think about it a bit more.

You can see the new outpaths jobs in #410852. They already produce a diff of attrpaths, which is what you could use to decide which paths to do the purity check against.

@emilazy
Copy link
Member

emilazy commented May 25, 2025

Does that work if the problem is that the existence of attribute paths in some way depends on the value of pkgs.path? (If the actual release checks don’t catch this then I suppose it’s fine, though. But IIRC they do?)

@wolfgangwalther
Copy link
Contributor

Does that work if the problem is that the existence of attribute paths in some way depends on the value of pkgs.path? (If the actual release checks don’t catch this then I suppose it’s fine, though. But IIRC they do?)

Interesting. Correct - this would not be caught. Attrpath generation takes ~ 20-30s per system. Thus, doing this with both paths for all systems in sequence would take max 4 mins. I'd say we could run this as a separate job, independent of everything else. This would make it easy to only run this in the merge queue later, which should be enough for what is probably very much an edge case.

@wolfgangwalther
Copy link
Contributor

wolfgangwalther commented May 28, 2025

Attrpath generation takes ~ 20-30s per system. Thus, doing this with both paths for all systems in sequence would take max 4 mins. I'd say we could run this as a separate job, independent of everything else.

We can do even better: attrpath generation is using a single core only. Thus, we could run both attrpath generations at the same time in the main eval job. Then we do the purity check for attrpaths already and can error out early in case of a mismatch.

Then we do main eval, then the diff against master, and then we run eval again on the changed attrpaths for purity.

For PRs with 0 rebuilds, the overhead will be 0. And the overhead for release checks scales with the number of changed packages, which is nice.

@philiptaron
Copy link
Contributor

At one point I was tracking with the back-and-forth on this PR, but I've lost the plot. Where are we with this effort, @winterqt and @wolfgangwalther?

@wolfgangwalther
Copy link
Contributor

At one point I was tracking with the back-and-forth on this PR, but I've lost the plot. Where are we with this effort?

I think all the pre-requisites have been merged to do #406825 (comment) for evalPurity now.

This will still leave us with the badFiles and conflictingPaths checks. Those seem to be static analysis and thus not really related to eval. I think they might actually fit well into nixpkgs-vet. I was thinking about adding them to ci/nixpkgs-vet.nix first, with the goal of somebody upstreaming them?

@wolfgangwalther wolfgangwalther mentioned this pull request Jun 8, 2025
3 tasks
@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Jun 9, 2025
@philiptaron
Copy link
Contributor

philiptaron commented Jun 9, 2025

Good news: I'm (one of) the maintainer of nixpkgs-vet. I'd be delighted to see it grow checks for those sorts of defects. I agree it's the right place to add them.

I'll have time to work on that in a few weeks.

@nixpkgs-ci nixpkgs-ci bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Dec 6, 2025
@mdaniels5757 mdaniels5757 added backport release-25.11 Backport PR automatically and removed backport release-25.05 labels Jan 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: merge conflict This PR has merge conflicts with the target branch 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: continuous integration Affects continuous integration (CI) in Nixpkgs, including Ofborg and GitHub Actions 6.topic: policy discussion Discuss policies to work in and around Nixpkgs 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. backport release-25.11 Backport PR automatically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants