Creating a pull request
Purpose
This describes how, as a developer, to create a pull request.
Benefits of a pull request
A pull request created on github provides visibility to the entire userbase on the changes that are occurring in the MariaDB Server.
The pull request created automaticity triggers the required Buildbot builds associated with it.
The created pull request is associated strongly with a MariaDB Server branch where it is to be merged. There have been cases where a passing protected branch build as been incorrectly pushed to a former branch by mistake.
A pull request on github can be reviewed, and those reviewing it might have valuable insight. By putting all the reviews in one location, reviewers can learn off each other and not repeat works already review. The reviews are there for future reference if additional though is requires as to why a particular change was made.
A pull request has a clear indicator of the reviews conducted, by who, and who you are expecting further reviews from.
When a developer with commit access, either the author or a reviewer has completed and passed a review, they can mark the pull request as auto-merge, enabling the pull request to be merge once the protected branch builds passed.
Mechanism of creating a pull request
A pull request can be created on the MariaDB github web page, https://github.com/MariaDB/server, or any fork created using github.
Alternately GitHub as an open source [https://cli.github.com/|command line client] that has RPM and Deb packages, and a static compiled executable. This is actively maintained.
Creating a branch
So to make a github pull request you already have some code/changes that you have committed locally. Ideally this will be on its own branch, rebased onto the MariaDB server branch where it is intended to merge.
A pull request starts from a public branch. You can either create a pull request from a public fork of the MariaDB Server, or if you have access, a branch on the MariaDB Server. Both will achieve exactly the same outcome.
If you are creating on the MariaDB server, a branch name of the following form is suggested.
- targetbranch-MDEV-num-description-author
Previous documentation suggested a bb-*prefix. This will trigger duplicate runs though Buildbot so your assistance in saving it some work would be appreciated.
This gives other server developers a reasonable visibility of to why the branch is there, a way to check if it can be deleted, and who to ask about in a single branchname.
Creating a Pull Request
If you push with a command line client, the will normally an output from github providing a link to create the pull request. This can be opened in your browser to complete the process.
To use the gh cli, https://cli.github.com/manual/gh_pr_create , use gh pr create
to interactively create it, or use a variety of the command line options to increase the automation.
Common options you may wish to use:
- --base BRANCH - the branch to commit to
- --assignee GITHUB_HANDLE - the primary person you wish to review this
- --review GITHUB_HANDLE - multiple of people you wish to review this
- --fill - to create the PR content base on your commit(s) in your branch
- --draft - if you have a partial concept or unfinished work for a review. This gives a clear indication to not merge as is.
- --label MariaDB\ Corporation - a label to make it easy to distinguish your affiliation to make the MariaDB Foundations job easier to identify external contributions.
Wait for review
While waiting for a review it might be possible that someone introduces changes in the code what conflict with your code. It might also be the case that you have some improvements to make. If this is the case, rebase or adjust your commits locally, and then git push --force to the same branch as before. This will automaticly update the pull request and retrigger buildbot.
Examining buildbot results. From the pull request number created, substitute that into the ID of the URL below will access all the builds based on that PR.
https://buildbot.mariadb.org/#/grid?branch=refs%2Fpull%2FID%2Fmerge
Related articles (when they are written)
- Reviews
- Automerge
- Rebasing your PR on a different branch (quick version - rebase, force push and then edit the title of the PR to the base branch).