Skip to content

Commit 991a731

Browse files
Merge pull request #6274 from userid0x0/cmdAdd_proxyFix
build,add: add support for corporate proxies
2 parents 91e289c + 2df30a8 commit 991a731

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

add.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@ func getURL(src string, chown *idtools.IDPair, mountpoint, renameTarget string,
156156
}
157157
tlsClientConfig.InsecureSkipVerify = insecureSkipTLSVerify == types.OptionalBoolTrue
158158

159-
tr := &http.Transport{TLSClientConfig: tlsClientConfig}
159+
tr := &http.Transport{
160+
TLSClientConfig: tlsClientConfig,
161+
Proxy: http.ProxyFromEnvironment,
162+
}
160163
httpClient := &http.Client{Transport: tr}
161164
response, err := httpClient.Get(src)
162165
if err != nil {

tests/bud.bats

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7481,6 +7481,15 @@ _EOF
74817481
fi
74827482
}
74837483

7484+
@test "build proxy - ADD URL" {
7485+
_prefetch alpine
7486+
target=alpine-image
7487+
http_proxy=http://127.0.0.1:47 HTTPS_PROXY=http://127.0.0.1:47 \
7488+
run_buildah 125 build $WITH_POLICY_JSON -t alpine-image -f $BUDFILES/add-checksum/Containerfile $BUDFILES/add-checksum
7489+
expect_output --substring "127.0.0.1:47" "connection to fake proxy must fail"
7490+
expect_output --substring "connection refused" "connection to fake proxy must fail"
7491+
}
7492+
74847493
@test "bud-with-mount-bind-from-like-buildkit" {
74857494
skip_if_no_runtime
74867495
skip_if_in_container

0 commit comments

Comments
 (0)