coder / modules

A collection of Terraform Modules to work with Coder.
https://registry.coder.com
Apache License 2.0
23 stars 19 forks source link

feat(git-clone): add support for tree git clone url #212

Closed michaelbrewer closed 2 months ago

michaelbrewer commented 3 months ago

In Open in Coder flow, some url target a specific branch, ideally git-clone would support this.

image

Gitlab urls

Example urls to support

# url: https://gitlab.com/mike.brew/repo-tests.log/-/tree/feat/branch
git clone https://gitlab.com/mike.brew/repo-tests.log -b feat/branch repo-tests.log

Github urls

Example urls to support

# url: https://github.com/michaelbrewer/repo-tests.log/tree/feat/branch
git clone https://github.com/michaelbrewer/repo-tests.log -b feat/branch repo-tests.log

Bitbucket urls

Example urls to support

# url: https://bitbucket.org/gyftteam/repo-tests.log/src/dc427712c41a1046c355db8fb9df5da883790627/?at=feat%2Fbranch
git clone https://bitbucket.org/gyftteam/repo-tests.log -b feat/branch repo-tests.log

# url: https://bitbucket.org/gyftteam/repo-tests.log/src/main/
git clone https://bitbucket.org/gyftteam/repo-tests.log -b main repo-tests.log

# url: https://bitbucket.org/gyftteam/repo-tests.log/src/develop/
git clone https://bitbucket.org/gyftteam/repo-tests.log -b develop repo-tests.log

NOTES

It might be useful to add a flag to enable this or to have a way to set the tree reversal path used :

However there is often the case to have a single workspace template for "Open in Code" that supports multiple git projects.

Another way could be to have a list of supported endpoints?

then you can add self-hosted versions


related pull request: https://github.com/coder/modules/pull/210