2017-01-26 78 views
2

我正在嘗試設置一個docker runner併成功註冊了與gitlab-ce的runner。然而,當作業運行它總是失敗,出現如下:Gitlab-ci-token用戶無法克隆版本庫

Running with gitlab-ci-multi-runner 1.10.2 (d171b73) 
Using Docker executor with image python:3.4 ... 
Starting service postgres:latest ... 
Pulling docker image postgres:latest ... 
Waiting for services to be up and running... 
Pulling docker image python:3.4 ... 
Running on runner-b35ff618-project-96-concurrent-0 via toucan... 
Cloning repository... 
Cloning into '/builds/amrstratus/webportal'... 
fatal: unable to access 'https://gitlab-ci-token:[email protected]/amrstratus/webportal.git/': Failed to connect to gitlab.xxxxxx port 443: Connection refused 
ERROR: Build failed: exit code 1 

我想簡單地克隆庫,並得到了類似的錯誤:

[email protected]:/tmp# git clone https://gitlab-ci-token:[email protected]/amrstratus/webportal.git/ 
Cloning into 'webportal'... 
remote: HTTP Basic: Access denied 
fatal: Authentication failed for 'https://gitlab-ci-token:[email protected]/amrstratus/webportal.git/' 

通過HTTPS訪問似乎好工作和其他一切似乎工作。

任何想法?我完全卡住了。

系統細節:

Debian 8 (Jessie) 
GitLab 8.16.2 
GitLab Shell 4.1.1 
GitLab Workhorse v1.3.0 
GitLab API v3 
Git 2.10.2 
Ruby 2.3.3p222 
Rails 4.2.7.1 
PostgreSQL 9.6.1 

回答

1

注意,可能有兩個問題。

關於令牌本身(fatal: Authentication failed),見this thread

The CI token is now securely generated for each build. It's available in $CI_BUILD_TOKEN .
If you're cloning a different repository from .gitlab-ci.yml (like we were) your best bet is to use SSH.

Another solution is to use your personal private token:

git clone https://<username>:<private-token>@gitlab.anydomainhere.com/developers/<projectname>.git 

(please realize this token gives access to all your projects)

的另一個問題是關係到碼頭工人:fatal: unable to access

你需要確保你能夠溝通您的Gitlab實例(as in hereissue 305)。
check the ownership as in this thread

+0

謝謝,你的文章幫我弄清楚了這個問題。這不是一個身份驗證問題,而是一個與我的防火牆阻止請求相關的問題。使用 碼頭運行python:3.4/usr/bin/curl https://gitlab.xxxx 幫我解決了它。 –

0

我知道這是舊的,但是,解決這個問題對我來說是根據this comment調整主力。

改性/etc/gitlab/gitlab.rb如下:

取消註釋該行

gitlab_workhorse['enable'] = true 

添加這些2行

gitlab_workhorse['listen_network'] = "tcp" 
gitlab_workhorse['listen_addr'] = "127.0.0.1:8181" 

然後修改的web服務器配置爲指向反向代理向此代替麒麟。