RFR: 1069: PR ends up in bad state if interrupted just after push

Erik Joelsson erikj at openjdk.java.net
Mon Jun 7 21:49:51 UTC 2021

On Mon, 7 Jun 2021 21:44:02 GMT, Erik Joelsson <erikj at openjdk.org> wrote:

> This change adds a new transaction step when integrating a PR, to better handle if the bot gets interrupted mid integration. Currently, if the change is pushed and the bot is interrupted before closing, changing labels or adding the final "commit pushed" comment, the PR can end up in a limbo state.
> The new step is another comment "Going to push commit as ..." which gets added right before the git push command is run. Using this comment, it's now possible to automatically recover if the bot gets interrupted. The integration command checks for any such comments and if found, checks if the commit hash is present in the target. If it is, the PR was already pushed, and the command will just close it out as normal.
> I also decided to move the output of any rebase command to this prepush comment, so we don't risk losing it.

bots/pr/src/main/java/org/openjdk/skara/bots/pr/IntegrateCommand.java line 127:

> 125: 
> 126:         // Run a final jcheck to ensure the change has been properly reviewed
> 127:         var success = false;

This variable was dead.

bots/pr/src/main/java/org/openjdk/skara/bots/pr/IntegrateCommand.java line 196:

> 194:             }
> 195: 
> 196:             var backportLines = allComments

This is a slight optimization. We already have a list of all comments, so no need to reach out to github to fetch them again. I can't see any need in this situation to refresh either.

forge/src/main/java/org/openjdk/skara/forge/PullRequestUtils.java line 166:

> 164:     }
> 165: 
> 166:     public static boolean isAncestorOfTarget(Repository localRepo, Hash hash) throws IOException {

I put this in the utils class because it needs the "prutils_tagetref" reference, which is currently only used in this class.


PR: https://git.openjdk.java.net/skara/pull/1183

More information about the skara-dev mailing list