please icon indicating copy to clipboard operation
please copied to clipboard

Support subrepos and plugin repos via Git cloning from SSH

Open weaversam8 opened this issue 1 month ago • 2 comments

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.

weaversam8 avatar Nov 03 '25 21:11 weaversam8

I think the way I'd do this would be something like this in please/rules/subrepo_rules.build_defs:

  1. Add a new_git_clone(name, url, ...) function that calls git clone <url> and then returns a subrepo(...)
  2. Add a ssh=False argument to github_repo that returns new_git_clone when ssh is set to True
  3. Do the same for gitlab_repo
  4. Maaaybe extend plugin_repo to support templating SSH URLs, but that could be a second PR.

Am I on the right track here?

weaversam8 avatar Nov 03 '25 23:11 weaversam8

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.

weaversam8 avatar Nov 04 '25 18:11 weaversam8