如果在合并之前合并了分支,有没有办法对可能的合并提交进行预 运行 测试?

Is there a way to pre-run tests on the would-be merge commit, if branch were merged, before merge?

我们会自动 运行 对功能分支进行测试。功能完成并测试通过后,将其合并到主分支中。

但现在我们必须等待 运行 在 master 上进行测试,然后再(手动)部署它。

那么,有没有办法自动运行测试功能分支的合并提交, 合并到master之前?

如果可以的话,那么我们就知道master上的测试会在Feature Branch合并后通过。

为此,merged results pipelines 可能对您有用。看看https://docs.gitlab.com/ee/ci/pipelines/merged_results_pipelines.html

引用自文档

A merged results pipeline is a type of merge request pipeline. It is a pipeline that runs against the results of the source and target branches merged together.

因此您可以先发制人地 运行 进行测试并 运行 手动部署

如果您的组织拥有至少处于 PREMIUM 层级的 Gitlab 帐户,则此功能可用。

根据 default 它们是 not enabled,要在项目中启用合并结果管道,您必须至少具有 Maintainer 角色:

  1. 在顶部栏中,select 菜单 > 项目并找到您的项目。
  2. 在左侧边栏中,select 设置 > 常规。
  3. 展开合并请求。
  4. Select 启用合并结果管道。
  5. Select 保存更改。