Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
b97d06b9
Commit
b97d06b9
authored
Feb 05, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
fc018a62
fb296ab5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
2 deletions
+30
-2
app/services/merge_requests/base_service.rb
app/services/merge_requests/base_service.rb
+1
-0
changelogs/unreleased/not-run-pipeline-on-empty-merge-request.yml
...gs/unreleased/not-run-pipeline-on-empty-merge-request.yml
+5
-0
spec/services/merge_requests/create_service_spec.rb
spec/services/merge_requests/create_service_spec.rb
+18
-0
spec/services/merge_requests/refresh_service_spec.rb
spec/services/merge_requests/refresh_service_spec.rb
+6
-2
No files found.
app/services/merge_requests/base_service.rb
View file @
b97d06b9
...
@@ -63,6 +63,7 @@ module MergeRequests
...
@@ -63,6 +63,7 @@ module MergeRequests
# UpdateMergeRequestsWorker could be retried by an exception.
# UpdateMergeRequestsWorker could be retried by an exception.
# MR pipelines should not be recreated in such case.
# MR pipelines should not be recreated in such case.
return
if
merge_request
.
merge_request_pipeline_exists?
return
if
merge_request
.
merge_request_pipeline_exists?
return
if
merge_request
.
has_no_commits?
Ci
::
CreatePipelineService
Ci
::
CreatePipelineService
.
new
(
merge_request
.
source_project
,
user
,
ref:
merge_request
.
source_branch
)
.
new
(
merge_request
.
source_project
,
user
,
ref:
merge_request
.
source_branch
)
...
...
changelogs/unreleased/not-run-pipeline-on-empty-merge-request.yml
0 → 100644
View file @
b97d06b9
---
title
:
Don't create new merge request pipeline without commits
merge_request
:
24503
author
:
Hiroyuki Sato
type
:
added
spec/services/merge_requests/create_service_spec.rb
View file @
b97d06b9
...
@@ -197,6 +197,24 @@ describe MergeRequests::CreateService do
...
@@ -197,6 +197,24 @@ describe MergeRequests::CreateService do
expect
(
merge_request
.
actual_head_pipeline
).
to
be_merge_request
expect
(
merge_request
.
actual_head_pipeline
).
to
be_merge_request
end
end
context
'when there are no commits between source branch and target branch'
do
let
(
:opts
)
do
{
title:
'Awesome merge_request'
,
description:
'please fix'
,
source_branch:
'not-merged-branch'
,
target_branch:
'master'
}
end
it
'does not create a merge request pipeline'
do
expect
(
merge_request
).
to
be_persisted
merge_request
.
reload
expect
(
merge_request
.
merge_request_pipelines
.
count
).
to
eq
(
0
)
end
end
context
"when branch pipeline was created before a merge request pipline has been created"
do
context
"when branch pipeline was created before a merge request pipline has been created"
do
before
do
before
do
create
(
:ci_pipeline
,
project:
merge_request
.
source_project
,
create
(
:ci_pipeline
,
project:
merge_request
.
source_project
,
...
...
spec/services/merge_requests/refresh_service_spec.rb
View file @
b97d06b9
...
@@ -156,11 +156,15 @@ describe MergeRequests::RefreshService do
...
@@ -156,11 +156,15 @@ describe MergeRequests::RefreshService do
}
}
end
end
it
'create merge request pipeline'
do
it
'create merge request pipeline
with commits
'
do
expect
{
subject
}
expect
{
subject
}
.
to
change
{
@merge_request
.
merge_request_pipelines
.
count
}.
by
(
1
)
.
to
change
{
@merge_request
.
merge_request_pipelines
.
count
}.
by
(
1
)
.
and
change
{
@fork_merge_request
.
merge_request_pipelines
.
count
}.
by
(
1
)
.
and
change
{
@fork_merge_request
.
merge_request_pipelines
.
count
}.
by
(
1
)
.
and
change
{
@another_merge_request
.
merge_request_pipelines
.
count
}.
by
(
1
)
.
and
change
{
@another_merge_request
.
merge_request_pipelines
.
count
}.
by
(
0
)
expect
(
@merge_request
.
has_commits?
).
to
be_truthy
expect
(
@fork_merge_request
.
has_commits?
).
to
be_truthy
expect
(
@another_merge_request
.
has_commits?
).
to
be_falsy
end
end
context
"when branch pipeline was created before a merge request pipline has been created"
do
context
"when branch pipeline was created before a merge request pipline has been created"
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment