yougov / velociraptor

BSD 3-Clause "New" or "Revised" License
11 stars 1 forks source link

vr.builder doesn't support Mercurial buildpacks #83

Open ghost opened 10 years ago

ghost commented 10 years ago

Originally reported by: Brent Tubbs (Bitbucket: btubbs, GitHub: btubbs)


There's an implicit assumption in vr.builder that buildpacks use Git. To fix that, we'd have to change the build.yaml spec from having a list of buildpack_urls to a 'buildpacks' list that contains objects with both 'url' and 'vcs_type' keys.

This creates a disconnect between the UI, which allows specifying the repo type for a buildpack, and vr.builder, which assumes Git.

There may be a clever way we can encode the repo type in the URL itself. Git is friendly in that way because most urls start with git:// or end with .git. It's the plain http nature of Mercurial URLs that makes it hard to make a good guess as to whether a URL is a Mercurial one or not. Perhaps we just assume a URL is Mercurial if we can't see a git:// or .git in it?


ghost commented 10 years ago

Original comment by Brent Tubbs (Bitbucket: btubbs, GitHub: btubbs):


The relevant code is at https://bitbucket.org/yougov/velociraptor/src/c6af69f87622ae2536df73c83e094055e09ae0c1/common/vr/common/repo.py?at=default#cl-14. It takes a URL and returns either 'git', 'hg', or None. The simplest fix would be making it default to hg if the URL neither begins with 'git://' or ends with '.git'.

For the sake of user interface, I'd like to preserve the ability of someone to just copy/paste the same URL they see in a Kiln/Github/Bitbucket UI, or in a .git/config or .hg/hgrc file. I'm not aware of any of those systems presenting a Git URL that doesn't start or end with 'git', though I haven't looked closely.

ghost commented 10 years ago

Original comment by Jason R. Coombs (Bitbucket: jaraco, GitHub: jaraco):


pip honors 'git+http' and 'hg+http' schemes. Perhaps that would be a suitable convention to support. Then, maybe fall back to git if not specified.