[英]Why docker gitlab/gitlab-runner use "/etc/gitlab-runner" and "/home/gitlab-runner" as VOLUME?
[英]Modify PATH for gitlab-runner
我想在我的 Windows 10 盒子上安裝一個gitlab-runner
(執行shaell
)。 我在 gitlab 服務器上開始工作,它總是以the command "git" cannot be found
的消息結束(大致翻譯成英文)。 事實上git
不是我的路徑的一部分。 如何修改gitlab-runner
啟動的 shell 的PATH
變量?
要在 windows 的命令行上使用 git 我通常使用以下語句設置它: PATH %PATH%C:\Program Files\Git\bin
。
它是否記錄在某處, git
必須可供跑步者使用? 如何查看運行程序調用的命令行(即對 git 的調用)?
出於測試目的,我啟動了gitlab-runner
如: gitlab-runner -l debug --debug run --config config.toml --service gitlab-runner
從gitlab-runner.exe
和config.toml
文件所在的目錄.
我config.toml
下行添加到我的config.toml
文件的runners
部分:
environment = ['PATH=%PATH%;d:/java/bin;C:/Program Files/Git/bin;c:/program files (x86)/apache-ant-1.10.1/bin']
這個GitLab Runner 問題回答了您的問題。
environment
設置不起作用,因為它在設置變量之前被評估,但您可以在運行器配置中使用pre_build_script
來更新路徑。
[[runners]]
name = "My Runner"
url = "https://gitlab.com/"
token = "Abcd1234"
executor = "shell"
pre_build_script = "set Path=%GIT_HOME%\\usr\\bin;%Path%"
在 macOS 上,唯一真正對我有用的是將 PATH 添加到Library/LaunchAgents/gitlab-runner.plist
解決方案:
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
</dict>
然后重新啟動 gitlab-runner 就可以了。
我想這個解決方案也有一個 Windows 等價物。
還可以配置gitlab-runner
用戶的shell
執行器環境編輯$HOME/.profile
(或$HOME.bash_profile
)。
要檢查gitlab-runner
主目錄,請運行$ sudo cat /etc/passwd | grep gitlab-runner | cut -d: -f6
$ sudo cat /etc/passwd | grep gitlab-runner | cut -d: -f6
$ sudo cat /etc/passwd | grep gitlab-runner | cut -d: -f6
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.