echocat / gradle-golang-plugin

Gradle plugin to build, test and do other stuff of Golang projects.
https://github.com/echocat/gradle-golang-plugin
Mozilla Public License 2.0
44 stars 8 forks source link

Ssh protocol for dependencies downloads #25

Open m0j0hn opened 7 years ago

m0j0hn commented 7 years ago

Hi,

Background: Our dependencies live in private repos on Github, and we use Git over ssh to retrieve them, using ssh-agent to proxy the key(s), so users do not need to manually provide keys when running Gradle. Typical manual Git clone command looks like: "git clone ssh://git@github.com:organization/reponame.git"

When I add these dependencies to gradle-golang-plugin dependencies, it seems to always try to use https - is there some way to get gradle-golang-plugin to use SSH ?

(e.g., maybe I could do preliminary work of adding each remote dependency repo using "git remote add reponame ssh://git@github.com:organization/reponame.git" for each remote repo, and then gradle-golang-plugin would simply work? It doesn't seem to work this way currently, but maybe this would be an easy way to enable this)

(Alternatively (and preferred) would be to allow users to specify protocol in the dependencies, e.g., build "ssh://git@github.com:organization/repo")

(Another alternative might be to enhance the vcsRepositoryProvider directive somehow to allow this, maybe add 2 more optional arguments like protocol and user, so syntax might be: vcsRepositoryProvider('', '', '', '', '', '') // Example: // vcsRepositoryProvider('git', 'github.com/', 'GitHub', 'ssh', 'git', '^(?github\.com[/:][A-Za-z0-9.\-]+/[A-Za-z0-9.\-]+)(?/[A-Za-z0-9_.\-]+)*\$') }

Look forward to your response! Thanks! -- m0j0hn