Install GitLab Runner on Windows

來源: https://docs.gitlab.com/runner/install/windows.html

Windows

  1. 建立 Runner 的 folder , ex.: C:\GitLab-Runner
  2. 下載執行檔 64-bit or 32-bit . You can download a binary for every available version as described in Bleeding Edge - download any other tagged release.
  3. 可以將下載的檔案改名成 gitlab-runner-windows-amd64.exe --> gitlab-runner.exe
  4. 安裝GitLab Runner

Install GitLab Runner as a service and start it. You can either run the service using the Built-in System Account (recommended) or using a user account.

  • Run service using Built-in System Account (under directory created in step 1. from above, ex.: C:\GitLab-Runner)
    cd C:\GitLab-Runner
    .\gitlab-runner.exe install
    .\gitlab-runner.exe start
    
  • Run service using user account (under directory created in step 1. from above, ex.: C:\GitLab-Runner) You have to enter a valid password for the current user account, because it’s required to start the service by Windows:

    cd C:\GitLab-Runner
    .\gitlab-runner.exe install --user ENTER-YOUR-USERNAME --password ENTER-YOUR-PASSWORD
    .\gitlab-runner.exe start
    
  • Registering runners 在你的 project -> settings -> CI/CD -> Runners 取得 urltoken

  • 打開終端機, 將機器註冊上去

./gitlab-runner.exe register --url http://10.36.22.111:8180/ --registration-token $REGISTRATION_TOKEN

最後push上去就可以看到拉~

Miscellaneous

fix New runner, has not contacted yet

.\gitlab-runner.exe verify

run local yaml

.\gitlab-runner.exe exec shell {{your job}}

This job is stuck because the project doesn't have any runners online assigned to it. Go to project CI settings

是因為 runner 預設 Run untagged jobs 是沒打勾

ERROR: Job failed (system failure): prepare environment: failed to start process: exec: "pwsh": executable file not found in %PATH%. Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information

解決方法是 要將 C:\GitLab-Runnerconfig.tomlshell = "pwsh" 改成 shell = "powwershell"

Reference

© Kimi Tsai all right reserved.            Updated : 2023-07-12 09:04:54

results matching ""

    No results matching ""

    results matching ""

      No results matching ""