Skip to content

Commit

Permalink
worker: parse ostree proxy early
Browse files Browse the repository at this point in the history
  • Loading branch information
lzap authored and ezr-ondrej committed Nov 15, 2024
1 parent 306309e commit 0584c20
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions pkg/ostree/ostree.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,6 @@ func resolveRef(ss SourceSpec) (string, error) {
u.Path = path.Join(u.Path, "refs/heads/", ss.Ref)

transport := http.DefaultTransport.(*http.Transport).Clone()
client := &http.Client{
Transport: transport,
Timeout: 300 * time.Second,
}
if u.Scheme == "https" {
tlsConf := &tls.Config{
MinVersion: tls.VersionTLS12,
Expand Down Expand Up @@ -194,11 +190,21 @@ func resolveRef(ss SourceSpec) (string, error) {
}

if ss.Proxy != "" {
proxyURL, err := url.Parse(ss.URL)
if err != nil {
return "", NewResolveRefError("error parsing MTLS proxy URL '%s': %v", ss.URL, err)
}

transport.Proxy = func(request *http.Request) (*url.URL, error) {
return url.Parse(ss.Proxy)
return proxyURL, nil
}
}

client := &http.Client{
Transport: transport,
Timeout: 300 * time.Second,
}

req, err := http.NewRequest(http.MethodGet, u.String(), nil)
if err != nil {
return "", NewResolveRefError("error preparing ostree resolve request: %s", err)
Expand Down

0 comments on commit 0584c20

Please sign in to comment.