This page outlines the detailed recipe of what to do with a fix.
It mentions jdk11u, but also applies to jdk17u and to certain extend all other updates projects.
Also see The OpenJDK Developers' Guide which covers all aspects of contributing to OpenJDK. Especially it covers Backports and how to Backout a Backport. Also read how to Request push approvals for fixes .
There are two general types of fixes:
- backports: most commonly, a change for OpenJDK 11 updates is a backport of a change that has been made in a higher OpenJDK version. Start the recipe from Step 1.
- new fixes: rarely, there is a need for a net new change for OpenJDK 11 updates, e.g. because a fix would not apply to higher OpenJDK versions that are in maintenance. Start the recipe from Step 3.
Important: The whole process is driven by the backport requester/contributor. Nothing here assumes that somebody else would do the work. If you are not an OpenJDK Author, that is, you don't have a JBS user account, you'll have to ask for help for steps 5 and 6 (working with JBS to put appropriate metadata). The regular place to ask for help is the JDK Updates mailing list. Regular contributors would eventually gain the necessary privileges to avoid this overhead.
OpenJDK 11u uses SKARA (Git) for backporting fixes from later JDK releases since June 2021. The old Mercurial-based workflow is no longer described. Please reach out to the JDK Updates mailing list in case you need help with that.
Contribution recipe:
- Check the original JBS issue on https://bugs.openjdk.java.net/
- Carefully check linked issues whether there are follow-up fixes that need to be brought with the backport. See below how to handle fixes depending on each other.
- If there are relevant issues that prevent a clean backport, consider backporting those first (within reason).
- Create the backport commit
- Option 1 - Use the /backport comment command on GitHub:
- Make sure GitHub Actions is enabled for you on the OpenJDK Bots jdk11u-dev repository.
- Open the link of the original commit in GitHub and issue the /backport command by adding the comment: "
/backport jdk11u-dev"
- For a clean backport the bot will provide you with a branch in his own repository and a link to create a pull request. If the backport needs manual resolving, it will provide you with instructions, similar to option 3.
- Option 2 - Use SKARA CLI tooling:
- Create a branch for your backport, e.g. "
git checkout -b my-backport-branch master
" "git backport --from https://github.com/openjdk/jdk <commit-sha>"
. See the SKARA Wiki for more info.
- If necessary, resolve changes and follow the instructions.
- Create a branch for your backport, e.g. "
- Option 3 - Use plain Git to create the change:
- Create a branch for your backport, e.g. "
git checkout -b my-backport-branch master
" "git fetch --no-tags https://github.com/openjdk/jdk <commit-sha>"
- "
git cherry-pick --no-commit
<commit-sha
>" - If necessary, resolve changes.
- "
git commit -a -m "Backport <commit sha>
"
- Create a branch for your backport, e.g. "
- Option 1 - Use the /backport comment command on GitHub:
- Test the patch
- "tier1" tests should be passing at all times, use
"make run-test TEST=tier1"
to run - "tier2" provides a larger coverage, if you have resources to run it. Use
"make run-test TEST=tier2"
to run - Run tests from the area that the patch affects, use
"make run-test TEST=<path-to-tests>"
to run specific tests - New regression tests that come with the patch should pass
- Enabling GitHub Actions for your personal fork of the jdk11u-dev repository before publishing your branch will provide you with a tier1 test run via GitHub Actions
- "tier1" tests should be passing at all times, use
- Create a pull request at https://github.com/openjdk/jdk11u-dev
- If you have created a backport via Option1, the /backport command, and the backport was clean, you can use the provided link to create a PR
- In all other cases, push the new branch to your fork of https://github.com/openjdk/jdk11u-dev and open a PR. You can do this in one step via the SKARA command "
git pr create --publish
". If it is a backport, make sure the title of the PR is "Backport <SHA hash of original commit>
" to have the bots correctly recognize your change as a backport.
- If your patch is not a clean backport (labeled as
clean
by the bots), get the change reviewed by some jdk-updates reviewer- Note: the change review is not the approval, which you would get at the next step
- The PR message is automatically posted at the jdk-updates-dev mailing list. You might optionally cc the original mailing list or other OpenJDK mailing lists to get some more attention to your PR by using the
/label
command. It is helpful to state in the PR description what changes were needed and why: the difference against original patch, motivations for doing things differently, etc.. The description is addressed to the reviewers of the change who assess whether the change is correct for the update release.
- Request and await approval for the fix (if the issue is not public, go to step 8 first)
- Add a "Fix Request <java version>" comment to the JBS issue that explains why the fix should be backported, gives a risk estimate, explains the dependencies on other backports (if any), shows what testing was done to verify the backport etc. The goal for the "Fix Request" comment is to give maintainers all the information about the change to make an informed decision for inclusion into the update release. Then put the
jdk11u-fix-request
label on the JBS issue. Now the JBS issue will appear in the filters used by the maintainers. The maintainers might remove the label if the issue is not ready to be decided upon. Add the label again if all preconditions are fulfilled. Wait for maintainer approval, which would manifest as
jdk11u-fix-yes
label on the issue. If the maintainers think the change is not good for an update they will add a jdk11u-fix-no label.
- Add a "Fix Request <java version>" comment to the JBS issue that explains why the fix should be backported, gives a risk estimate, explains the dependencies on other backports (if any), shows what testing was done to verify the backport etc. The goal for the "Fix Request" comment is to give maintainers all the information about the change to make an informed decision for inclusion into the update release. Then put the
In case of a larger change or backport, you might not want to invest the work for steps 1-5. and only then find out that the change is not accepted. In this case you can add the "Fix Request" comment and label in advance or address the maintainers for advice in some other ways.
What to do with changes depending on each other?
- Make a backport of the first change. The pull request gets numbered <ID>, and a branch pr/<ID> is created.
- Backport the second change on top of branch pr/<ID>. In the second pull request, compare against this branch.
After pushing the first pull request, the second will be retargeted to master. See also the description in this Mail.
What if the change needs a CSR?
- From the original JBS issue, create a backport JBS issue ("More"→"Create Backport"). Target the backport issue to
11-pool
. This issue will be resolved when the change is pushed. - From that 11-pool JBS issue, create a new CSR and copy/paste the contents from the original CSR. If the CSR is a straight copy of the original CSR, say so clearly in the issue text, otherwise point out differences. The new CSR should also have version 11-pool.
- Run the CSR through its process to get it approved.
- What if the change you want to downport is not public?
- Sometimes a change you want to downport is not public in JBS. This means you can see the change and its JBS ID in the Git repository, but you will not find the corresponding issue in JBS.
- In such a case, you have to create the corresponding backport issue manually, according to the following recipe:
- Create a new issue in JBS with type "Bug" (you can't directly create an issue of type "Backport")
- The new issue should have exactly the same summary like the original change. You can take this from the Git "summary" line by stripping the prefixed Bug ID.
- It's helpful if the bug description contains a link to the original commit.
- Affected version should be one of "8", "11", ...
- Under "Linked issues" choose "backport of" and enter the bug id of the change you want to downport into the "Issue" filed (in the format "JDK-XXXXXXX"). After adding this link, it will be not visible. You can only verify that you added it by looking at the histrory.
- Once you've filled out all the other fields, press "Create" and once the issue has been created, edit the issue "Type" and change it from "Bug" to "Backport".
- Continue as usual at step 2.
- If and only if everything is approved, push the change. This is done using the /integrate command of SKARA on the backport pull request. If you are not an jdk-updates project committer you'll need a committer to sponsor the PR for you.