resolve localhost to ipv6 address ::1 which is not listened
Summary
In .gitlab-ci.yml
, including remote content which is in the self-host GitLab returns 500 error.
Steps to reproduce
(How one can reproduce the issue - this is very important)
- open
CI/CD
->jobs
page - click
CI Lint
; - with content:
include: - remote: 'http://localhost/tools/gitlab-ci-template/raw/master/before-script-rpm-shk.yml' build: script: - echo "Hello"
- click
Validate
What is the current bug behavior?
500 error
What is the expected correct behavior?
Status: syntax is correct
Relevant logs and/or screenshots
(Paste any relevant logs - please use code blocks (```) to format console output, logs, and code as it's tough to read otherwise.)
[root@git.sd ~]# gitlab-ctl tail
...
Started POST "/foo/bar/-/ci/lint" for 192.168.9.17 at 2019-06-26 18:26:57 +0800
Processing by Projects::Ci::LintsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"[FILTERED]", "content"=>"[FILTERED]", "namespace_id"=>"foo", "project_id"=>"bar"}
Completed 500 Internal Server Error in 34ms (ActiveRecord: 3.9ms)
Errno::ECONNREFUSED (Failed to open TCP connection to ::1:80 (Connection refused - connect(2) for "::1" port 80)):
...
It seems that GitLab resolve localhost
to ::1
, which is not listened in my case.
If I replace the localhost
with 127.0.0.1
, it works as expected.
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
)[root@git.sd ~]# gitlab-rake gitlab:env:info System information System: Current User: git Using RVM: no Ruby Version: 2.5.3p105 Gem Version: 2.7.9 Bundler Version:1.17.3 Rake Version: 12.3.2 Redis Version: 3.2.12 Git Version: 2.21.0 Sidekiq Version:5.2.7 Go Version: unknown GitLab information Version: 11.11.3 Revision: e3eeb779d72 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: PostgreSQL DB Version: 9.6.11 URL: http://git.sd.bqvision.com HTTP Clone URL: http://git.sd.bqvision.com/some-group/some-project.git SSH Clone URL: git@git.sd.bqvision.com:some-group/some-project.git Using LDAP: no Using Omniauth: yes Omniauth Providers: GitLab Shell Version: 9.1.0 Repository storage paths: - default: /var/opt/gitlab/git-data/repositories GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell Git: /opt/gitlab/embedded/bin/git
(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
)[root@git.sd ~]# gitlab-rake gitlab:check SANITIZE=true Checking GitLab subtasks ... Checking GitLab Shell ... GitLab Shell: ... GitLab Shell version >= 9.1.0 ? ... OK (9.1.0) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK Access to /var/opt/gitlab/.ssh/authorized_keys: OK gitlab-shell self-check successful Checking GitLab Shell ... Finished Checking Gitaly ... Gitaly: ... default ... OK Checking Gitaly ... Finished Checking Sidekiq ... Sidekiq: ... Running? ... yes Number of Sidekiq processes ... 1 Checking Sidekiq ... Finished Checking Incoming Email ... Incoming Email: ... Reply by email is disabled in config/gitlab.yml Checking Incoming Email ... Finished Checking LDAP ... LDAP: ... LDAP is disabled in config/gitlab.yml Checking LDAP ... Finished Checking GitLab App ... Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 5/1 ... yes 7/7 ... yes 5/8 ... yes 5/9 ... yes 6/10 ... yes 4/11 ... yes 7/12 ... yes 12/14 ... yes 12/15 ... yes 12/16 ... yes 5/17 ... yes 5/18 ... yes 22/20 ... yes 6/21 ... yes 6/22 ... yes 6/23 ... yes 6/24 ... yes 6/25 ... yes 6/26 ... yes 6/27 ... yes 6/28 ... yes 13/32 ... yes 5/33 ... yes 5/34 ... yes 5/35 ... yes 5/36 ... yes 7/37 ... yes 7/38 ... yes 7/39 ... yes 7/40 ... yes 5/41 ... yes 6/45 ... yes 13/46 ... yes 13/47 ... yes 7/48 ... yes 5/49 ... yes 11/50 ... yes 66/52 ... yes 13/53 ... yes 13/54 ... yes 13/55 ... yes 13/57 ... yes 13/58 ... yes 13/59 ... yes 13/60 ... yes 13/61 ... yes 13/62 ... yes 13/63 ... yes 13/64 ... yes 13/65 ... yes 13/66 ... yes 5/67 ... yes 4/68 ... yes 4/69 ... yes 7/70 ... yes 7/71 ... yes 7/72 ... yes 7/73 ... yes 7/74 ... yes 7/75 ... yes 7/76 ... yes 7/77 ... yes 7/78 ... yes 7/79 ... yes 6/80 ... yes 6/81 ... yes 6/82 ... yes 6/83 ... yes 6/84 ... yes 7/85 ... yes 13/86 ... yes 13/87 ... yes 13/88 ... yes 13/89 ... yes 4/90 ... yes 13/91 ... yes 13/93 ... yes 11/94 ... yes 22/95 ... yes 17/96 ... yes 2/98 ... yes 7/99 ... yes 36/100 ... yes 5/101 ... yes 5/102 ... yes 13/103 ... yes 4/104 ... yes 2/105 ... yes 21/107 ... yes 23/109 ... yes 23/111 ... yes 23/112 ... yes 24/113 ... yes 23/114 ... yes 24/115 ... yes 24/116 ... yes 24/117 ... yes 24/118 ... yes 24/119 ... yes 24/120 ... yes 24/121 ... yes 5/123 ... yes 5/124 ... yes 5/125 ... yes 11/126 ... yes 3/127 ... yes 23/128 ... yes 10/129 ... yes 39/130 ... yes 40/131 ... yes 40/132 ... yes 2/133 ... yes 41/134 ... yes 41/135 ... yes 41/136 ... yes 41/137 ... yes 2/138 ... yes 42/140 ... yes 64/141 ... yes 64/142 ... yes 64/143 ... yes 64/144 ... yes 64/145 ... yes 64/146 ... yes 30/147 ... yes 17/148 ... yes 17/149 ... yes 17/150 ... yes 17/151 ... yes 17/152 ... yes 17/153 ... yes 17/154 ... yes 17/155 ... yes 17/159 ... yes 22/160 ... yes 46/161 ... yes 36/162 ... yes 2/163 ... yes 3/164 ... yes 14/170 ... yes 15/172 ... yes 13/173 ... yes 5/174 ... yes 32/175 ... yes 32/176 ... yes 33/177 ... yes 19/178 ... yes 32/179 ... yes 24/180 ... yes 11/181 ... yes 11/182 ... yes 8/184 ... yes 32/185 ... yes 4/186 ... yes 22/187 ... yes 8/188 ... yes 8/189 ... yes 2/190 ... yes 47/191 ... yes 19/192 ... yes 24/193 ... yes 48/194 ... yes 11/195 ... yes 48/196 ... yes 48/197 ... yes 24/198 ... yes 19/199 ... yes 49/201 ... yes 48/202 ... yes 49/203 ... yes 23/204 ... yes 2/205 ... yes 24/207 ... yes 48/209 ... yes 24/210 ... yes 24/211 ... yes 24/212 ... yes 2/213 ... yes 19/215 ... yes 48/216 ... yes 24/217 ... yes 2/218 ... yes 48/219 ... yes 46/220 ... yes 52/221 ... yes 19/222 ... yes 19/224 ... yes 33/225 ... yes 19/226 ... yes 2/227 ... yes 52/229 ... yes 53/230 ... yes 52/231 ... yes 2/232 ... yes 13/233 ... yes 2/234 ... yes 46/235 ... yes 15/236 ... yes 64/238 ... yes 64/239 ... yes 24/241 ... yes 51/242 ... yes 64/243 ... yes 51/244 ... yes 22/245 ... yes 22/246 ... yes 4/247 ... yes 55/248 ... yes 56/249 ... yes 56/250 ... yes 56/251 ... yes 56/252 ... yes 58/253 ... yes 58/254 ... yes 58/255 ... yes 58/256 ... yes 58/258 ... yes 60/259 ... yes 60/260 ... yes 60/261 ... yes 60/262 ... yes 60/263 ... yes 60/264 ... yes 60/265 ... yes 60/266 ... yes 62/267 ... yes 62/268 ... yes 62/269 ... yes 62/270 ... yes 62/271 ... yes 62/272 ... yes 62/273 ... yes 62/274 ... yes 62/275 ... yes 62/276 ... yes 62/277 ... yes 59/278 ... yes 59/279 ... yes 59/280 ... yes 59/281 ... yes 59/282 ... yes 61/283 ... yes 61/284 ... yes 61/285 ... yes 61/286 ... yes 61/287 ... yes 61/288 ... yes 61/289 ... yes 61/290 ... yes 61/291 ... yes 61/292 ... yes 24/293 ... yes 24/294 ... yes 15/295 ... yes 51/296 ... yes 51/297 ... yes 51/298 ... yes 36/299 ... yes 19/300 ... yes 46/301 ... yes 19/302 ... yes 21/303 ... yes 59/304 ... yes 8/305 ... yes 33/306 ... yes 46/307 ... yes 24/308 ... yes 46/309 ... yes 65/310 ... yes 65/311 ... yes 7/312 ... yes 65/313 ... yes 68/314 ... yes 68/315 ... yes 69/316 ... yes 69/317 ... yes 70/318 ... yes 70/320 ... yes 48/321 ... yes 2/322 ... yes 11/323 ... yes 11/324 ... yes 47/325 ... yes 7/326 ... yes 33/327 ... yes 10/328 ... yes 11/329 ... yes 46/330 ... yes 22/331 ... yes 47/332 ... yes 11/333 ... yes 47/334 ... yes 46/335 ... yes 15/337 ... yes 13/338 ... yes 33/339 ... yes 8/340 ... yes 8/341 ... yes 2/342 ... yes 46/343 ... yes 73/344 ... yes 10/345 ... yes 14/347 ... yes 71/348 ... yes 11/349 ... yes 46/350 ... yes 78/351 ... yes 53/352 ... yes 7/353 ... yes 7/354 ... yes 78/355 ... yes 53/356 ... yes 7/358 ... yes 82/359 ... yes 46/360 ... yes 46/361 ... yes 73/362 ... yes 46/363 ... yes 73/365 ... yes 47/366 ... yes 73/367 ... yes 73/368 ... yes 73/369 ... yes 73/370 ... yes 47/371 ... yes 73/372 ... yes 73/373 ... yes 73/377 ... yes 11/378 ... yes 73/379 ... yes 46/381 ... yes 73/382 ... yes 2/383 ... yes 2/384 ... yes 11/385 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.5.3 ? ... yes (2.5.3) Git version >= 2.21.0 ? ... yes (2.21.0) Git user has default SSH configuration? ... yes Active users: ... 19 Checking GitLab App ... Finished Checking GitLab subtasks ... Finished
(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)