-
Notifications
You must be signed in to change notification settings - Fork 4
Merge train: qualify the test branch by PR id #134
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
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
8ad5644 to
4910759
Compare
1d7d49e to
eb849f1
Compare
4910759 to
9188ef9
Compare
02f2523 to
3167ce6
Compare
The PR id might not uniquely identify the thing you are building. Suppose we have PRs A and B, we build a train
Yeah, I think you will need this either way. The more parallel builds you speculatively start, the lower the return on investment, because the longer the train is, the more likely it is to fail. And if you don’t limit parallelism in Hoff but instead let the CI provider handle that, then priority is hard to control. I would go with the build slots, and make the amount configurable.
Keep in mind that the branch |
The current idea is to build only:
The following will only start building once A fails (and consequently B and C, since the current plan does not allow merging further PRs on top of a failing PR):
In this way the PR id still uniquely identifies the build. In the future, if we decide to move towards more speculative builds I would rather use
See the idea above:
I am aware of that, the current implementation already takes this into account, see: 503461e. The
|
Yes, but it will also be an issue for everybody who has cloned the repository and who has a remote-tracking branch (which is probably going to be everybody who uses that repository), it will make It’s nothing that an announcement can’t fix, I just wanted to point it out. |
fatho
left a comment
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.
LGTM for now - But I'll have a final look once it has been rebased after the other relevant PRs have been merged.
273eba5 to
e7880bc
Compare
@ruuda This makes sense, noted. I haven't tested this, but I guess this can be (manually) fixed in two ways:
I'll check whether either/both work and include these in an announcement accordingly. |
@fatho The other relevant PRs have been merged and I rebased on top of the new master. Can you please take a look again? |
fatho
left a comment
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.
LGTM
|
@fatho Thanks for the review. I will wait until I deploy v0.25.9 before I merge this. |
... this is for now ignored so there are no changes in app behaviour. In the future, this will be used to qualify the test branch with the id of the originating PR.
... in order to support CI parallel execution of testing branches (merge train)
e7880bc to
746472e
Compare
|
I performed a trivial rebase on top of master which was updated with a change in 3 lines of code. There were no conflicts: rudy@dev-lt-55:~/channable/hoff$ git l ..master
2022-07-28 10:25:34 +0200 2cd75b0 Rudy Matela Hoff v0.25.9 (tag: v0.25.9, origin/master, origin/HEAD, master)
2022-07-28 10:01:07 +0200 8e2ec1e OpsBotPrime Merge #145: Ignore duplicate build status webhooks (origin/testing)
2022-07-28 09:45:02 +0200 6017ef6 Rudy Matela Ignore duplicate build status hooks. (fix tests)
2022-07-28 09:42:08 +0200 fac73f9 Rudy Matela test/Spec: test duplicate GH hooks (break tests)
rudy@dev-lt-55:~/channable/hoff$ git rebase master
First, rewinding head to replay your work on top of it...
Applying: Pass PullRequestId to tryIntegrate
Applying: Qualify testing branch name by PullRequestId
Applying: Add (unused) DeleteBranch operation
Applying: fixup! Add (unused) DeleteBranch operation
Applying: initial version of test branch cleaning up
Applying: src/Git: rename DeleteBranch to DeleteRemoteBranch
Applying: add and use the deleteBranch operation
Applying: refactor: add and use Logic.testBranch (DRY code)
Applying: fix bug in deleteRemoteBranch
Applying: src/Logic: delete unqualified testing branch
Applying: fix failing tests: cleanup of integration branches
Applying: EventLoopSpec: add test for a failing build
Applying: fix build of tests/Spec.hs
rudy@dev-lt-55:~/channable/hoff$ git push --force-with-lease
...
To github.com:channable/hoff
+ e7880bc...746472e merge-train/isolate-test-branches -> merge-train/isolate-test-branches (forced update)... so I don't think there's need to review again. I would let @OpsBotPrime deal with this, but I need to rebase #137 on top of this very PR, so I might as well rebase on top of something that includes the latest |
|
I tested this in conjunction with GitHub again just to be sure and all seems to be working. It's time to prepare the next deployment again. @OpsBotPrime merge on Friday. |
|
Pull request approved for merge by @rudymatela, rebasing now. |
... in preparation for an actual DeleteBranch operation that deletes a branch locally.
... that deletes a branch locally
... to maintain backwards compatibility with existing Hoff maintained repos.
... which was broken after a rebase
Approved-by: rudymatela Auto-deploy: false
|
Rebased as 9cbd57e, waiting for CI … |
|
Here is the message I will send to the users. Manual intervention required for @OpsBotPrime (Hoff v0.26.0)Hoff v0.26.0 builds PRs on separate testing branches qualified by PR# ( $ git fetch
error: cannot lock ref 'refs/remotes/origin/testing/109': 'refs/remotes/origin/testing' exists; cannot create 'refs/remotes/origin/testing/109'
From github.com:organization/repository
! [new branch] rudy-testing/109 -> origin/rudy-testing/109 (unable to update local ref)
error: some local refs could not be updated; try running
'git remote prune origin' to remove any old, conflicting branchesIf that happens, simply follow the instruction by git to prune the conflicting branch: $ git remote prune origin
Pruning origin
URL: git@github.com:channable/git-sandbox
* [pruned] origin/rudy-testingThen pull or fetch again: $ git fetchAlternatively you can use Unfortunately, this will happen once per repository. To fix the issue for all repositories that have been built by Hoff already, you can do: $ cd <workspace>
$ for repo in *; do git -C $repo fetch --prune; doneWhy is this change necessary?A future version of Hoff will include parallel builds of a merge train (#77), this is necessary so we can support that. |
746472e to
9cbd57e
Compare
In #134, we transitioned from testing on `testing/<id>` instead of just `testing`. In order to maintain backwards compatibility, we had to delete `testing` every time we created a new `testing/<id>` branch. That has been a month ago, and most projects that use Hoff should have had at least one PR triggering the deletion of `testing`. So we should remove this code that tries deletion every time. We currently see the following in the logs every time we merge: ```haskell Aug 18 13:37:12 hoff hoff[4321]: [Warn] error: git push -d failed. Reason: error: unable to delete 'testing': remote ref does not exist Aug 18 13:37:29 hoff hoff[4321]: error: failed to push some refs to 'git@github.com:<org>/<repo>.git' ``` This should get rid of entries like the above.
Partly closes: #77
Qualify the test branch by PR id in order to prepare for a future change where we will have multiple PR ids. Instead of building on
testing, we build ontesting/<id>.This is made on top of #131.
Side effectThere is no side effect. GitHub only shows the following boxes when the pusher is the GitHub user. So only the user used by Hoff would see it and not regular developer users. 🎉 :-)
There is a little side effect of this, while the tests for a PR is running, GitHub will show a "compare & pull request" suggestion box:It should disappear after the build passes or fails and the branch is deleted by Hoff.Ideally, there should be a setting on GitHub to tell it to ignore branches starting with a giventesting/prefix. But it seems this is not the case. According to my (lack of) findings, there is no way to set this:https://stackoverflow.com/questions/71162762/how-to-get-rid-of-githubs-compare-pull-request-suggestionhttps://github.community/t/how-to-fix-compare-pull-request/161488https://duckduckgo.com/?q=github+dismiss+"compare+%26+pull+request"https://www.google.com/search?q=github+dismiss+"compare+%26+pull+request"One could think of mitigating this by having a small set of testing slots for which we start by dismissing manually:testing/1testing/2testing/3testing/4testing/5testing/6However, this solution would not work, because:limit the maximum number of PRs in our merge train (Merge train #77);make it difficult to manage in terms of code (keeping track of free slots);make it difficult to know which testing branches are actually being used in case of build failures (with PR numbers it is easy!);... all of this by not actually solving the problem from the get-go -- at least in the first six builds per project we would have to manually dismiss each "compare and pull request" suggestion.So it seems we are stuck with the minor side effect of seeing that button while the build builds.