| I got a prototype of this working with CHANGE_FORK as follows:
diff --git a/git-changelist-maven-extension/src/main/java/io/jenkins/tools/incrementals/git_changelist_maven_extension/Main.java b/git-changelist-maven-extension/src/main/java/io/jenkins/tools/incrementals/git_changelist_maven_extension/Main.java
index 9e9220a..bd17830 100644
--- a/git-changelist-maven-extension/src/main/java/io/jenkins/tools/incrementals/git_changelist_maven_extension/Main.java
+++ b/git-changelist-maven-extension/src/main/java/io/jenkins/tools/incrementals/git_changelist_maven_extension/Main.java
@@ -137,6 +137,15 @@ public class Main extends AbstractMavenLifecycleParticipant {
} else {
log.info("Declining to override the `changelist` or `scmTag` properties");
}
+ String changeFork = System.getenv("CHANGE_FORK");
+ if (changeFork != null) {
+ if (!props.containsKey("gitHubOrg")) {
+ log.info("Setting: -DgitHubOrg=" + changeFork);
+ props.setProperty("gitHubOrg", changeFork);
+ } else {
+ log.info("Declining to override the `gitHubOrg` property");
+ }
+ }
} else {
log.debug("Skipping Git version setting unless run with -Dset.changelist");
}
This prototype helped me understand that CHANGE_FORK would work if we used two properties in the POM (say, gitHubOrg and gitHubProject), but it CHANGE_FORK wouldn't work if we used one property in the POM (say, gitHubRepo). That's because we'd need to set that property in git-changelist-maven-extension, and at the time git-changelist-maven-extension is running we only have access to the incomplete information in CHANGE_FORK and not the complete information from the parsed POM. So I think we have a choice: either continue this Knuthian yak shave into implementing a CHANGE_FORK_FULL solution for JENKINS-58450, settle for imperfection with CHANGE_FORK and two POM properties, or give up. If you're willing to review and merge the PRs, I'm down to continue the yak shave. What do you think? |