這幾天透過線上版 Gitlab 練習 CI/CD
在我的 Ubuntu VM 上面創建並註冊了 Gitlab-runner
結果上面的 runner 是離線狀態

當下第一個判斷是:
為了驗證自己的判斷,我查看了 config.toml 內容:
網路上搜尋相關的技術文章,裡面提到:
驗證 GitLab Runner 的設定檔是否正確,並確保其中的設定與您的 GitLab 實例相符。
設定檔通常位於 /etc/gitlab-runner/config.toml。
於是我透過 systemctl status gitlab-runner指令
看它去哪個路徑下讀取設定檔
確定是 /etc/gitlab-runner/ 沒錯
咦?等等,剛剛檢查 config.toml 設定檔的位置是 /home/patrick/.gitlab-runner/ 耶!
到這邊,問題根源(root cause)已經水落石出了:
將正確設定檔複製過去,最後 Runner 的狀態順利變成「在線」了
sudo cp /home/patrick/.gitlab-runner/config.toml \
/etc/gitlab-runner/config.toml

希望這篇記錄能幫助大家順利解決問題
https://blog.csdn.net/zhezhebie/article/details/136679906