Skip to content

workflows/pr: preparation for required status checks#417957

Merged
wolfgangwalther merged 5 commits intoNixOS:masterfrom
wolfgangwalther:ci-required-status-check
Jun 20, 2025
Merged

workflows/pr: preparation for required status checks#417957
wolfgangwalther merged 5 commits intoNixOS:masterfrom
wolfgangwalther:ci-required-status-check

Conversation

@wolfgangwalther
Copy link
Contributor

@wolfgangwalther wolfgangwalther commented Jun 18, 2025

This adds a PR / required to merge job, which:

  • is skipped when Check / Lint / Eval / Build all succeed,
  • fails when any of them fail.

Once merged, this job can be used for the "Required Status Checks" branch protection rule. Once we enable that, merging PRs will only be possible when CI succeeds.

Before adding this job, I restructed the PR workflow slightly: Labels and Reviewers were previously part of Eval, but that would make them required as well. By moving them up into the PR workflow, they can be optional for the required job. They don't really need to block a merge.

While doing that, I also fixed the merge commit inconsistencies described in #406825 (comment).

Roadmap to Required Status Checks:

I'm not sure if we need to wait and if yes, how long, before enabling the checks. Every PR that ran its CI the last time before the merge of this PR, will be blocked from merging until CI is triggered again.

Note: Any discussion around if and how to implement the branch protection rules is better placed in NixOS/org#130.

Things done


Add a 👍 reaction to pull requests you find important.

@github-actions github-actions 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-24.11 labels Jun 18, 2025
@wolfgangwalther
Copy link
Contributor Author

wolfgangwalther commented Jun 19, 2025

I'm not sure if we need to wait and if yes, how long, before enabling the checks. Every PR that ran its CI the last time before the merge of this PR, will be blocked from merging until CI is triggered again.

Another way of dealing with that could be to run a one-time CI job that goes back a certain amount of time and manually creates a status check with the same name for all PRs which had passed all jobs. We'd probably want to limit this, because after a certain time X, a PR can be very well considered out of date and CI should run again. But this would allow for a smoother transition.

@wolfgangwalther
Copy link
Contributor Author

Applied the wording improvements locally, but will only push once we bikeshedded the name enough - every push here is heavy with > 40 jobs running.

@wolfgangwalther wolfgangwalther force-pushed the ci-required-status-check branch from f68c81b to 3aabef1 Compare June 20, 2025 07:04
Some naming improvements after we introduced the PR / Push workflows and
small refactors.
This is only a refactor at this stage, but split into a separate commit
for better review. It's the base for the next two commits.
This fixes a problem where each workflow would get their own merge
commit. This happens frequently when the target branch is merged into a
the same time, different workflows in the same run will run
get-merge-commit at different times and thus have different merge
commits.

Since the jobs don't really depend on each other, this doesn't cause
practical problems, yet. But it has already led to strange CI failures
in a still unmerged PR, which can be prevented from happening with this
clean approach.

And yes, this saves a few API calls on every run.
This allows *not* depending on those two jobs with the required status
checks in the next commit, which wouldn't really make sense. If labeling
or pinging maintainers fails for obscure reasons or because the GitHub
API is down, a PR might still pass all other tests and be
merge-eligible.
This job serves as a target for the "Required Status Checks" branch
protection rule.
@wolfgangwalther wolfgangwalther force-pushed the ci-required-status-check branch from 3aabef1 to caf4ced Compare June 20, 2025 07:23
Copy link
Contributor

@MattSturgeon MattSturgeon left a comment

Choose a reason for hiding this comment

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

Went through each commit again. Everything seems clear, and I don't see any obvious issues.

I'd say let's test this out 🚀

Comment on lines +96 to +114
# This job's only purpose is to serve as a target for the "Required Status Checks" branch ruleset.
# It "needs" all the jobs that should block merging a PR.
# If they pass, it is skipped — which counts as "success" for purposes of the branch ruleset.
# However, if any of them fail, this job will also fail — thus blocking the branch ruleset.
no-pr-failures:
# Modify this list to add or remove jobs from required status checks.
needs:
- check
- lint
- eval
- build
# WARNING:
# Do NOT change the name of this job, otherwise the rule will not catch it anymore.
# This would prevent all PRs from merging.
name: no PR failures
if: ${{ failure() }}
runs-on: ubuntu-24.04-arm
steps:
- run: exit 1
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume, before merging, we should confirm in NixOS/org#130 that we are definitely planning to enable required status checks at some point?

I can't see why we wouldn't want to... But if the proposal was blocked for any reason, then we wouldn't need to merge this job.


Alternatively, we could merge it optimistically so that we can see it working in production.

Once we've proven the CI is working, it will be easier to argue in favour of requiring it.

With this approach, we can still remove the job later if the proposal is blocked or we change our minds (for whatever reason).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alternatively, we could merge it optimistically

I'd say let's do that, yes. It's not going to do any harm if unused - especially with the new naming that doesn't say anything about "required" anymore.

@github-actions github-actions bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Jun 20, 2025
@wolfgangwalther wolfgangwalther merged commit 838eff9 into NixOS:master Jun 20, 2025
50 of 52 checks passed
@wolfgangwalther wolfgangwalther deleted the ci-required-status-check branch June 20, 2025 11:01
@nixpkgs-ci
Copy link
Contributor

nixpkgs-ci bot commented Jun 20, 2025

Successfully created backport PR for release-24.11:

@nixpkgs-ci
Copy link
Contributor

nixpkgs-ci bot commented Jun 20, 2025

Successfully created backport PR for release-25.05:

@github-actions github-actions bot added the 8.has: port to stable This PR already has a backport to the stable release. label Jun 20, 2025
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: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants