RFR: 1355: Mirror bot needs branch selection based on patterns
Erik Joelsson
erikj at openjdk.org
Tue Aug 16 18:55:56 UTC 2022
On Tue, 16 Aug 2022 14:13:15 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
>> This patch makes it possible to configure mirrored branches with regex patterns. For what I think is improved readability, I made it possible to supply the patterns as an array of strings, so we can have multiple separate patterns. It's still possible to define "branches" as a comma separated list, for backwards compatibility.
>>
>> When deploying this change, I will need to delete the existing local repos used for mirroring on the bot runner machine, because the method by which repos are cloned is changing (for repos that do not just mirror "everything"). Going forward, I think it's good to always clone all repos the same way, regardless of configuration.
>>
>> There is another behavioral change, where I'm adding `--force` when pushing branches with `includeTags`. It happens a bit too often that a repo maintainer changes tags, which currently causes error for any mirroring job because we aren't force pushing tags. I don't think we ever want to not force update when mirroring repos.
>
> vcs/src/main/java/org/openjdk/skara/vcs/git/GitRepository.java line 598:
>
>> 596: cmd.add("--tags");
>> 597: if (force) {
>> 598: cmd.add("--force");
>
> Is there a reason not to ignore the `force` flag when not pushing tags? It would seem more consistent to always look at the `force` flag and add `--force` is set. That way a repo configured not to push tags would still be able to handle a source branch that was force-pushed.
I was torn about this. I went this way to change as little current behavior as possible, mainly because I don't fully understand the nuances of git behavior here. Note that further down, `force==true` is already handled for branches by prepending `+` to the refs. On the other hand, the current proposal may be inconsistent, which is also bad long term.
Perhaps the best solution would be to get rid of the `+` below and just add `--force` when `force==true`?
-------------
PR: https://git.openjdk.org/skara/pull/1358
More information about the skara-dev
mailing list