-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
doc: add guide for backporting PRs #11099
Conversation
|
||
Each release line has a staging branch that the releaser will use a scratch pad | ||
while preparing a release. The branch name is formatted as follows: | ||
`vn.x-staging` where `n` is the major release number. |
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.
Just a suggestion but how about a capital N? vN.x-staging
might be a bit clearer.
@gibfahn oh wow, thanks. I totally missed that one |
There's likely value in separating it out |
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.
Great to see this documented so the process can become more regular.
|
||
## Staging branches | ||
|
||
Each release line has a staging branch that the releaser will use a scratch pad |
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.
"as a scratch"
If a cherry-pick does not landing cleanly on the staging branch, the releaser | ||
will mark the pull request with a particular label for that release line, | ||
specifying to our tooling that this pull request should not be included. The | ||
releaser will then add a comment that a backport is needed. |
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.
what is the label? the labelelling has to distinguish things that should be backported (but aren't landing cleanly) from things that should not be backported (clean cherry-pick or not)
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.
Related: nodejs/github-bot#120
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.
Yea I wasn't quite sure how to word it being as the label is different for each release line.
I agree that we should have 1 label for something that doesn't land and another for 1 that shouldn't land. That being said, I think the reasoning for not having them is that we should land everything in master that isn't a breaking change and a breaking change will be marked as semver major.
## What needs to be backported? | ||
|
||
When a release is being prepared, the releaser attempts to cherry-pick a | ||
certain set of commits from the master branch to the release staging branch. |
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.
"certain" is vague, but elaborated on below, maybe state that criteria for consideration depends on the the target version (current or LTS)?
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.
actually, not elaborated on below, I don't think.
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.
Yea, I hear ya. It is a bit difficult to find the middle ground between spilling my guts on cutting releases vs the actual intention of the guide. I'll improve this.
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 think ideally this would link to the part of releases.md which talks about the criteria, not sure if there is currently anything in there to link to though.
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.
There is not anything in the releases.md document regarding this. I'll work on documenting that more specifically as well.
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 don't think that level of information belongs in this doc, if we can actually figure out what "certain" means then it belongs elsewhere anyway.
|
||
## What can be backported? | ||
|
||
The "Current" release line (currently v7.x) is much more lenient in what can |
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.
lenient than what?
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.
shouldn't semver-major be mentioned here somewhere?
|
||
## How to submit a backport pull request? | ||
|
||
For these steps, let's assume that a backport is needed for the v7.x release |
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.
This is unusual, isn't it? that a backport is needed from master to Current? Shouldn't master always pick clean to Current?
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 necessarily. Master takes semver-major changes. I see a lot of conflicts from changes that go in after a major change so they have to be backported quite a bit in that case.
git checkout -b backport-10157 | ||
``` | ||
|
||
*Note: the branch name does not have to have the pull request number in it.* |
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.
Recommending a consistent branch naming is a good thing: backport-<PR#>-to-<target node version>
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 like it. Will update
* After creating the branch, apply the changes to the branch. | ||
* The commit message should be identical to the commit message on the master | ||
branch, unless the commit has to be different due to dependencies that are | ||
not present in the targeted release line. |
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.
what do you mean by "deps not present"? If its a manual backport, the code is changing, sometimes a lot, should the commit message still be exactly the same?
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.
That's a fair point. I guess the answer in that case would be "it depends". I don't think we should have identical commit messages if they are incorrect, but I do think we need a better way to show, hey this is a backport commit (like the v8 backports).
### Helpful Hints | ||
|
||
* Please include the backport target in the pull request title. | ||
* Ex. `process: improve performance of nextTick (v4.x backport)` |
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.
Instead of an example, I suggest we be prescriptive. I've been doing "v4.x backport: proces: improve...", I thought that was requested, but I'm happy to do above instead.
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'd rather we put "v4.x backport" at the beginning; it makes it stand out more.
+1 for specifying exactly.
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.
that works for me. I added this so we could actually come up with a specified way that we request (and can edit to make sure is followed). I would rather we be opinionated on this. It makes looking for backports easier IO
A good example of a commit that has been backported is | ||
https://github.com/nodejs/node/commit/2d23562588eebaf9a2a3d3987fe6e4ef63ab9500. | ||
|
||
* Original Pull Request: https://github.com/nodejs/node/pull/10157 |
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.
neither the commit above, nor the PR it links to, has these two lines in the commit message or PR description, can you point to where they should be? In the commit message when it lands, the backport description?
Maybe our process should add another PR-URL
-like piece of metadata for commits that had to be reworked and PRed as a backport because they didn't land clean? The current metadata seems like a bit of a lie, the reviewers never saw the particular code diff that is landing in the backport.
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 thought that the procedure was to get LGTMs on the backport PR, and include those (not the LGTMs from the original PR) when landing.
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 do think we need to come up with an additional piece of metadata for the original PR-URL. Part of the reason for opening this is so we can get to the point where everyone knows how to handle these, because right now, things are kind of all over the place. +1 for including the reviewers from the backport PR vs the original PR
|
||
When a release is being prepared, the releaser attempts to cherry-pick a | ||
certain set of commits from the master branch to the release staging branch. | ||
If a cherry-pick does not landing cleanly on the staging branch, the releaser |
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.
landing
->land
Also, do we do three-way merging (git am -3
)? If so it might be worth specifying that.
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.
no, we only cherry-pick (or I only cherry-pick). /cc @nodejs/release do any of yall actually fixup conflicts when cherry-picking?
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'm pretty sure I got this (in my ~/.gitconfig
) from @MylesBorins :
pa = "!curl -L $1.patch | git am --whitespace=fix #" # Patch Github PR
pap = "!curl -L $1.patch | git am -3 --whitespace=fix #" # Please patch it
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.
Yes, when landing a commit for pushing to master, we use git am
. For backporting, the goal is to get the commit unmodified, so we use git cherry-pick <sha>
.
If a cherry-pick does not landing cleanly on the staging branch, the releaser | ||
will mark the pull request with a particular label for that release line, | ||
specifying to our tooling that this pull request should not be included. The | ||
releaser will then add a comment that a backport is needed. |
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.
Related: nodejs/github-bot#120
# Assuming your fork of Node.js is checked out in $NODE_DIR, | ||
# the origin remote points to your fork, and the upstream remote points | ||
# to git://github.com/nodejs/node | ||
cd $NODE_DIR |
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.
Might be easier to just say something like:
git clone -o upstream https://github.com/nodejs/node.git && cd node
git remote add fork [email protected]:$USER/node.git
git fetch --all
I'd find it easier to understand, and it doubles as a guide for someone not sure about setting up multiple remotes.
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.
sure, although I would think that origin
is more common than fork
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 like to be specific in instructions, origin can end up being upstream
or fork
.
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 guess I'm a lot more used to https://github.com/nodejs/node/blob/master/CONTRIBUTING.md#step-1-fork
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.
Okay fair enough, makes sense to keep it consistent then.
|
||
*Note: the branch name does not have to have the pull request number in it.* | ||
|
||
* After creating the branch, apply the changes to the branch. |
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.
Maybe specify cherry-picking the commit across?
git cherry-pick $SHA # Use your commit hash
cherry-picked cleanly from master, then nothing needs to be done. If not, a | ||
backport pull request will need to be submitted. | ||
|
||
## How to submit a backport pull request? |
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.
Don't need the ?
We should definitely link to this from the COLLABORATOR_GUIDE. |
This guide should help answer questions for contributors that are not familiar with the backport process.
9425052
to
f153855
Compare
Ok, updated. PTAL. I went ahead and added to the COLLABORATOR_GUIDE as well. I removed an example commit since I (unfortunately) couldn't find one that actually used the backport PR-URL instead of the original. Thanks! |
```shell | ||
git cherry-pick $SHA # Use your commit hash | ||
``` | ||
|
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.
At this point do we need to say what you should expect to see and how to fix it up? I assume that following this guide is only needed if the cherry-pick is going to fail (I'm also assuming that $SHA is for the original commit that went into master)
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'll clarify. Yes, this guide is for when the releaser cannot cleanly cherry-pick the commit and requests a backport.
``` | ||
|
||
* The commit message should be as close as possible to the commit message on the | ||
master branch, unless the commit has to be different due to dependencies that |
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.
If I understand correctly, this means the metadata(PR urls, reviewers, etc) should remain the same as the original commit?
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 the case of a backport, I don't think it should. I'll clarify that.
Maybe we should have explicit meta-data on backport commits, like |
Having another line seems like a good idea, so @sam-github are you suggesting that if we have:
then |
@sam-github @gibfahn I agree. I went ahead and added it in. PTAL. Thanks! |
In the metadata of the backport commit, who should be displayed as
|
@targos good point. IMO, if a backport PR is necessary, it should go through the standard process of reviewers. I think the reviewers from the backport PR should be listed, not the reviewers from the original PR. |
@gibfahn I think PR-URL should point to the PR where this specific commit was reviewed, and the meta-data should refer to the specific (backport) PR. So, something like this: The original PR would be:
then it gets backported and PRed, a new PR (obviously):
I changed If its way too much work, maybe it can't happen, but landing backports, which are rewritten PRs, with metadata claiming they have been reviewed by people who may not in fact have reviewed the rewrite seems misleading. |
We have so far been using the original PR for the PR-URL and including the backport PR as a This has not been consistent though. I'm up for whatever re: labelling as long as it is consistent and documented |
@sam-github yeah, that was my issue. I'm fine with using The |
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 think we should clarify what the 2 week rule applies to.
is reviewed. When each commit is landed, the new reviewers and the new PR-URL | ||
should be used. | ||
|
||
[`LTS Plan`]: https://github.com/nodejs/LTS#lts-plan |
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 a reason you used [`LTS Plan`]
rather than: [LTS Plan]
? It looks a bit odd to me.
The "Current" release line (currently v7.x) is much more lenient than the LTS | ||
release lines in what can be landed. Our LTS release lines | ||
(currently v4.x and v6.x) require that commits live in a Current release for at | ||
least 2 weeks before backporting. Please see the [`LTS Plan`][] for more |
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.
As I understand it, the two week rule doesn't apply to doc fixes and infrastructure changes (things that don't change what we ship). This is probably a question for @nodejs/lts, but either way we should probably be explicit here.
Refs: #11351 (comment) and nodejs/build#613 (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.
The length of time is not set in stone as is based on the potential impact. A doc change has no impact on runtime stability so those, as long as they are relevant to the version, can pretty much land any time. A code change, however, should go through at least one current
release cycle to ensure that there are no regressions reported. For changes to more sensitive parts of the code, the length of time may be longer. Anything that is semver-minor will typically be batched up and held much longer than semver-patch so that we have less frequency between LTS minors.
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.
Based on what James said, I think we should remove this part. How does one know what sensitive parts of the codebase are when submitting a backport PR? It's hard to document something that isn't concrete imo.
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.
It's definitely a grey area, but people do talk about the two week rule, so I think we should try and document it somehow, even if we have to say that it's quite subjective.
I also had another question, if @nodejs/lts decides what gets backported to |
Essentially anything sitting in master that is not semver-major or explicitly marked dont-land for the |
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.
Comment inline about one inaccuracy with current process
|
||
Switch to using String#repeat to improve performance. | ||
|
||
PR-URL: https://github.com/nodejs/node/pull/5678 |
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.
This is not accurate. we maintain the original PR-URL
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
@rvagg mind taking a quick look? Thanks! |
|
||
Switch to using String#repeat to improve performance. | ||
|
||
PR-URL: https://github.com/nodejs/node/pull/1234 |
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.
5678
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.
FWIW looking at backport PRs they seem to vary.
ping @rvagg |
Following on from discussion in: nodejs/Release#191 the backport PR should start with the same commit message. Any additions can be made by whoever lands the PR.
In the backporting meeting we decided that it would be easiest (at least for now) if people raising Backport PRs didn't have to modify the commit message, so I've added a commit to remove that info. |
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.
Still LGTM from me.
Does anyone have any objection to this landing? Any further issues can be looked at later, and it would be really good to have something to refer people to. |
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.
tiny nit: LGTM
## What needs to be backported? | ||
|
||
If a cherry-pick from master does not land cleanly on a staging branch, the | ||
releaser will mark the pull request with a particular label for that release |
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.
@gibfahn should we specify the label?
LGTM, still. Get it in, iterate on it as we go. |
Landed in ece9ab5 |
This guide should help answer questions for contributors that are not familiar with the backport process. PR-URL: #11099 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Myles Borins <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
This guide should help answer questions for contributors that are not familiar with the backport process. PR-URL: #11099 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Myles Borins <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
This guide should help answer questions for contributors that are not familiar with the backport process. PR-URL: #11099 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Myles Borins <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
This guide should help answer questions for contributors that are not familiar with the backport process. PR-URL: #11099 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Myles Borins <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
This guide should help answer questions for contributors that are not familiar with the backport process. PR-URL: #11099 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Myles Borins <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
This guide should help answer questions for contributors that are not familiar with the backport process. PR-URL: #11099 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Myles Borins <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
This guide should help answer questions for contributors that are not familiar with the backport process. PR-URL: nodejs/node#11099 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Myles Borins <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
This guide should help answer questions for contributors
that are not familiar with the backport process.
Checklist
Affected core subsystem(s)
doc