-
Notifications
You must be signed in to change notification settings - Fork 3
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
Merge train: infer candidate from state #131
Merge train: infer candidate from state #131
Conversation
8ad5644
to
4910759
Compare
c'mon GitHub, I thought you could handle the renaming of branches... apparently not. |
So I tried renaming the branch from |
Infer the `integrationCandidate` instead of storing it explicitly on the project state. This may make it easier to implement the merge train as we will need to handle multiple integration candidates. This specific change tries to maintain backward compatibility where possible, this backwards compatibility will gradually be cleaned up in further commits. The code typechecks but the tests fail for now.
where applicable to replace candidatePullRequests. In the code "candidate" can mean two different (but related things): * a candidate for integration, as returned by the function candidatePullRequests; * something that has been integrated and is waiting for build results to become master integrationCandidate field of ProjectState; If I understand correctly, the latter is perhaps better described as a PR that is "integrated-but-waiting-for-build-results" or an integratedCandidate. The names have not yet been updated to reflect this. cf: #77 (comment) This fixes some failing tests, but there are still quite a few to go...
... this makes the tests pass again.
... as it was now a no-op.
... and simplify one of the unreachable cases.
... in actual code. It is now only used in tests.
in favour of getIntegrationCandidate
4910759
to
9188ef9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically LGTM, but some questions:
src/Project.hs
Outdated
@@ -287,6 +295,7 @@ classifyPullRequest pr = case approval pr of | |||
BuildPending -> PrStatusBuildPending | |||
BuildSucceeded -> PrStatusIntegrated | |||
BuildFailed url -> PrStatusFailedBuild url | |||
Promoted -> PrStatusIntegrated -- TODO: state-of-its-own? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there still something you want to do about this TODO?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really, I removed it from the code now: e6c9da1
cId `shouldBe` PullRequestId 2 | ||
actions `shouldBe` | ||
[ ATryIntegrate "Merge #2: Add my test results\n\nApproved-by: deckard\nAuto-deploy: false\n" (Branch "refs/pull/2/head", Sha "f37") False | ||
[ ATryPromote (Branch "results/leon") (Sha "38d") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does this extra action come from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this test suite, there are two open PRs:
- the first which has been rebased and the build has (just) passed;
- the second which was not rebased yet;
So the actions should be to promote the first to be the new master, and try to rebase (integrate) the second.
If we instead set the first PR to be Promoted
, the TryPromote
should disappear.
This extra action just came to how the state is represented now: before a Promoted
pr was one that was Integrated BuildSuceeded
while the candidate was Nothing
.
I decided to change the test to include the promotion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could update the test name, but I think it still applies 😁:
"picks a new candidate from the queue after a successful push"
@fatho Thanks for the review. Since I think I have addressed your comments, I am going to merge and tag now. I will leave the deploy for later today at around 19:00 (if there are no items in the build queue). @OpsBotPrime merge and tag |
Pull request approved for merge and tag by @rudymatela, rebasing now. |
Approved-by: rudymatela Auto-deploy: false
Rebased as c3d7e54, waiting for CI … |
@rudymatela Sorry, I could not tag your PR. The previous tag |
Oohh yes, of course. #117 will make you support it. |
... in preparation for #77 (partly closes: #77)
The changes in this PR do not change Hoff behaviour, the high level functionality should be the same.
Instead of maintaining a global candidate, we infer it from the state always. This is in preparation for merge trains (#77), where we will have multiple builds running in parallel and thus multiple candidates.
ProjectState
datatype is now simpler and easier to maintain (before we could risk it being inconsistent);Promoted
to signify that the PR branch is now part ofmaster
, before this was signified by beingIntegrated ... BuildSucceeded
but not being the global candidate.A linear search on the number of open PRs is imposed. I believe this is not a problem because:
Notes
This is an alternative to PR #130. Here, instead of changing the datatype of
integrationCandidate
, we simply remove it and try to infer from the rest of the state every time.