问题描述
在使用GitLab项目时,遇到了一个错误:“ERROR This job is stuck because the project doesn’t have any runners online assigned to it. even though i have added runner and it is alive”。尽管用户已经添加了一个可用的runner,但仍然出现这个错误。
解决方案
请注意以下操作注意版本差异及修改前做好备份。
方案1
这个错误通常是由于未配置runner来运行未标记的作业,或者作业未使用runner的标签引起的。你可以按照以下步骤来解决这个问题:
1. 进入项目的“Settings > CI/CD”页面,展开“Runners”部分。
2. 找到你想要选择未标记作业的runner,并确保它已启用。
3. 点击铅笔按钮进行编辑。
4. 勾选“Run untagged jobs”选项。
5. 点击“Save changes”按钮以使更改生效。
参考链接:https://docs.gitlab.com/13.12/ee/ci/runners/#use-tags-to-limit-the-number-of-jobs-using-the-runner
方案2
另一种解决方法是为作业添加标签。你可以按照以下步骤来添加标签:
在你的作业中添加以下代码:
job:
tags:
- ci
参考链接:https://docs.gitlab.com/ee/ci/yaml/#tags
以上是解决这个错误的两种方法。你可以根据你的具体情况选择其中一种方法来解决问题。
正文完