Skip to content

Commit

Permalink
Pass token and username only if set
Browse files Browse the repository at this point in the history
  • Loading branch information
janekbaraniewski committed Oct 8, 2024
1 parent de72040 commit 942663a
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions pkg/devcontainer/crane/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,15 @@ func PullConfigFromSource(workspaceInfo *provider2.AgentWorkspaceInfo, options *

switch {
case options.EnvironmentTemplate != "":
data, err = New(PullCommand).
command := New(PullCommand).
WithArg(EnvironmentCrane).
WithArg(options.EnvironmentTemplate).
WithFlag("--git-username", options.GitOverrideUsername).
WithFlag("--git-token", options.GitOverrideToken).
Run()
WithArg(options.EnvironmentTemplate)

if options.GitOverrideUsername != "" && options.GitOverrideToken != "" {
command = command.WithFlag("--git-username", options.GitOverrideUsername).
WithFlag("--git-token", options.GitOverrideToken)
}
data, err = command.Run()
case options.DevContainerSource != "":
data, err = New(PullCommand).WithArg(GitCrane).WithArg(options.DevContainerSource).Run()
default:
Expand Down

0 comments on commit 942663a

Please sign in to comment.