当尝试配置我的gitlab CI时,我得到以下错误,git安装在我的系统中,我可以从cmd运行git。这个设置是为了在我的本地机器上运行gitlab runner。这是我的gitlab-ci.yml
stages:
- build
- test
before_script:
- echo "before_script"
- export PATH=$PATH:C:UserssomethingAppDataLocalAtlassianSourceTreegit_localbin
build-job:
tags:
- ci
stage: build
script:
- echo "Hello, $GITLAB_USER_LOGIN!"
test-job2:
tags:
- ci
stage: test
script:
- echo "This job tests something, but takes more time than test-job1."
- echo "which simulates a test that runs 20 seconds longer than test-job1"
- start matlab -nosplash -nodesktop -minimize -r "run('C:reposci-sandboxunitTestrightTriTestRunner.m');quit" -logfile C:reposci-sandboxunitTestoutput.log
这是我在我的管道中得到的错误。
Running with gitlab-runner 14.4.0 (-)
on runner1 ------
Resolving secrets
00:00
Preparing the "shell" executor
00:00
Using Shell executor...
Preparing environment
00:01
Running on ---...
DEPRECATION: CMD shell is deprecated and will no longer be supported
Getting source from Git repository
Fetching changes with git depth set to 50...
'"git"' is not recognized as an internal or external command,
operable program or batch file.
Cleaning up project directory and file based variables
ERROR: Job failed: exit status 9009
这与第2743号问题类似:
我最近在新的Windows Server 2016 Core安装上遇到了类似的问题。在我的例子中,我只需要确保我将git和git home定义为全局变量。
PS C:UsersAdministratorDocuments> Get-ChildItem Env:
Name Value
---- -----
...
GIT C:UsersAdministratorscoopappsgitcurrentcmdgit.exe
GIT_INSTALL_ROOT C:ProgramDatascoopappsgitcurrent
我发现了问题:我的
.gitlab-ci.yml
脚本重新定义了PATH
环境变量,因此它覆盖了系统中的环境变量。
在你的情况下,尝试做而不是重新定义PATH
,看看它是否工作得更好。
我也有类似的问题,并尝试了问题中的建议,但没有任何效果。
在更新路径变量后停止并启动gitlab-runner服务