RFR: 243: Merge bot should support merging with certain frequency

Robin Westberg rwestberg at openjdk.java.net
Mon Jan 27 07:31:26 UTC 2020


On Fri, 24 Jan 2020 11:45:46 GMT, Erik Helin <ehelin at openjdk.org> wrote:

> Hi all,
> 
> please review this patch that enables the merge bot to periodically sync
> branches with a certain frequency. This is implemented by extending the
> configuration for a merge specification:
> 
> "merge": {
>     "target": "github:openjdk/panama",
>     "specs": [
>         {
> 	    "from": "github:openjdk/jdk:master",
> 	    "to": "master",
> 	    "frequency": {
> 	        "interval": "weekly",
> 		"weekday": "Friday",
> 		"hour": "11"
> 	    }
> 	}
>     ]
> }
> 
> The above configuration would merge the `master` branch from the
> [jdk](https://github.com/openjdk/jdk) repository to the `master` branch in the
> [panama](https://github.com/openjdk/panama) repository every Friday at 11:00.
> The merge will only be done once, i.e. it won't be retried until the next Friday
> if the merge fails (and result in a merge conflict PR).
> 
> There is one limitation with the patch and that is that the merge bot only
> "remember" previous merges in memory. This is problematic if we redeploy the
> merge bot during 11:00 - 11:59 on a Friday and the merge already has occurred,
> the merge bot will then do a second merge. This is known limitation and one I
> think we can live with, I don't foresee it to become a problem in practice.
> 
> Thanks,
> Erik
> 
> ## Testing
> - [x] Added a bunch of new unit tests

Looks good! I think it could have been possible to use a bit more existing `java.time` functionality, but I also don't think it's worth the effort to rewrite this working code. :)

bots/merge/src/main/java/org/openjdk/skara/bots/merge/MergeBotFactory.java line 82:

> 81:     private static Month toMonth(String s) {
> 82:         switch (s.toLowerCase()) {
> 83:             case "january":

Would perhaps be a little less verbose to use Month.from with an appropriate formatter, but can keep it as-is if you prefer. :)

-------------

Marked as reviewed by rwestberg (Reviewer).

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


More information about the skara-dev mailing list