Feature request: proxy support
Trying to use buildkite behind a (corporate) firewall/proxy is impossible.
In my case the initial attempt by the agent to register itself fails with connection errors.
A specific example of this is:
➔ docker run -e BUILDKITE_AGENT_TOKEN="my_token" buildkite/agent
_ _ _ _ _ _ _ _
| | (_) | | | | (_) | | |
| |__ _ _ _| | __| | | ___| |_ ___ __ _ __ _ ___ _ __ | |_
| '_ \| | | | | |/ _` | |/ / | __/ _ \ / _` |/ _` |/ _ \ '_ \| __|
| |_) | |_| | | | (_| | <| | || __/ | (_| | (_| | __/ | | | |_
|_.__/ \__,_|_|_|\__,_|_|\_\_|\__\___| \__,_|\__, |\___|_| |_|\__|
__/ |
http://buildkite.com/agent |___/
2015-06-24 15:02:57 NOTICE Starting buildkite-agent v1.0-beta.39.724 with PID: 1
2015-06-24 15:02:57 NOTICE The agent source code can be found here: https://github.com/buildkite/agent
2015-06-24 15:02:57 NOTICE For questions and support, email us at: [email protected]
2015-06-24 15:02:57 INFO Registering agent with Buildkite...
2015-06-24 15:03:07 WARN Post https://agent.buildkite.com/v3/register: net/http: request canceled while waiting for connection (Attempt 1/30 Retrying in 1s)
2015-06-24 15:03:17 WARN Post https://agent.buildkite.com/v3/register: dial tcp: lookup agent.buildkite.com on 10.5.13.150:53: read udp 10.5.13.150:53: i/o timeout (Attempt 2/30 Retrying in 1s)
2015-06-24 15:03:28 WARN Post https://agent.buildkite.com/v3/register: net/http: request canceled while waiting for connection (Attempt 3/30 Retrying in 1s)
2015-06-24 15:03:38 WARN Post https://agent.buildkite.com/v3/register: dial tcp: lookup agent.buildkite.com on 10.5.13.150:53: read udp 10.5.13.150:53: i/o timeout (Attempt 4/30 Retrying in 1s)
With other applications I've been able to get round this by using:
# general workaround
export http_proxy=http://w.x.y.z:1234
export https_proxy=http://w.x.y.z:1234
More specifically for docker builds:
# /etc/sysconfig/docker
HTTP_PROXY=http://w.x.y.z:1234
HTTPS_PROXY=http://w.x.y.z:1234
http_proxy="${HTTP_PROXY}"
https_proxy="${HTTPS_PROXY}"
export HTTP_PROXY HTTPS_PROXY http_proxy https_proxy
I'm not sure what changes would be required for the agent to honour these environment variables, but it would be extremely useful to be able to route the agent through a proxy.
Hrm, that's weird. It should work! https://github.com/buildkite/agent/blob/master/agent/api_client.go#L29 and http://golang.org/src/net/http/transport.go?s=4805:4862#L126
Can you confirm that the HTTPS_PROXY ENV variable is getting to the agent? An easy way to do this, is to temporarily allow the agent access to the internet, and inside a build script, run env | HTTP
I just double checked and I was able to use the agent through a proxy. Going to close this for now until I can get some more information. Feel free to re-open @chiselwright if you give it another go and can't get it working!
Just thought id add this here as i ran into the same problem. The issue i have with http_proxy is when its on a systemd enabled system. Systemd service units do not pickup /etc/environment or other such places
So to fix this you need:
mkdir /etc/systemd/system/buildkite-agent.service.d
cat <<EOF > /etc/systemd/system/buildkite-agent.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=http://some-proxy-host:some-proxy-port"
EOF
systemctl daemon-reload
systemctl restart buildkite-agent
@mrproper oh right, that's good to know. Sorry you ran into the same problem!