[英]Run gitlab pipeline only for commits
Currently gitlab runs a pipeline when creating a merge request + branch with the GUI.目前 gitlab 在使用 GUI 创建合并请求 + 分支时运行管道。
Is it possible to skip this pipeline, since it's only repeats the last pipeline from the default branch?是否可以跳过此管道,因为它仅重复默认分支中的最后一个管道?
We tried with:我们尝试过:
workflow:
rules:
- if: $CI_MERGE_REQUEST_IID
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
This works to skip new branch pipelines, but it doesn't run a pipeline for new commits on branches which have no merge request.这可以跳过新的分支管道,但它不会为没有合并请求的分支上的新提交运行管道。
In order to stop pipeline execution when a new branch is created and in the same time run when a new commit happens on a branch为了在创建新分支时停止管道执行,同时在分支上发生新提交时运行
Try change from:尝试更改:
workflow:
rules:
- if: $CI_MERGE_REQUEST_IID
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
To至
workflow:
rules:
- if: $CI_COMMIT_BEFORE_SHA == "0000000000000000000000000000000000000000"
when: never
- if: $CI_MERGE_REQUEST_IID
- if: $CI_PIPELINE_SOURCE == "push"
The rule规则
- if: $CI_COMMIT_BEFORE_SHA == "0000000000000000000000000000000000000000"
when: never
Will stop the execution of a new pipeline when a new branch is created创建新分支时将停止执行新管道
The rule规则
- if: $CI_PIPELINE_SOURCE == "push"
This is added to allow a new pipeline trigger when a commit happens on branch, because if the event is not a merge request the pipeline won't execute.添加此功能是为了在分支上发生提交时允许新的管道触发,因为如果事件不是合并请求,则管道将不会执行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.