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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
1c248cd4
Commit
1c248cd4
authored
Jan 09, 2019
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix unexpected exception by failed to find an actual head pipeline
Add changelog
parent
b2e807e6
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
3 deletions
+26
-3
app/models/merge_request.rb
app/models/merge_request.rb
+4
-3
changelogs/unreleased/fix-udpate-head-pipeline-method.yml
changelogs/unreleased/fix-udpate-head-pipeline-method.yml
+5
-0
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+17
-0
No files found.
app/models/merge_request.rb
View file @
1c248cd4
...
...
@@ -1108,10 +1108,11 @@ class MergeRequest < ActiveRecord::Base
end
def
update_head_pipeline
self
.
head_pipeline
=
find_actual_head_pipeline
find_actual_head_pipeline
.
try
do
|
pipeline
|
self
.
head_pipeline
=
pipeline
update_column
(
:head_pipeline_id
,
head_pipeline
.
id
)
if
head_pipeline_id_changed?
end
end
def
merge_request_pipeline_exists?
merge_request_pipelines
.
exists?
(
sha:
diff_head_sha
)
...
...
changelogs/unreleased/fix-udpate-head-pipeline-method.yml
0 → 100644
View file @
1c248cd4
---
title
:
Fix unexpected exception by failure of finding an actual head pipeline
merge_request
:
24257
author
:
type
:
fixed
spec/models/merge_request_spec.rb
View file @
1c248cd4
...
...
@@ -1418,6 +1418,23 @@ describe MergeRequest do
.
to
change
{
merge_request
.
reload
.
head_pipeline
}
.
from
(
nil
).
to
(
pipeline
)
end
context
'when merge request has already had head pipeline'
do
before
do
merge_request
.
update!
(
head_pipeline:
pipeline
)
end
context
'when failed to find an actual head pipeline'
do
before
do
allow
(
merge_request
).
to
receive
(
:find_actual_head_pipeline
)
{
}
end
it
'does not update the current head pipeline'
do
expect
{
subject
}
.
not_to
change
{
merge_request
.
reload
.
head_pipeline
}
end
end
end
end
context
'when there are no pipelines with the diff head sha'
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