Commit 3e937f55 authored by Igor Drozdov's avatar Igor Drozdov

Allow intra-project MR dependencies

Now a intra-project MR can be specify as
a blocking MR
parent 5e21cc09
---
title: Allow intra-project MR dependencies
merge_request: 16799
author:
type: changed
......@@ -47,7 +47,7 @@ With **[GitLab Enterprise Edition][ee]**, you can also:
- Analyze your dependencies for vulnerabilities with [Dependency Scanning](../../application_security/dependency_scanning/index.md) **(ULTIMATE)**
- Analyze your Docker images for vulnerabilities with [Container Scanning](../../application_security/container_scanning/index.md) **(ULTIMATE)**
- Determine the performance impact of changes with [Browser Performance Testing](#browser-performance-testing-premium) **(PREMIUM)**
- Specify merge order dependencies with [Cross-project Merge Request Dependencies](#cross-project-merge-request-dependencies-premium) **(PREMIUM)**
- Specify merge order dependencies with [Merge Request Dependencies](#merge-request-dependencies-premium) **(PREMIUM)**
## Use cases
......@@ -509,7 +509,7 @@ GitLab runs the [Sitespeed.io container][sitespeed-container] and displays the d
[Read more about Browser Performance Testing.](browser_performance_testing.md)
## Cross-project Merge Request Dependencies **(PREMIUM)**
## Merge Request Dependencies **(PREMIUM)**
> Introduced in [GitLab Premium][products] 12.2.
......@@ -522,7 +522,7 @@ this relationship in place, the merge request cannot be merged until all of its
dependencies have also been merged, helping to maintain the consistency of a
single logical change.
[Read more about cross-project merge request dependencies.](merge_request_dependencies.md)
[Read more about merge request dependencies.](merge_request_dependencies.md)
## Security reports **(ULTIMATE)**
......
......@@ -2,14 +2,13 @@
type: reference, concepts
---
# Cross-project Merge Request dependencies **(PREMIUM)**
# Merge Request dependencies **(PREMIUM)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/9688) in [GitLab Premium](https://about.gitlab.com/pricing/) 12.2.
Cross-project merge request dependencies allows a required order of merging
between merge requests in different projects to be expressed. If a
merge request "depends on" another, then it cannot be merged until its
dependency is itself merged.
Merge request dependencies allows a required order of merging
between merge requests to be expressed. If a merge request "depends on" another,
then it cannot be merged until its dependency is itself merged.
NOTE: **Note:**
Merge requests dependencies are a **PREMIUM** feature, but this restriction is
......@@ -58,20 +57,20 @@ instead.
To continue the above example, you can configure a dependency when creating the
new merge request in `awesome-project` (or by editing it, if it already exists).
The dependency needs to be configured on the **dependent** merge
request. There is a "Cross-project dependencies" section in the form:
request. There is a **Merge request dependencies** section in the form:
![Cross-project dependencies form control](img/cross_project_dependencies_edit_v12_2.png)
![Merge request dependencies form control](img/dependencies_edit_v12_4.png)
Anyone who can edit a merge request can change the list of dependencies.
New dependencies can be added by reference, or by URL. To remove a dependency,
press the **X** by its reference.
As dependencies are specified across projects, it's possible that someone else
As dependencies can be specified across projects, it's possible that someone else
has added a dependency for a merge request in a project you don't have access to.
These are shown as a simple count:
![Cross-project dependencies form control with inaccessible merge requests](img/cross_project_dependencies_edit_inaccessible_v12_2.png)
![Merge request dependencies form control with inaccessible merge requests](img/dependencies_edit_inaccessible_v12_4.png)
If necessary, you can remove all the dependencies like this by pressing the
**X**, just as you would for a single, visible dependency.
......@@ -82,7 +81,7 @@ or **Cancel** to return without making any changes.
The list of configured dependencies, and the status of each one, is shown in the
merge request widget:
![Cross-project dependencies in merge request widget](img/cross_project_dependencies_view_v12_2.png)
![Dependencies in merge request widget](img/dependencies_view_v12_2.png)
Until all dependencies have, themselves, been merged, the **Merge**
button will be disabled for the dependent merge request. In
......
......@@ -104,7 +104,7 @@ export default {
issue-item-class="p-0"
>
<template v-slot:success>
{{ __('All cross-project dependencies have merged') }}
{{ __('All merge request dependencies have been merged') }}
<span class="text-secondary">
{{
sprintf(__('(%{mrCount} merged)'), {
......
......@@ -27,8 +27,5 @@ class MergeRequestBlock < ApplicationRecord
errors.add(:blocked_merge_request, _('cannot block others')) if
blocked_merge_request.blocks_as_blocker.any?
errors.add(:blocked_merge_request, _('cannot be in the same project')) if
blocked_merge_request.target_project_id == blocking_merge_request.target_project_id
end
end
......@@ -8,7 +8,7 @@
- return unless project&.feature_available?(:blocking_merge_requests)
.form-group.row.blocking-merge-requests
= form.label :blocking_merge_request_references, _('Cross-project dependencies'), class: 'col-form-label col-sm-2'
= form.label :blocking_merge_request_references, _('Merge request dependencies'), class: 'col-form-label col-sm-2'
.col-sm-10
= text_field_tag 'blocking_merge_request_refs', nil,
class: 'form-control',
......
......@@ -23,7 +23,7 @@ describe 'User creates a merge request with blocking MRs', :js do
visit(project_new_merge_request_path(project, merge_request: mr_params))
fill_in 'Cross-project dependencies', with: other_mr.to_reference(full: true)
fill_in 'Merge request dependencies', with: other_mr.to_reference(full: true)
click_button('Submit merge request')
expect(page).to have_content('Depends on 1 merge request')
......@@ -38,7 +38,7 @@ describe 'User creates a merge request with blocking MRs', :js do
it 'does not show blocking MRs controls' do
visit(project_new_merge_request_path(project, merge_request: mr_params))
expect(page).not_to have_content('Cross-project dependencies')
expect(page).not_to have_content('Merge request dependencies')
end
end
end
......@@ -28,7 +28,7 @@ describe "User edits merge request with blocking MRs", :js do
it 'can add the other MR' do
visit edit_project_merge_request_path(project, merge_request)
fill_in 'Cross-project dependencies', with: other_mr.to_reference(full: true)
fill_in 'Merge request dependencies', with: other_mr.to_reference(full: true)
click_button 'Save changes'
......@@ -54,7 +54,7 @@ describe "User edits merge request with blocking MRs", :js do
it 'cannot add the other MR' do
visit edit_project_merge_request_path(project, merge_request)
fill_in 'Cross-project dependencies', with: other_mr.to_reference(full: true)
fill_in 'Merge request dependencies', with: other_mr.to_reference(full: true)
click_button 'Save changes'
......
......@@ -42,6 +42,14 @@ describe MergeRequestBlock do
expect(another_block).to be_valid
end
it 'allows blocks to be intra-project' do
project = blocking_mr.target_project
intra_project_mr = create(:merge_request, :rebased, source_project: project, target_project: project)
block.blocked_merge_request = intra_project_mr
is_expected.to be_valid
end
it 'forbids duplicate blocks' do
new_block = described_class.new(block.attributes)
......@@ -59,14 +67,6 @@ describe MergeRequestBlock do
expect(new_block).not_to be_valid
end
it 'forbids blocks from being intra-project' do
project = blocking_mr.target_project
intra_project_mr = create(:merge_request, :rebased, source_project: project, target_project: project)
block.blocked_merge_request = intra_project_mr
is_expected.not_to be_valid
end
end
describe '.with_blocking_mr_ids' do
......
......@@ -1260,9 +1260,6 @@ msgstr ""
msgid "All changes are committed"
msgstr ""
msgid "All cross-project dependencies have merged"
msgstr ""
msgid "All email addresses will be used to identify your commits."
msgstr ""
......@@ -1278,6 +1275,9 @@ msgstr ""
msgid "All merge conflicts were resolved. The merge request can now be merged."
msgstr ""
msgid "All merge request dependencies have been merged"
msgstr ""
msgid "All paths are relative to the GitLab URL. Do not include %{relative_url_link_start}relative URL%{relative_url_link_end}."
msgstr ""
......@@ -4606,9 +4606,6 @@ msgstr ""
msgid "Cron syntax"
msgstr ""
msgid "Cross-project dependencies"
msgstr ""
msgid "Current Branch"
msgstr ""
......@@ -9839,6 +9836,9 @@ msgstr ""
msgid "Merge request approvals allow you to set the number of necessary approvals and predefine a list of approvers that will need to approve every merge request in a project."
msgstr ""
msgid "Merge request dependencies"
msgstr ""
msgid "Merge requests"
msgstr ""
......@@ -18696,9 +18696,6 @@ msgstr ""
msgid "cannot be enabled unless all domains have TLS certificates"
msgstr ""
msgid "cannot be in the same project"
msgstr ""
msgid "cannot be modified"
msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment