我正在尝试在gitlab存储库上建立持续集成。
我添加了以下gitlab-ci.yml
文件:
stages:
- test
test:
image: python:3.7
script:
- python -v
tags:
- python
在gitlab上,在settings-> CI / CD中,我按照'手动设置特定的Runner'中的说明进行操作。在步骤'请输入执行者:',我输入'shell'。
当我尝试提交上面的yml
文件时,运行器开始运行,但它然后给出以下错误消息:
Running with gitlab-runner 11.9.2 (fa86510e)
on wsf-1102 HUx_zvP8
Using Shell executor...
Running on WSF-1102...
DEPRECATION: this GitLab server doesn't support refspecs, gitlab-runner 12.0 will no longer work with this version of GitLab
Fetching changes...
Clean repository
From [my_repo]
e327c9f..2f0e41f [my_branch]-> origin/[my_branch]
Checking out 2f0e41f1 as [my_branch]...
Skipping Git submodules setup
$ python -v
'python' is not recognized as an internal or external command,
operable program or batch file.
ERROR: Job failed: exit status 9009
我应该如何正确编写yml
文件,以便我可以使用python
作为命令以后运行test.py
文件?
问题不在于跑步者在你的码头图片中。在运行器上下文中,您没有安装python来确认第一次测试python已正确安装在终端路径中。然后,在使用和docker镜像之前,先从shell执行器开始调试
尝试运行此命令
gitlab-runner exec shell test
在这个简单的.gitlab-ci.yml上(把文件放在你的git repo文件夹里)
stages:
- test
test:
script:
- python -v
然后尝试使用python图像当你想要使用这个图像时,你需要指定你想要在你的本地机器上测试上述情况后运行docker runner
gitlab-runner exec docker test
如果你仍然没有弄明白,请尝试遵循本指南qazxsw poi