Skip to content

Browser Performance job fails when run behind a proxy

Summary

The performance job in Verify/Browser-Performance.gitlab-ci.yml fails when run behind a proxy. This is caused by the busybox wget version in the docker:git image used for the job. That image gets wget from its alpine base image.
Apparently, the lack of proxy support for HTTPS is considered a "known limitation", see https://gitlab.alpinelinux.org/alpine/aports/-/issues/10446.

Steps to reproduce

The issue is most readily reproduced by starting the Docker container that runs the job with docker run --rm -it docker:git and running a simple proxy in that container. This can be done with:

  1. apk --no-cache add cntlm
  2. cntlm -N gitlab.com -N dl-cdn.alpinelinux.org

The last command tells cntlm to proxy for those two sites itself, rather than pass it on to another proxy.

Next, execute:

  1. export http_proxy=http://localhost:3128 to proxy everything through the running cntlm instance
  2. mkdir gitlab-exporter
  3. wget -O ./gitlab-exporter/index.js https://gitlab.com/gitlab-org/gl-performance/raw/1.1.0/index.js

What is the current bug behavior?

The last command, part of the job, fails with

Connecting to localhost:3128 (127.0.0.1:3128)
cntlm[17]: 127.0.0.1 GET https://gitlab.com/gitlab-org/gl-performance/raw/1.1.0/index.js
wget: error getting response: Address not available

preventing the job from doing its real job 😉, checking the application's performance in a browser.

What is the expected correct behavior?

The wget command should succeed fetching the file at the URL and continue running the browser performance job.

Possible fixes

Installing the wget package in a before_script will fix this as per:

  1. apk --no-cache add wget
  2. wget -O ./gitlab-exporter/index.js https://gitlab.com/gitlab-org/gl-performance/raw/1.1.0/index.js

The last command now succeeds with:

--2020-11-23 07:50:02--  https://gitlab.com/gitlab-org/gl-performance/raw/1.1.0/index.js
Resolving gitlab.com (gitlab.com)... 172.65.251.78, 2606:4700:90:0:f22e:fbec:5bed:a9b9
Connecting to gitlab.com (gitlab.com)|172.65.251.78|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/plain]
Saving to: './gitlab-exporter/index.js'

./gitlab-exporter/i     [ <=>              ]   2.45K  --.-KB/s    in 0s      

2020-11-23 07:50:02 (5.11 MB/s) - './gitlab-exporter/index.js' saved [2513]