Gitlab-ci-token用户无法克隆存储库

Jai*_* R. 5 gitlab gitlab-ci-runner

我正在尝试设置一个docker runner并成功注册了gitlab-ce的跑步者.但是,当作业运行时,它始终会失败并显示以下内容:

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:xxxxxxxxxxxxxxxxxxxx@gitlab.xxxxxxxxx/amrstratus/webportal.git/': Failed to connect to gitlab.xxxxxx port 443: Connection refused
ERROR: Build failed: exit code 1
Run Code Online (Sandbox Code Playgroud)

我试图简单地克隆存储库并得到类似的错误:

root@toucan:/tmp# git clone https://gitlab-ci-token:b35ff618453c702944c736668e1c2c@gitlab.xxxxxxxx/amrstratus/webportal.git/
Cloning into 'webportal'...
remote: HTTP Basic: Access denied
fatal: Authentication failed for 'https://gitlab-ci-token:xxxxxxxxxxx@gitlab.xxxxxxxx/amrstratus/webportal.git/'
Run Code Online (Sandbox Code Playgroud)

通过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
Run Code Online (Sandbox Code Playgroud)

Von*_*onC 4

请注意,可能有两个问题。

关于令牌本身(和fatal: Authentication failed),请参阅此线程

现在,每个构建都会安全地生成 CI 令牌。它可以在$CI_BUILD_TOKEN.
如果您要克隆不同的存储库.gitlab-ci.yml(就像我们一样),您最好的选择是使用 SSH。

另一个解决方案是使用您的个人私有令牌:

git clone https://<username>:<private-token>@gitlab.anydomainhere.com/developers/<projectname>.git
Run Code Online (Sandbox Code Playgroud)

(请注意此令牌可以访问您的所有项目)

另一个问题与 Docker 有关:fatal: unable to access

您需要确保可以与您的 Gitlab 实例进行通信(如此处问题 305中所示)。
检查所有权,如本线程所示