Gitlab runner service doesn't take proxy settings from config.toml file on Windows

Summary

Hi guys, I have been struggling all day long rying to make my Windows Gitlab runner work from behind a proxy.

The problem I have is that the windows service doesn't seem able to connect and communicate with my Gitlab server.

This is a message I could find in the Windows Application log:

time="2018-07-04T16:45:21+02:00" level=warning msg="Checking for jobs... failed" runner=ab7697e4 status="couldn't execute POST against https://mygitlab.instance.io/api/v4/jobs/request: Post https://mygitlab.instance.io/api/v4/jobs/request: dial tcp 111.222.333.4:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond."

(I have renamed the urls and ips's for privacy reasons)

I had the same message when I called via a elevated cmd prompt.


D:\GitLab\gitlab-runner.exe run --working-directory D:\GitLab --config D:\GitLab\config.toml --service gitlab-runner --syslog

(The code is actually just a copy paste of the GitLab-Runner service start path).

Setting the HTTP_PROXY variables solved the problem in the console prompt as follewd:

SET HTTP_PROXY=http://Address.ofMyProxy.net:8079
SET HTTPS_PROXY=https://Address.ofMyProxy.net:8079

D:\GitLab\gitlab-runner.exe run --working-directory D:\GitLab --config D:\GitLab\config.toml --service gitlab-runner --syslog

I tried to configure the config.toml file with the HTTP_PROXY environment variables (As described in your documentation here).

concurrent = 1
check_interval = 0

[[runners]]
  environment = ["HTTPS_PROXY=https://Address.ofMyProxy.net:8079", "HTTP_PROXY=http://Address.ofMyProxy.net:8079"]
  name = "Windows-Os-Automation"
  url = "https://mygitlab.instance.io"
  token = "aawwee223344556677889900"
  executor = "shell"
  [runners.cache]

Steps to reproduce

Register and Install a gitlab runner on a Windows machine, make sure it is behind a proxy, add a basic gitlab-ci.yml, commit and push the yml file.

Example Project

This is hosted on a local instance.

What is the current bug behavior?

The bug behaviour is that I would expect my runner to be able to communicate with my gitlab instance via the proxy using the HTTP_PROXY environment variables I have defined in the config.toml

The result, is that I see my CI job is 'Pending' and 'waiting to be picked up by a runner'.

What is the expected correct behavior?

The runner should be able to pick the CI job I created, and should not be pending anymore. I should also not have the Warning message in the Windows application log anymore.

Relevant logs and/or screenshots

(Paste any relevant logs - please use code blocks (```) to format console output, logs, and code as it's very hard to read otherwise.)

Output of checks

(If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com)

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:env:info)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

(If you can, link to the line of code that might be responsible for the problem)

Assignee Loading
Time tracking Loading