# \[RFC\] Running Premerge Postcommit Through Github Actions

**URL:** <https://discourse.llvm.org/t/rfc-running-premerge-postcommit-through-github-actions/86124>\
**Category:** Project Infrastructure\
**Created:** [May 1, 2025, 4:11pm UTC](https://discourse.llvm.org/t/rfc-running-premerge-postcommit-through-github-actions/86124 "2025-05-01T16:11:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![boomanaiden154-1](https://sea1.discourse-cdn.com/flex021/user_avatar/discourse.llvm.org/boomanaiden154-1/32/20078_2.png) [@boomanaiden154-1](https://discourse.llvm.org/u/boomanaiden154-1)\
**Post date:** [May 1, 2025, 4:11pm UTC](https://discourse.llvm.org/t/rfc-running-premerge-postcommit-through-github-actions/86124/1 "2025-05-01T16:11:04Z")

</div>

It is important to have a way to test the exact configuration that runs premerge after each commit to main to ensure that the pipeline is green on main. This is especially important after we migrate to Github actions which we plan to do in the next couple weeks where each PR is tested against the latest main at the time of pushing to the PR. If main is broken, this manifests in tests for PRs also being broken. Currently postcommit testing for the premerge configuration is handled through buildbot with the premerge-monolithic-linux and premerge-monolithic-windows buildbots. In previous discussions (like our US dev [meeting](https://youtu.be/CLczt-RJzAA?feature=shared) talk), we have proposed that we move to testing this configuration within Github actions itself. Recently some have suggested this be done as a proper RFC to better outline the design and motivation and to encourage further discussion.

# Summary

Currently a buildbot runs postcommit to check if main is broken against the same configuration run in premerge. We would like to move over to running these postcommit checks through Github for a variety of reasons rather than through Buildbot and have written this proposal outlining our motivations and addressing concerns that have been brought up.

# Motivation

- Increased fidelity - One of the major problems with the existing infrastructure being split between Buildkite and Buildbot has been errors that only manifest on one of the systems. This has caused quite a bit of pain, especially when all premerge checks are broken despite the postcommit bot being green. This could be partially remedied by using the same script for both rather than just a CMake factory on the Buildbot side as is done currently, but there still can be questions of fidelity between the systems depending upon how they are set up. Minor configuration changes can have big consequences. Doing everything within Github on the new premerge side eliminates this problem. We use the same exact pipeline and just add another event that triggers the workflow (a one line change), ensuring the steps that are run and the configurations that are built/tested are exactly the same. They also cannot fall out of sync since they come from the same definition.
- Autoscaling - Using Github lets us use the existing autoscaling infrastructure that we have set up to autoscale runners for postcommit testing. This allows commits in main to be tested quickly, especially when they come in a burst, which can be important to diagnose premerge checks that are broken at HEAD, especially given the commit velocity that LLVM has. Using Buildbot would require us to dedicate specific machines, with no easy to use solution to autoscale buildbot workers. This would take away resources from being used to test PRs and also would prevent savings when they get autoscaled down that ultimately get used for more peak capacity/faster machines.
- Less Maintenance - Currently postcommit testing with Github requires a one line change. Doing postcommit testing through Buildbot would represent a significant investment in development time that would detract from other efforts around premerge. Ensuring configurations stay in sync can be made relatively easy with proper engineering, but ultimately still requires some maintenance.

# Concerns

- This is a deviation from how LLVM traditionally does postcommit testing - Yes, this does diverge from how LLVM traditionally does postcommit testing and requires people to interact with yet another system. I think the benefits outweigh the drawbacks though, especially given most people should already be familiar with most of the Github Actions UI given it is what we are moving to for premerge.
- Github UI concerns - Github does seem to have some UI limitations, particularly around emails that get sent around job failures. There is little that we can do here, but failure emails do clearly link to the workflow status page which contains most relevant information. The job summaries that get displayed on this page can also be customized as they are standard markdown that gets written by the test jobs themselves. Some pages are less discoverable, like a page showing the status of the most recent commits to main, but they are present.
- Job naming concerns - It was pointed out that the job naming can be confusing given the jobs are titled “Premerge checks” even when running against main. We have a [PR](https://github.com/llvm/llvm-project/pull/138024) up to adjust this.
- Differences in alerting behavior from Buildbot - It was also pointed out that the alerting behavior differs from Buildbot where someone will still receive an email for a failed job even if main is already broken. While we do not have concrete plans, we have been discussing creating a system to not fail jobs based on test/build failures that are already happening in main. Although our hope is that proposals like [https://discourse.llvm.org/t/rfc-add-a-warning-when-bypassing-the-premerge-testing/77610](https://discourse.llvm.org/t/rfc-add-a-warning-when-bypassing-the-premerge-testing/77610) will help alleviate this problem. If we are looking at launching before having any remediation in place (either a low failure rate in main or the ability to ignore previous failures), we will mark the job as succeeding on main regardless of failures to avoid increasing noise. This allows for manual inspection of jobs to see where things are broken while not adding any additional noise as we want to avoid contributing to warning fatigue.

---

<div class="post-metadata">

**Author:** ![boomanaiden154-1](https://sea1.discourse-cdn.com/flex021/user_avatar/discourse.llvm.org/boomanaiden154-1/32/20078_2.png) [@boomanaiden154-1](https://discourse.llvm.org/u/boomanaiden154-1)\
**Post date:** [May 1, 2025, 4:11pm UTC](https://discourse.llvm.org/t/rfc-running-premerge-postcommit-through-github-actions/86124/2 "2025-05-01T16:11:16Z")

</div>

cc @mehdi_amini

---

<div class="post-metadata">

**Author:** ![DavidSpickett](https://sea1.discourse-cdn.com/flex021/user_avatar/discourse.llvm.org/davidspickett/32/1984_2.png) [@DavidSpickett](https://discourse.llvm.org/u/DavidSpickett)\
**Post date:** [May 2, 2025, 9:10am UTC](https://discourse.llvm.org/t/rfc-running-premerge-postcommit-through-github-actions/86124/3 "2025-05-02T09:10:53Z")

</div>

> [@boomanaiden154-1](#):
>
> Less Maintenance - Currently postcommit testing with Github requires a one line change. Doing postcommit testing through Buildbot would represent a significant investment in development time that would detract from other efforts around premerge. Ensuring configurations stay in sync can be made relatively easy with proper engineering, but ultimately still requires some maintenance.

Also people may not be aware that for the default way of setting up build bots using Buildbot, you configure it using a Python class. The consequence of that is that to change the configuration, the Buildbot instance must be restarted. Meaning the main server, not the client that runs on the workers.

Requesting a restart is a simple process but nevertheless it can be days before a change makes it to production and time is spent theorizing how to cope with the problem in the meantime.

> [@boomanaiden154-1](#):
>
> Differences in alerting behavior from Buildbot - It was also pointed out that the alerting behavior differs from Buildbot where someone will still receive an email for a failed job even if main is already broken.

Can you explain this further, and contrast it with what a contributor will see from this proposed GitHub Actions based post-commit testing?

Buildbot already has a bit of a “I got an email, so what?” problem, and I don’t expect this proposal to solve that but I’m interested in how we would help contributors do the right thing if they do get notifications.

---

<div class="post-metadata">

**Author:** ![mehdi\_amini](https://sea1.discourse-cdn.com/flex021/user_avatar/discourse.llvm.org/mehdi_amini/32/25595_2.png) [@mehdi\_amini](https://discourse.llvm.org/u/mehdi_amini)\
**Post date:** [May 2, 2025, 10:37am UTC](https://discourse.llvm.org/t/rfc-running-premerge-postcommit-through-github-actions/86124/4 "2025-05-02T10:37:37Z")

</div>

> [@boomanaiden154-1](#):
>
> I think the benefits outweigh the drawbacks though, especially given most people should already be familiar with most of the Github Actions UI given it is what we are moving to for premerge.

Actually I’m not convinced by the “familiar” argument, and you somehow acknowledge the limitation of this in the very following bullet point! (thanks for this by the way).

> [@boomanaiden154-1](#):
>
> Github UI concerns - Github does seem to have some UI limitations, particularly around emails that get sent around job failures. There is little that we can do here, but failure emails do clearly link to the workflow status page which contains most relevant information. The job summaries that get displayed on this page can also be customized as they are standard markdown that gets written by the test jobs themselves. Some pages are less discoverable, like a page showing the status of the most recent commits to main, but they are present.

This is something we should be looking at a bit deeper and document carefully.

The UI for premerge does not have the same constraint as a post-merge system: you get some information on your PR which links directly to a build/test result. This works great!  
As part of this I never ever had to look at the [GitHub action UI](https://github.com/llvm/llvm-project/actions) actually.

What is critical for a post-merge system IMO (top of my head, I may forget things):

- Email notification:

- Easy way to track the state of main / a regression over time.

This latter point is where the GitHub UI isn’t great. It seems that this would be the view: [CI Checks · Workflow runs · llvm/llvm-project · GitHub](https://github.com/llvm/llvm-project/actions/workflows/premerge.yaml?query=branch%3Amain+) ; so this exists in GitHub, which is nice (discoverability isn’t great, but we can provide a direct link from the doc / readme at least) .  
The UI is grouping everything together (all of the test / configs, so a windows failure overlapping with a linux failure would result in a long “red” state without an easy way to figure out).

Overall it seems like the system is “workable”, but I’m not sure to which extent (like when you workaround triggering an email for a broken `main` by not failing the job, how does it affect the history view of `main`? Wouldn’t the job show up as “green”?).

So the main concern is that contrary to buildbot, we have no way out. Over time we have been able to customize over time the email notifications, the UI reporting, and the overall behavior of buildbot to fit precisely what we expected of it. With GitHub we’ll be completely stuck, unless maybe we use GH Actions as an orchestrator but we write custom logic for sending email and extracting the data into a different dashboard for tracking failures? (I don’t know the feasibility of it, it reminds me of the third-party overlay UI for Pull-requests reviews).  
Ideally I’d want to separate tracking of a build failure from each individual tests (Googlers know how you can track the history of every single test individually for example), which allows to signal regressions even when `main` is already broken (that is: there is a `flang` test failing on `main` and my commit will fail a `clang` test and I would be notified specifically for the new tests failure). (note this is beyond what Buildbot is capable of tracking today of course).

---

<div class="post-metadata">

**Author:** ![boomanaiden154-1](https://sea1.discourse-cdn.com/flex021/user_avatar/discourse.llvm.org/boomanaiden154-1/32/20078_2.png) [@boomanaiden154-1](https://discourse.llvm.org/u/boomanaiden154-1)\
**Post date:** [May 6, 2025, 5:36am UTC](https://discourse.llvm.org/t/rfc-running-premerge-postcommit-through-github-actions/86124/5 "2025-05-06T05:36:23Z")

</div>

> [@DavidSpickett](#):
>
> Also people may not be aware that for the default way of setting up build bots using Buildbot, you configure it using a Python class. The consequence of that is that to change the configuration, the Buildbot instance must be restarted. Meaning the main server, not the client that runs on the workers.

Yeah, that’s something that we would need to take into account. Although executing a script contained within the monorepo (ideally the same one that we use for premerge) would mean we can change the configuration much more easily.

I don’t believe there is a way to set it up so that you can make configuration changes to the buildbot worker and have them deploy more quickly?

> [@DavidSpickett](#):
>
> Can you explain this further, and contrast it with what a contributor will see from this proposed GitHub Actions based post-commit testing?
> 
> Buildbot already has a bit of a “I got an email, so what?” problem, and I don’t expect this proposal to solve that but I’m interested in how we would help contributors do the right thing if they do get notifications.

The email is definitely quite a bit worse than what buildbot sends, at least in terms of information contained within the email itself. An example is in [GitHub CI notifications and main branch](https://discourse.llvm.org/t/github-ci-notifications-and-main-branch/85868). It just says jobs failed and then gives links back to the workflow invocation.

> [@mehdi\_amini](#):
>
> Overall it seems like the system is “workable”, but I’m not sure to which extent (like when you workaround triggering an email for a broken `main` by not failing the job, how does it affect the history view of `main`? Wouldn’t the job show up as “green”?).

Right, just not failing the job would mark it as green. There is no way with Github as far as I can tell to fail the job and not send out an email.

> [@mehdi\_amini](#):
>
> unless maybe we use GH Actions as an orchestrator but we write custom logic for sending email and extracting the data into a different dashboard for tracking failures? (I don’t know the feasibility of it, it reminds me of the third-party overlay UI for Pull-requests reviews).  
> Ideally I’d want to separate tracking of a build failure from each individual tests (Googlers know how you can track the history of every single test individually for example), which allows to signal regressions even when `main` is already broken (that is: there is a `flang` test failing on `main` and my commit will fail a `clang` test and I would be notified specifically for the new tests failure). (note this is beyond what Buildbot is capable of tracking today of course).

Yeah, a custom dashboard would probably be the only way to get the things you mention at first, and if we want introspection into specific tests, that would definitely require some custom scripting. I think it’s possible to do, but definitely not extremely trivial work.

Thinking about everything a bit more though, I think it might be possible to get a buildbot solution working. We can’t use something like the k8s latent workers that buildbot supports natively because that requires having the buildbot master directly create jobs on a k8s cluster which I don’t think we want to support. We should be able to write up some scripts that allow a buildbot worker to spin up k8s pods and execute builds within them though without too much trouble I would think. This will create some contention in terms of resources with Github, but we are planning on doubling the cluster capacity anyways to try and get rid of queueing delays, so dedicating a hundred or so cores per platform to post commit testing should be doable, especially since the proposed method would enable autoscaling.

I think that should cover most of our motivations (although with slightly less fidelity and a little bit more maintenance) while alleviating most of the concerns. We will have to make sure the system proves reliable, but I don’t forsee any components being too difficult to get right.

If we’re going to go down the buildbot route, I don’t think we are going to have this ready when we launch the new premerge system (make the results canonical over Buildkite in addition to sunsetting Buildkite after we have confirmed things are working reasonably well), but I don’t think that’s a regression over the old system. We should be able to keep the old buildbots up in the mean time as well.

---

<div class="post-metadata">

**Author:** ![DavidSpickett](https://sea1.discourse-cdn.com/flex021/user_avatar/discourse.llvm.org/davidspickett/32/1984_2.png) [@DavidSpickett](https://discourse.llvm.org/u/DavidSpickett)\
**Post date:** [May 6, 2025, 9:08am UTC](https://discourse.llvm.org/t/rfc-running-premerge-postcommit-through-github-actions/86124/6 "2025-05-06T09:08:00Z")

</div>

> [@boomanaiden154-1](#):
>
> Yeah, that’s something that we would need to take into account. Although executing a script contained within the monorepo (ideally the same one that we use for premerge) would mean we can change the configuration much more easily.

To be clear this isn’t a problem with what you propose, it’s a benefit of doing this via. GitHub. For more obscure builders, a few days of red can be dealt with, but not for builder every PR goes through.

> [@boomanaiden154-1](#):
>
> I don’t believe there is a way to set it up so that you can make configuration changes to the buildbot worker and have them deploy more quickly?

I have a feeling there is, but I don’t know the details.

`AnnotatedBuilder` seems to be the most free-form, so that could execute a script that itself executes a script from llvm-project, Which uses some env checks to see if it was in a GitHub or Buildbot context.

(I think the `AnnotatedBuilder` echos some specially formatted text to produce the stages in the Buildbot UI)

> [@boomanaiden154-1](#):
>
> The email is definitely quite a bit worse than what buildbot sends, at least in terms of information contained within the email itself. An example is in [GitHub CI notifications and main branch](https://discourse.llvm.org/t/github-ci-notifications-and-main-branch/85868). It just says jobs failed and then gives links back to the workflow invocation.

Understood. The emails are triggered in the same manner, but the content is lacking.

---

<div class="post-metadata">

**Author:** ![jplehr](https://sea1.discourse-cdn.com/flex021/user_avatar/discourse.llvm.org/jplehr/32/14572_2.png) [@jplehr](https://discourse.llvm.org/u/jplehr)\
**Post date:** [May 6, 2025, 9:39am UTC](https://discourse.llvm.org/t/rfc-running-premerge-postcommit-through-github-actions/86124/7 "2025-05-06T09:39:51Z")

</div>

> I have a feeling there is, but I don’t know the details.

This is the reason why we are moving away from the `OpenMPBuilder`-based buildbots to `AnnotatedBuilder`-based buildbots. Committed changes to the `annotated` scripts are picked up with the next update to the llvm-zorg copy on the worker. That gives you much better control and response time to config changes or fixes on what the builder does.  
Note that this does not involve changes to the configuration of the actual builder, like which projects it listens on / which changes trigger a build.
