gitlab-ci
stages:
- deploy
deploy:
stage: deploy
script:
- npm install
- npm run build
- cp -R build/* /var/www/html
管道:
Preparing the "docker+machine" executor
00:28
Using Docker executor with image ruby:2.5 ...
为什么选择 docker ruby?为什么不使用 shell 执行器?
我的config.toml
concurrent = 1
check_interval = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "test"
url = "https://gitlab.com/"
token = "123321123"
executor = "shell"
shell = "bash"
最佳答案
您很可能在存储库上启用了共享运行程序,并且恰好在提交作业时,该作业首先选择共享运行程序,而不是您的自定义 shell 运行程序。
因此可用的选项是 disable shared runners对于您的项目:
- 转至项目的设置> CI/CD
- 在共享运行器部分中,禁用为此项目启用共享运行器。
更好的解决方案是启用 tags关于运行者。
何时 registering对于运行者,在第 5 步,您可以提供与运行者关联的标签。如果您在以下方面拥有足够的权限,您还可以更改 GitLab UI 中的标签:
gitlab.com -> group -> settings -> CI/CD -> runner settings
请注意,config.toml
文件中的标签不可更改。
例如,您现在可以使用 shell-internal
来标记
您的运行程序,然后要仅在此运行程序上运行作业,请添加标签: - shell -internal
在您的 gitlab-ci.yml
文件中:
build:
script:
- echo "running on shell-internal"
tags:
- shell-internal
此链接应该解释 GitLab 运行器的工作原理:https://docs.gitlab.com/ee/ci/runners/
关于gitlab - 当我将执行器设置为 shell 时,为什么 gitlab-runner 作为 ruby docker 运行执行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65673483/