1. 程式人生 > 其它 >gitlab-runner 註冊問題 x509 certificate signed by unknown authority

gitlab-runner 註冊問題 x509 certificate signed by unknown authority

技術標籤:gitlabgitlab-runner

系統:Ubuntu 18.04.1 LTS

gitlab版本:11.9

使用gitlab伺服器域名:https://gitlab.example.com

需要使用到urltoken:gitlab伺服器地址+/admin/runners

https://img.796t.com/res/2021/01-29/17/dde649e6a6e87d475d327478f7c9912e.png

要在GNU / Linux下注冊Runner

執行以下命令:

gitlab-runner register

輸入您的GitLab例項URL:

Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com )

https://gitlab.com

輸入您獲得的令牌以註冊Runner

Please enter the gitlab-ci token for this runner

XXX

輸入Runner的描述,您可以稍後在GitLabUI中更改:

<pre class="has" style="margin-left:0px;" name="code"><code class="language-highlight">Please enter the gitlab-ci description for this runner

[hostame] my-runner

輸入Runner關聯標籤,您可以稍後在GitLabUI中更改:
·

<pre class="has" style="margin-left:0px;" name="code"><code class="language-highlight">Please enter the gitlab-ci tags for this runner (comma separated):

my-tag,another-tag

輸入Runner執行程式

<pre class="has" style="margin-left:0px;" name="code"><code class="language-highlight">Please enter the executor: ssh, docker+machine, docker-ssh+machine, kubernetes, docker, parallels, virtualbox, docker-ssh, shell:

docker


如果您選擇Docker作為執行程式,則會要求您將預設影象用於未在其中定義的專案.gitlab-ci.yml

<pre class="has" style="margin-left:0px;" name="code"><code class="language-highlight">Please enter the Docker image (eg. ruby:2.1):

alpine:latest

第五步報錯,報錯資訊如下:

ERROR: Registering runner... failed         runner=6HkNBVen status=couldn't execute POST against https://gitlab.example.com/api/v4/runners: Post https://gitlab.example.com/api/v4/runners: x509: certificate signed by unknown authority
PANIC: Failed to register this runner. Perhaps you are having network problems

證書籤名錯誤,在網上找了許多辦法還是不行,解決辦法:

gitlab-runner register \
--non-interactive \
--tls-ca-file=/etc/gitlab/ssl/gitlab.example.com.crt \
--url "https://gitlab.example.com/" \
--registration-token "6HkNBVenPd9sMyd2HzhK" \
--executor "docker" \
--docker-image maven:latest \
--description "runner " \
--tag-list "run" \
--run-untagged \
--locked="false"

找到gitlab資料夾下,就看到了,把證書檔案帶上

https://img.796t.com/res/2021/01-29/17/0a39c19b3abc7c3c5533b8b56a645766.png

其他版本註冊方式:

https://docs.gitlab.com/11.9/runner/register/index.html