Skip to content

Merge request pipelines

Shinya Maeda requested to merge mr-pipelines-2 into master

What does this MR do?

When code in merge requests are updated, a pipeline for a new commit is created. Those pipelines are called "Merge request pipelines". This type of pipeline is specifically meant for testing merge requests, unlike other verbose branch pipelines.

You can start using MR pipelines with the following .gitlab-ci.yml syntax.

job:
  script: echo 'test'
  only:
  - merge_requests

This merge_requests is a new pipeline source. You can control MR pipelines structure by specifying only/except to each job.

TODO

  • Figure out update problem
  • Write Unit tests
  • Write Integration tests
  • Write Feature tests

What are the relevant issue numbers?

Related: https://gitlab.com/gitlab-org/gitlab-ce/issues/15310

Feature flag

This feature can be disabled by disabling the ci_merge_request_pipeline feature flag. It stops MR pipelines being created regardless of that .gitlab-ci.yml has only/except: merge_requests keyword. General pipelines for branches/tags won't be affected by this feature flag.

EE-port

Manual QA template

Case: When a user created a merge request in the parent project

Expectations:

  • User sees both branch pipeline and MR pipeline in MR pipeline tab
  • Pipelines should be sorted by MR pipelines -> branch pipelines
  • Head pipeline should be MR pipeline

Case: When a user updated a merge request in the parent project

Expectations:

  • User sees both branch pipeline and MR pipeline in MR pipeline tab
  • Pipelines should be sorted by MR pipelines -> branch pipelines
  • Head pipeline should be MR pipeline

Case: When a user merges a merge request in the parent project

Expectations:

  • MWPS should respect MR pipeline's result
  • Merge pipeline is created
  • Other MR pipelines should not be newly created

Case: When a user created a merge request from a forked project to the parent project

Expectations:

  • User sees both branch pipeline and MR pipeline in MR pipeline tab
  • Pipelines should be sorted by MR pipelines -> branch pipelines
  • Head pipeline should be MR pipeline
  • MR pipelines should be created in the forked project

Case: When a user updated a merge request from a forked project to the parent project

Expectations:

  • User sees both branch pipeline and MR pipeline in MR pipeline tab
  • Pipelines should be sorted by MR pipelines -> branch pipelines
  • Head pipeline should be MR pipeline
  • MR pipelines should be created in the forked project

Case: When a user merges a merge request from a forked project to the parent project

Expectations:

  • MWPS should respect MR pipeline's result

Case: When a user created a merge request and there are no merge_request keyword in .gitlab-ci.yml

Expectations:

  • User sees only branch pipeline in MR pipeline tab
  • Head pipeline should be branch pipeline

Case: When a user put merge_request keyword in .gitlab-ci.yml in a merge request

Expectations:

  • User sees both branch pipeline and MR pipeline in MR pipeline tab
  • Head pipeline should be MR pipeline

Does this MR meet the acceptance criteria?

Edited by Kamil Trzciński

Merge request reports