我目前正在與 GitLab runners 一起玩,以更好地了解他們如何在 CI/CD 管道的背景關系中作業。我按照 GitLab 檔案中的說明創建了一個自我管理的跑步者(即我的個人 Windows 筆記本電腦):
- 安裝了 GitLab Runner 可執行檔案
- 在 GitLab 注冊我的跑步者
- 為我的玩具專案禁用共享跑步者
- 修改后的
toml檔案powershell用作 shell 執行程式而不是pwsh
完成這些步驟后,我使用 GitLab Web UI 創建了一個 CI/CD 管道。.gitlab-ci.yml生成的默認檔案如下所示:
stages: # List of stages for jobs, and their order of execution
- build
- test
- deploy
build-job: # This job runs in the build stage, which runs first.
stage: build
script:
- echo "Compiling the code..."
- echo "Compile complete."
unit-test-job: # This job runs in the test stage.
stage: test # It only starts when the job in the build stage completes successfully.
script:
- echo "Running unit tests... This will take about 60 seconds."
- sleep 60
- echo "Code coverage is 90%"
lint-test-job: # This job also runs in the test stage.
stage: test # It can run at the same time as unit-test-job (in parallel).
script:
- echo "Linting code... This will take about 10 seconds."
- sleep 10
- echo "No lint issues found."
deploy-job: # This job runs in the deploy stage.
stage: deploy # It only runs when *both* jobs in the test stage complete successfully.
script:
- echo "Deploying application..."
- echo "Application successfully deployed."
基本上只是echo和sleep陳述句。沒有什么是 Powershell 無法處理的。
但是,當我使用 GitLab 的 Web UI 手動觸發管道時,它會滯后build-job如下:

最后,它超時,如下所示:

我的.gitlab-ci.yml檔案中沒有任何內容要求 Runner 從 repo 中克隆任何內容。為什么它總是試圖克隆 repo?為什么卡在這一步?
編輯
使用
這個想法是讓你的命令(任何命令)在你的代碼庫上運行,它首先被克隆。
關于超時和錯誤,請參閱“自簽名證書或自定義證書頒發機構所有層”
對于到 GitLab 服務器的連接:可以按照針對 GitLab 服務器的自簽名證書的支持選項部分中的詳細說明指定證書檔案。
這解決了
x509: certificate signed by unknown authority注冊跑步者時的問題。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/398366.html
