gitlab - Merge request dropped from merge train with "No stages / jobs for this pipeline."
问题描述
When I click Start merge train on a merge request (MR), GitLab adds the following to the MR's system notes:
@sferencik started a merge train just now
Great. However, seconds later the following is added to the system notes:
@sferencik removed this merge request from the merge train because No stages / jobs for this pipeline. just now
[emphasis mine]
The list of pipelines doesn't have a new entry: the merge train didn't even get as far as starting one.
The GitLab documentation touches on this. This GitLab issue also talks about this, though in a different context.
What am I doing wrong? I have cut down my .gitlab-ci.yml
to the bare minimum, leaving only one stage with one job, which is not conditional. It beats me why GitLab, having performed the speculative merge, should create a pipeline with "no stages / jobs."
This is not a build issue: by the time I click Start merge train, a pipeline has succeeded on my feature branch (the one I want to merge).
Also, if I switch off pipelines for merge results, my MRs have a Merge button instead of Start merge train and it works just fine.
This started happening with our upgrade from GitLab 12.0 to 12.1.
解决方案
OK, so this is due to my error: the "pipelines for merge requests" feature requires that each job is explicitly marked with
only:
- merge_requests
My jobs didn't have this explicit condition. (In fact, as I describe above, I took care to remove all conditions from my jobs.)
Thus, when I hit Start merge train, a new pipeline is (or would be) instantiated with only those jobs that have the above condition. In my case that's no jobs at all, hence the error message: No stages / jobs for this pipeline..
Possible solutions are:
- switch off the pre-merge builds (Settings > General > Merge requests > uncheck Merge pipelines will try to validate the post-merge result prior to merging)
- modify your
.gitlab-ci.yml
, tagging each job with the "only: merge_requests" condition (read here about how to build your condition so your jobs are not limited to merge requests)
推荐阅读
- android - 在设置应用信息中拒绝权限时应用程序崩溃
- angular - 如何使用 youtube-v3-api 知道 youtube 视频是否可用于移动应用程序
- tornado - Tornado 协程逐渐从另一个协程中产生
- php - 动态编辑/添加菜单项 - Wordpress
- php - 为什么 mysql_connect() 返回 NULL?
- javascript - 数组似乎已满,直到我尝试使用它
- postgresql - 在 Docker 容器中运行 Postgis 数据库
- docker - Docker 服务在任务实际启动之前路由网络 - 零停机时间
- java - 从 JAR 存档中获取 RandomAccessFile
- swift - swift - 具有继承的泛型类