spack/spackbot

Command to rebase a PR

adamjstewart opened this issue · 6 comments

Could we get a command like @spackbot rebase to help rebase a PR branch? A lot of contributors don't know git very well and rebasing is sometimes required to work out bugs in CI. Of course, if the rebase fails, we'll need to tell the contributor that there was a merge conflict and they'll need to do it manually. Maybe we could give a link to some git docs on how to resolve merge conflicts.

vsoch commented

Sure! Could you include:

  1. the commands that would need to be done for each of GitHub and GitLab
  2. the use cases when this would be appropriate (for the docs so there is absolute clarity)
  3. the pseudocode (e.g.,, receive command, check for X permissions, try command A, try command B, if A fails, if B fails, etc.

I can start working on this after #23 #24 #22

  1. This has nothing to do with GitHub or GitLab, it's all pure git. The commands would look something like:
    $ git checkout develop  # make sure we are on develop
    $ git pull upstream develop  # make sure develop is up-to-date
    $ git checkout origin <pr_branch>
    $ git rebase develop
    $ git push --force origin <pr_branch>
  2. The use case would be any time a core developer asks you to rebase your PR.
  3. I think the permissions stuff should be identical to the style stuff, although we may want to restrict it to just the PR author themselves since rebasing a branch can cause headaches if you don't know how to update your own local copy.
vsoch commented

This has nothing to do with GitHub or GitLab, it's all pure git.

I was asking because it could be that the bot would push back to either - in the above I see it's pushing to GitHub so it's related to GitHub. Also Zack said:

Under the hood, this should be as simple as “delete this branch from GitLab”. Then the sync script will push a new merge commit in another couple minutes.

Which suggested that the bot should do some kind of interaction with GitLab (which you are saying is not the case).
The other stuffs looks good, thanks!

@vsoch: for the most part we try not to touch GitLab -- the authoritative repo is the one on GitHub... Spack CI is using GitLab mirroring under the hood and if you want to restart a pipeline that already ran, there's some interaction needed.

If you rebase the PR (as a user would) and push to GitHub, there's another service running that handles starting the GitLab pipeline again, so we shouldn't need to mess w/that here.

vsoch commented

Makes sense, but I wanted to clarify because Zack's comment suggested otherwise.

If you rebase the PR (as a user would) and push to GitHub, there's another service running that handles starting the GitLab pipeline again, so we shouldn't need to mess w/that here.

Nice :)

GitHub has this feature built-in. I don't think we need a spackbot command for this.