envbuilder icon indicating copy to clipboard operation
envbuilder copied to clipboard

feat: Add a way to select a specific branch before building the devcontainer

Open ggjulio opened this issue 1 year ago • 3 comments

Description

Improve feature parity with github codespaces.

The goal is to add a new coder_parameter called target branch to workspace templates. It will let the user select a branch from which to build a devcontainer.

Unlike the devcontainer cli, the git clone happen in the enbuilder container. So I think it is the responsibility of envbuilder to checkout to the target branch before building the container.


PS: The workaround in readme.md does not work on all platforms.

ggjulio avatar Jul 08 '24 10:07 ggjulio

This should already be possible. See https://github.com/coder/envbuilder#git-branch-selection You can preformat your repo url to choose a specific branch.

matifali avatar Jul 08 '24 11:07 matifali

I already tried with bitbucket datacenter but not luck. I'm not sure if this workaround can work on bitbucket.

Also it is not user friendly, IMO it should be as easy as github codespaces. image

When using the devcontainer cli instead of enbuilder it is quite simple, just git checkout before invoking the cli.

Also auto completion of branches would be nice but out of the scope of envbuilder.

ggjulio avatar Jul 08 '24 12:07 ggjulio

The following feature:

Choose a branch using ENVBUILDER_GIT_URL with a ref/heads reference. For instance:

ENVBUILDER_GIT_URL=https://github.com/coder/envbuilder-starter-devcontainer/#refs/heads/my-feature-branch

only works for https git urls, not ssh. Having an option to choose a branch, and use git clone -b branch_name git_url would be wonderful. At the moment I can't try solutions to some issues without merging those potential fixes to the main branch, which is not possible for me.

matthieucan avatar Feb 03 '25 17:02 matthieucan