Support subrepos and plugin repos via Git cloning from SSH
Currently, subrepo support seems to rely on downloading HTTP archives from the source control website. It would be great if there was support to clone these repos using your local SSH credentials from a Git server.
Additionally, it would be nice to support this for plugin repos too. Right now a plugin repo hosted as a private GitHub repository would only be accessible using a GitHub Personal Access Token for HTTP access.
I think the way I'd do this would be something like this in please/rules/subrepo_rules.build_defs:
- Add a
new_git_clone(name, url, ...)function that callsgit clone <url>and then returns asubrepo(...) - Add a
ssh=Falseargument togithub_repothat returnsnew_git_clonewhensshis set toTrue - Do the same for
gitlab_repo - Maaaybe extend
plugin_repoto support templating SSH URLs, but that could be a second PR.
Am I on the right track here?
Actually, now that I think about this, this might require adding a new builtin. I'm not sure I know of a way to check the value of a ref against the upstream repo with just builtin please rules. If I had a build_rule that cloned the repo, I'm not sure how I'd trigger it to pull the repo again if the upstream changed.