Commit 1fbc48ef authored by Nick Thomas's avatar Nick Thomas

Merge branch 'id-merge-request-dependencies' into 'master'

Allow intra-project MR dependencies

See merge request gitlab-org/gitlab!16799
parents a54ee323 3e937f55
---
title: Allow intra-project MR dependencies
merge_request: 16799
author:
type: changed
...@@ -47,7 +47,7 @@ With **[GitLab Enterprise Edition][ee]**, you can also: ...@@ -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 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)** - 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)** - 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 ## Use cases
...@@ -509,7 +509,7 @@ GitLab runs the [Sitespeed.io container][sitespeed-container] and displays the d ...@@ -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) [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. > 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 ...@@ -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 dependencies have also been merged, helping to maintain the consistency of a
single logical change. 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)** ## Security reports **(ULTIMATE)**
......
...@@ -2,14 +2,13 @@ ...@@ -2,14 +2,13 @@
type: reference, concepts 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. > [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 Merge request dependencies allows a required order of merging
between merge requests in different projects to be expressed. If a between merge requests to be expressed. If a merge request "depends on" another,
merge request "depends on" another, then it cannot be merged until its then it cannot be merged until its dependency is itself merged.
dependency is itself merged.
NOTE: **Note:** NOTE: **Note:**
Merge requests dependencies are a **PREMIUM** feature, but this restriction is Merge requests dependencies are a **PREMIUM** feature, but this restriction is
...@@ -58,20 +57,20 @@ instead. ...@@ -58,20 +57,20 @@ instead.
To continue the above example, you can configure a dependency when creating the 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). new merge request in `awesome-project` (or by editing it, if it already exists).
The dependency needs to be configured on the **dependent** merge 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. 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, New dependencies can be added by reference, or by URL. To remove a dependency,
press the **X** by its reference. 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. has added a dependency for a merge request in a project you don't have access to.
These are shown as a simple count: 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 If necessary, you can remove all the dependencies like this by pressing the
**X**, just as you would for a single, visible dependency. **X**, just as you would for a single, visible dependency.
...@@ -82,7 +81,7 @@ or **Cancel** to return without making any changes. ...@@ -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 The list of configured dependencies, and the status of each one, is shown in the
merge request widget: 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** Until all dependencies have, themselves, been merged, the **Merge**
button will be disabled for the dependent merge request. In button will be disabled for the dependent merge request. In
......
...@@ -104,7 +104,7 @@ export default { ...@@ -104,7 +104,7 @@ export default {
issue-item-class="p-0" issue-item-class="p-0"
> >
<template v-slot:success> <template v-slot:success>
{{ __('All cross-project dependencies have merged') }} {{ __('All merge request dependencies have been merged') }}
<span class="text-secondary"> <span class="text-secondary">
{{ {{
sprintf(__('(%{mrCount} merged)'), { sprintf(__('(%{mrCount} merged)'), {
......
...@@ -27,8 +27,5 @@ class MergeRequestBlock < ApplicationRecord ...@@ -27,8 +27,5 @@ class MergeRequestBlock < ApplicationRecord
errors.add(:blocked_merge_request, _('cannot block others')) if errors.add(:blocked_merge_request, _('cannot block others')) if
blocked_merge_request.blocks_as_blocker.any? 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
end end
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
- return unless project&.feature_available?(:blocking_merge_requests) - return unless project&.feature_available?(:blocking_merge_requests)
.form-group.row.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 .col-sm-10
= text_field_tag 'blocking_merge_request_refs', nil, = text_field_tag 'blocking_merge_request_refs', nil,
class: 'form-control', class: 'form-control',
......
...@@ -23,7 +23,7 @@ describe 'User creates a merge request with blocking MRs', :js do ...@@ -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)) 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') click_button('Submit merge request')
expect(page).to have_content('Depends on 1 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 ...@@ -38,7 +38,7 @@ describe 'User creates a merge request with blocking MRs', :js do
it 'does not show blocking MRs controls' do it 'does not show blocking MRs controls' do
visit(project_new_merge_request_path(project, merge_request: mr_params)) 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 end
end end
...@@ -28,7 +28,7 @@ describe "User edits merge request with blocking MRs", :js do ...@@ -28,7 +28,7 @@ describe "User edits merge request with blocking MRs", :js do
it 'can add the other MR' do it 'can add the other MR' do
visit edit_project_merge_request_path(project, merge_request) 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' click_button 'Save changes'
...@@ -54,7 +54,7 @@ describe "User edits merge request with blocking MRs", :js do ...@@ -54,7 +54,7 @@ describe "User edits merge request with blocking MRs", :js do
it 'cannot add the other MR' do it 'cannot add the other MR' do
visit edit_project_merge_request_path(project, merge_request) 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' click_button 'Save changes'
......
...@@ -42,6 +42,14 @@ describe MergeRequestBlock do ...@@ -42,6 +42,14 @@ describe MergeRequestBlock do
expect(another_block).to be_valid expect(another_block).to be_valid
end 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 it 'forbids duplicate blocks' do
new_block = described_class.new(block.attributes) new_block = described_class.new(block.attributes)
...@@ -59,14 +67,6 @@ describe MergeRequestBlock do ...@@ -59,14 +67,6 @@ describe MergeRequestBlock do
expect(new_block).not_to be_valid expect(new_block).not_to be_valid
end 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 end
describe '.with_blocking_mr_ids' do describe '.with_blocking_mr_ids' do
......
...@@ -1260,9 +1260,6 @@ msgstr "" ...@@ -1260,9 +1260,6 @@ msgstr ""
msgid "All changes are committed" msgid "All changes are committed"
msgstr "" msgstr ""
msgid "All cross-project dependencies have merged"
msgstr ""
msgid "All email addresses will be used to identify your commits." msgid "All email addresses will be used to identify your commits."
msgstr "" msgstr ""
...@@ -1278,6 +1275,9 @@ msgstr "" ...@@ -1278,6 +1275,9 @@ msgstr ""
msgid "All merge conflicts were resolved. The merge request can now be merged." msgid "All merge conflicts were resolved. The merge request can now be merged."
msgstr "" 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}." msgid "All paths are relative to the GitLab URL. Do not include %{relative_url_link_start}relative URL%{relative_url_link_end}."
msgstr "" msgstr ""
...@@ -4606,9 +4606,6 @@ msgstr "" ...@@ -4606,9 +4606,6 @@ msgstr ""
msgid "Cron syntax" msgid "Cron syntax"
msgstr "" msgstr ""
msgid "Cross-project dependencies"
msgstr ""
msgid "Current Branch" msgid "Current Branch"
msgstr "" msgstr ""
...@@ -9839,6 +9836,9 @@ 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." 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 "" msgstr ""
msgid "Merge request dependencies"
msgstr ""
msgid "Merge requests" msgid "Merge requests"
msgstr "" msgstr ""
...@@ -18696,9 +18696,6 @@ msgstr "" ...@@ -18696,9 +18696,6 @@ msgstr ""
msgid "cannot be enabled unless all domains have TLS certificates" msgid "cannot be enabled unless all domains have TLS certificates"
msgstr "" msgstr ""
msgid "cannot be in the same project"
msgstr ""
msgid "cannot be modified" msgid "cannot be modified"
msgstr "" 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