-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add git clone with thinpack option to support self hosted azure devops #446
base: main
Are you sure you want to change the base?
Conversation
590d4a7
to
2a22162
Compare
@@ -53,7 +54,7 @@ func CloneRepo(ctx context.Context, logf func(string, ...any), opts CloneRepoOpt | |||
return false, fmt.Errorf("parse url %q: %w", opts.RepoURL, err) | |||
} | |||
logf("Parsed Git URL as %q", parsed.Redacted()) | |||
if parsed.Hostname() == "dev.azure.com" { | |||
if parsed.Hostname() == "dev.azure.com" || opts.ThinPack { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this! Would you mind updating the logf message below? It still states that this is for azure specifically, which could be misleading if ThinPack were set in non Azure environments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the semantics of the option as currently defined are also somewhat misleading. Setting ENVBUILDER_GIT_CLONE_THINPACK=true
will add thinpack to the unsupported capabilities of the Git transport when attempting to clone. Shouldn't it be the other way round?
@@ -53,7 +54,7 @@ func CloneRepo(ctx context.Context, logf func(string, ...any), opts CloneRepoOpt | |||
return false, fmt.Errorf("parse url %q: %w", opts.RepoURL, err) | |||
} | |||
logf("Parsed Git URL as %q", parsed.Redacted()) | |||
if parsed.Hostname() == "dev.azure.com" { | |||
if parsed.Hostname() == "dev.azure.com" || opts.ThinPack { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the semantics of the option as currently defined are also somewhat misleading. Setting ENVBUILDER_GIT_CLONE_THINPACK=true
will add thinpack to the unsupported capabilities of the Git transport when attempting to clone. Shouldn't it be the other way round?
@@ -27,6 +27,7 @@ | |||
| `--git-url` | `ENVBUILDER_GIT_URL` | | The URL of a Git repository containing a Devcontainer or Docker image to clone. This is optional. | | |||
| `--git-clone-depth` | `ENVBUILDER_GIT_CLONE_DEPTH` | | The depth to use when cloning the Git repository. | | |||
| `--git-clone-single-branch` | `ENVBUILDER_GIT_CLONE_SINGLE_BRANCH` | | Clone only a single branch of the Git repository. | | |||
| `--git-clone-thinpack` | `ENVBUILDER_GIT_CLONE_THINPACK` | | Clone with thin pack compabilities. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a note regarding the behaviour of thinpack here for repos hosted on dev.zaure.com
?
The program uses only the hostname to address the issue of requiring thin pack to perform a git clone operation on Azure DevOps, as shown in the code snippet below.
envbuilder/git/git.go
Lines 56 to 78 in d045c1c
However, since Azure DevOps supports self-hosted servers, the hostname may not necessarily be dev.azure.com. Therefore, it is desired to add a command-line option to enable this functionality.