Skip to content

Allow building behind a proxy

What does this MR do?

This allows building behind a proxy by giving the docker build the http_proxy if one is provided.

Why was this MR needed?

Currently, if Docker is properly configured to use a proxy with /etc/systemd/system/docker.service.d/ but the --build-arg is not provided, make build_current will fail behind a proxy:

sudo docker build -t gitlab/gitlab-runner-helper:x86_64-57d7c5fc -f dockerfiles/build/Dockerfile.x86_64 dockerfiles/build
Sending build context to Docker daemon  33.93MB
Step 1/8 : FROM alpine:3.10
Get https://registry-1.docker.io/v2/: proxyconnect tcp: dial tcp: lookup wwwproxy on [::1]:53: read udp [::1]:45576->[::1]:53: read: connection refused
Makefile.runner_helper.mk:58: recipe for target 'out/helper-images/prebuilt-x86_64.tar' failed
make: *** [out/helper-images/prebuilt-x86_64.tar] Error 1

This MR resolves the issue.

EDIT: Hmm. Apparently setting HTTP_PROXY to empty (the default) causes apk add to fail when you're not behind a proxy. Not sure why that would be.

Are there points in the code the reviewer needs to double check?

Does this MR meet the acceptance criteria?

  • Documentation created/updated
  • Added tests for this feature/bug
  • In case of conflicts with master - branch was rebased

What are the relevant issue numbers?

Edited by 🤖 GitLab Bot 🤖

Merge request reports