RFR: 2226: Make it possible to avoid "forward backports"
Erik Duveblad
ehelin at openjdk.org
Tue Apr 9 21:08:13 UTC 2024
Hi all,
please review this patch that makes it possible to configure the PR bot to avoid creating a "forward backport" when integrating a pull request. A "forward backport" gets created when the issue being fixed a PR has a `fixVersion` that is less than the `fixVersion` for the repository (which is specified by `.jcheck/conf`). This patch detects this scenario and instead sets the `fixVersion` for the issue to the repository's `fixVersion` and creates a backport with the `fixVersion` of the original issue. Avoiding "forward backport"s is configurable and will only be enabled for the [jdk](https://github.com/openjdk/jdk) repository (it would be a bug to have this behaviour for update release repositories).
For the patch itself, there are two larger changes that are almost just moving code: the creation of the new class `OverridingJCheckConfigurationParser` and the addition of `createBackport` to `Backports` (and the removal of `JbsBackports`). `OverridingJCheckConfigurationParser` is useful for parsing a `.jcheck/conf` that can be overridden _without_ a local repository (only with a `HostedRepository`). `Backports.createBackport` is almost a clean refactoring of `JbsBackport` - no functionality has been changed.
There is one detail in the patch that might look weird:
issue.get().setProperty("fixVersions",
JSON.array().add(targetFixVersion.get().raw()));
In `IssueNotifier` the code is setting `fixVersions` to a value of a single JSON string. However, this value gets transformed by `JiraProject.encodeProperty`. The problem with not using an array (which the property value should be) is that tests gets confused (since `TestIssueTrackerIssue.setProperty` is *not* transforming its input). I therefore opted to use an array in the production code to make it easier to test.
I also added a bunch of new unit tests as well as slightly updated the integration tests for backports.
Thanks,
Erik
-------------
Commit messages:
- whitespace
- 2226
Changes: https://git.openjdk.org/skara/pull/1630/files
Webrev: https://webrevs.openjdk.org/?repo=skara&pr=1630&range=00
Issue: https://bugs.openjdk.org/browse/SKARA-2226
Stats: 867 lines in 19 files changed: 679 ins; 161 del; 27 mod
Patch: https://git.openjdk.org/skara/pull/1630.diff
Fetch: git fetch https://git.openjdk.org/skara.git pull/1630/head:pull/1630
PR: https://git.openjdk.org/skara/pull/1630
More information about the skara-dev
mailing list