天天看點

gitlab-ci之gitlab-runner注冊

      官方文檔:https://docs.gitlab.com/runner/register/index.html

       官方文檔寫的很明白,需要注意的是tags,這個tags必須與yml檔案裡的tags一樣,否則你的gitlab-ci任務無法正常運作,會提示你找不到相關的gitlab-runner.

  1. 運作以下指令:
    <span style="color:#eff1f5"><code><span style="color:#eff1f5">sudo </span>gitlab-runner register
    </code></span>
               
  2. 輸入您的GitLab執行個體URL:
    <span style="color:#eff1f5"><code>Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com )
    https://gitlab.com
    </code></span>
               
  3. 輸入您獲得的令牌以注冊Runner:
    <span style="color:#eff1f5"><code>Please enter the gitlab-ci token for this runner
    xxx
    </code></span>
               
  4. 輸入Runner的描述,您可以稍後在GitLab的UI中進行更改:
    <span style="color:#eff1f5"><code>Please enter the gitlab-ci description for this runner
    [hostame] my-runner
    </code></span>
               
  5. 輸入與Runner關聯的标簽,您可以稍後在GitLab的UI中進行更改:
    <span style="color:#eff1f5"><code>Please enter the gitlab-ci tags for this runner (comma separated):
    my-tag,another-tag
    </code></span>
               
  6. 輸入Runner執行程式:
    <span style="color:#eff1f5"><code>Please enter the executor: ssh, docker+machine, docker-ssh+machine, kubernetes, docker, parallels, virtualbox, docker-ssh, shell:
    docker
    </code></span>
               
  7. 如果您選擇Docker作為執行程式,則會要求您将預設圖像用于未在其中定義的項目

    .gitlab-ci.yml

    <span style="color:#eff1f5"><code>Please enter the Docker image (eg. ruby:2.1):
    alpine:latest</code></span>
               

繼續閱讀