-
Notifications
You must be signed in to change notification settings - Fork 14.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KAFKA-18500 Build PRs at HEAD commit #18449
base: trunk
Are you sure you want to change the base?
Conversation
e68973f
to
85a5fde
Compare
2d485d2
to
8539eb0
Compare
Ok, there is a fundamental problem here. The When trunk is moving quickly, our PRs will have little hope to benefit from much caching. For example:
If commit C was the last trunk commit to be built, there will be Gradle cache files for that commit. Commits A and B are still building. If the PR was simply building X, this would be fine and we would expect cache hits for anything not changed by X, Y, Z. However, the
So when the PR is built, it will be fetching the latest cache (C), but will include file changes from A and B in addition to the PR changes. This greatly increases cache misses. I think the merge queue might be a solution to this. If we do a full build as part of the merge queue, then no code will land on trunk that has not been built, tested, and cached. The risk with this approach is that flaky builds will prevent things from getting into trunk. |
One way to workaround the flaky test issue would be to increase the number of retries for failed tests when running the build via the merge queue. That said, we'd want to measure how much time we're taking with this extra time versus time saved in PRs themselves. |
Ok, I was able to modify the build to check out the PR at HEAD instead of the merge commit. This increase our cache hits a lot. The recent job finished in around 1 hour because it only had to run |
@ijuma WDYT about this approach? |
I haven't reviewed the code changes - the approach looks good. |
The default checkout behavior for GitHub Actions is to use a special merge ref which is equivalent to the base branch with the PR merged into it. While this is useful for checking compilation issues against trunk, it effectively breaks our ability to use any build caching.
This patch changes the build to checkout the HEAD commit of the PR when building. The "Compile and Check" step still checks out the merge commit so we can keep that level of validation.