我有一个本地gitlab- ce服务器和gitlab-ci运行器,都运行在docker容器上。我只是想测试一下gitlab-ci是否可以用。gitlab-ci。yml中的最小代码工作;然而,它的结果是ci根本不运行,git版本也没有发布,并显示错误代码
。Running with gitlab-runner 14.2.0 (58ba2b95)
on GitLab-cicd-practice GPdsWyY7
Preparing the "shell" executor 00:00
Using Shell executor...
Preparing environment 00:00
Running on gitlab...
Getting source from Git repository 00:01
Fetching changes...
bash: line 113: git: command not found
ERROR: Job failed: exit status 1
.gitlab-ci.yml代码
build:
stage: build
before_script:
- git --version
script: echo hello
test:
script: echo
stage: test
needs: [build]
看这里,运行器是使用shell运行的,因此问题是git没有安装在运行gitlab-runner的机器上。
要解决这个问题,只需在机器上安装git,以便gitlab-runner可以使用它。
如果你在linux上,你应该可以用apt或yum安装它
apt install git
或
yum install git