Skip to content

workflows/eval: evaluate ci/pinned.json changes at their commit#480395

Merged
MattSturgeon merged 2 commits into
NixOS:masterfrom
dyegoaurelio:ci-eval-workflow
Jan 20, 2026
Merged

workflows/eval: evaluate ci/pinned.json changes at their commit#480395
MattSturgeon merged 2 commits into
NixOS:masterfrom
dyegoaurelio:ci-eval-workflow

Conversation

@dyegoaurelio

Copy link
Copy Markdown
Contributor

When testVersions is enabled, the version matrix check now evaluates the specific commit that modified ci/pinned.json, rather than the PR head. This allows formatting changes and other modifications to be in the same PR without affecting the hash consistency ratchet check.

The workflow now:

  • Finds the single commit that touched ci/pinned.json
  • Errors if multiple commits modify it
  • Checks out that commit for versioned evaluations
  • Reports which commit was evaluated in the summary

Things done

  • Built on platform:
    • [] x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

@dyegoaurelio dyegoaurelio mentioned this pull request Jan 15, 2026
13 tasks
@nixpkgs-ci nixpkgs-ci Bot requested review from Mic92, philiptaron and zowoq January 15, 2026 15:32
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. 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-25.11 labels Jan 15, 2026

@MattSturgeon MattSturgeon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

SGTM overall. Minor thoughts:

Comment thread .github/workflows/eval.yml Outdated
Comment thread .github/workflows/eval.yml Outdated
@philiptaron

Copy link
Copy Markdown
Contributor

Can you give us a sense of the performance differential, @dyegoaurelio and @MattSturgeon?

@dyegoaurelio

dyegoaurelio commented Jan 15, 2026

Copy link
Copy Markdown
Contributor Author

edit:
https://github.com/NixOS/nixpkgs/actions/runs/21041282212/job/60503570981?pr=480436

I didn't realize how slow Check out the PR with full history step would be 😅


@philiptaron I don't expect much performance changes.

The goal of this PR is to simplify ci/pinned.json bumps, such as #480141

@MattSturgeon

MattSturgeon commented Jan 15, 2026

Copy link
Copy Markdown
Contributor

Can you give us a sense of the performance differential, @dyegoaurelio and @MattSturgeon?

The versions job only runs on PRs that touch ci/pinned.json, so performance isn't too critical. Normal PRs are not affected at all.

I'm not sure what metrics you're interested in. You can see it running "for real" in #480436

The checkout will be slower as it fetches history (I assume there's no way to fetch only history since the base commit?).

IIUC, the actual eval report should have the same perf cost as before; it does one eval per system per nix version, in addition to the usual "compare" eval done on all PRs.

@philiptaron

Copy link
Copy Markdown
Contributor

OK, my "run" of the GHA in my head thought it changed every one. Thanks for the clarification.

@dyegoaurelio dyegoaurelio force-pushed the ci-eval-workflow branch 2 times, most recently from 24c7917 to 3686fd6 Compare January 15, 2026 18:25
@MattSturgeon

This comment was marked as resolved.

@MattSturgeon

MattSturgeon commented Jan 15, 2026

Copy link
Copy Markdown
Contributor

(I assume there's no way to fetch only history since the base commit?).

Looking at https://github.com/NixOS/nixpkgs/actions/runs/21041282212/job/60503570981?pr=480436#step:3:416 (which timed out while fetching all of Nixpkgs)1, this may be worth doing.

Footnotes

  1. Caveat: GitHub seems to be struggling a bit atm anyway.

Comment thread .github/workflows/eval.yml
Comment thread .github/workflows/eval.yml Outdated
Comment thread .github/workflows/eval.yml Outdated
Comment thread .github/workflows/eval.yml
@dyegoaurelio dyegoaurelio force-pushed the ci-eval-workflow branch 2 times, most recently from 66b34ba to 2ff0858 Compare January 18, 2026 13:58

@MattSturgeon MattSturgeon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Diff LGTM overall. A couple questions and minor nits, but I think we've got this to a good functional state over the last few iterations!

Testing in https://github.com/NixOS/nixpkgs/actions/runs/21102528097?pr=480436#summary-60689633319 seems to show everything working correctly.

@philiptaron it'd be great to have your thoughts on the diff too, especially as I'm a co-author and don't want to sign this off entirely on my own.

Comment thread .github/actions/checkout/action.yml Outdated
Comment thread .github/actions/checkout/action.yml Outdated
console.log('Applying untrusted ci/pinned.json bump:', pin_bump_sha)
try {
await run('git', '-C', join('nixpkgs', 'untrusted'), 'cherry-pick', '--no-commit', pin_bump_sha)
} catch {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note: For simplicity I chose to catch any error. If we know the exit code for "cannot apply" we could check it if preferred.

// Compare the two commits to get the list of commits in between
const comparison = await github.rest.repos.compareCommitsWithBasehead({
...context.repo,
basehead: `${targetSha}...${headSha}`,

@MattSturgeon MattSturgeon Jan 18, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm a little rusty on my .. vs ... and also unsure whether this API supports ^ syntax (or if that even works for the 2nd parent of mergedSha)

I'm wondering if we can avoid needing to know headSha by using something like target..merged or target...merged^?

Comment thread .github/workflows/eval.yml
Comment thread .github/workflows/eval.yml
Comment thread .github/workflows/eval.yml Outdated
Comment thread .github/workflows/eval.yml Outdated

@philiptaron philiptaron left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Security review complete. This PR properly isolates ci/pinned.json bump commits for versioned evaluations through cherry-picking onto the target branch.

Security aspects reviewed:

  • Trust boundary maintained: cherry-pick only modifies nixpkgs/untrusted, preserving the trusted/untrusted separation
  • Commit isolation prevents unrelated PR changes from affecting version matrix evaluation
  • Multi-commit detection fails fast if >1 commit touches ci/pinned.json
  • Cherry-pick failure handling calls core.setFailed() with clear error messaging
  • No command injection, path traversal, or secret exposure risks
  • Proper permissions: {} restrictions maintained

Minor notes:

  • Typo on line 85 of action.yml: "Fetching out" → "Fetching"
  • Rate limit logging before/after the commit API calls wasn't implemented per the review discussion, but the 50-commit cap provides reasonable protection

LGTM from a security perspective.

@nixpkgs-ci nixpkgs-ci Bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Jan 20, 2026
@dyegoaurelio dyegoaurelio force-pushed the ci-eval-workflow branch 3 times, most recently from ed5713a to db63d2f Compare January 20, 2026 16:57
@nixpkgs-ci nixpkgs-ci Bot added 12.approvals: 2 This PR was reviewed and approved by two persons. and removed 12.approvals: 1 This PR was reviewed and approved by one person. labels Jan 20, 2026
@nixos-discourse

Copy link
Copy Markdown

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/formatting-team-meeting-2026-01-20/74520/1

When testVersions is enabled, the version matrix check now identifies
the specific commit that modified ci/pinned.json, rather than evaluating
the full PR. This allows formatting changes and other modifications to
coexist in the same PR without affecting the hash consistency check.

The workflow now:
- Adds headSha input to compare PR commits against target
- Finds the single commit that touched ci/pinned.json
- Errors if multiple commits modify it (to ensure clear attribution)
- Passes the bump commit to the checkout action for isolated evaluation
- Reports which commit was evaluated in the summary

The actual cherry-pick and pinned checkout handling is delegated to
the checkout action via the new `untrusted-pin-bump` input.

Co-Authored-By: Matt Sturgeon <matt@sturgeon.me.uk>
@MattSturgeon MattSturgeon added this pull request to the merge queue Jan 20, 2026
Merged via the queue into NixOS:master with commit 2991e1e Jan 20, 2026
62 checks passed
@nixpkgs-ci

nixpkgs-ci Bot commented Jan 20, 2026

Copy link
Copy Markdown
Contributor

Successfully created backport PR for release-25.11:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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 8.has: port to stable This PR already has a backport to the stable release. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. 12.approvals: 2 This PR was reviewed and approved by two persons.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants