Skip to content
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 proxy settings to git client #3461

Merged
merged 4 commits into from
Feb 17, 2025
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions internal/controller/git/base_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,20 @@
func (b *baseRepo) buildGitCommand(arg ...string) *exec.Cmd {
cmd := b.buildCommand("git", arg...)
cmd.Env = append(cmd.Env, fmt.Sprintf("GIT_SSH_COMMAND=ssh -F %s/.ssh/config", b.homeDir))

if b.creds != nil && b.creds.Password != "" {
cmd.Env = append(
cmd.Env,
"GIT_ASKPASS=/usr/local/bin/credential-helper",
fmt.Sprintf("GIT_PASSWORD=%s", b.creds.Password),
)
cmd.Env = append(cmd.Env, "GIT_ASKPASS=/usr/local/bin/credential-helper")
cmd.Env = append(cmd.Env, fmt.Sprintf("GIT_PASSWORD=%s", b.creds.Password))
}

if httpProxy := os.Getenv("HTTP_PROXY"); httpProxy != "" {
cmd.Env = append(cmd.Env, fmt.Sprintf("http_proxy=%s", httpProxy))

Check warning on line 242 in internal/controller/git/base_repo.go

View check run for this annotation

Codecov / codecov/patch

internal/controller/git/base_repo.go#L242

Added line #L242 was not covered by tests
}

if httpsProxy := os.Getenv("HTTPS_PROXY"); httpsProxy != "" {
cmd.Env = append(cmd.Env, fmt.Sprintf("https_proxy=%s", httpsProxy))
}

Check warning on line 247 in internal/controller/git/base_repo.go

View check run for this annotation

Codecov / codecov/patch

internal/controller/git/base_repo.go#L246-L247

Added lines #L246 - L247 were not covered by tests

return cmd
}

Expand Down
Loading