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
f854f6cd
Commit
f854f6cd
authored
Jun 23, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed pipeline notes issue
parent
8c253997
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
0 deletions
+42
-0
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+13
-0
spec/lib/gitlab/import_export/project.json
spec/lib/gitlab/import_export/project.json
+23
-0
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
+6
-0
No files found.
app/models/ci/pipeline.rb
View file @
f854f6cd
...
...
@@ -170,6 +170,19 @@ module Ci
builds
.
where
.
not
(
environment:
nil
).
success
.
pluck
(
:environment
).
uniq
end
# Manually set the notes for a Ci::Pipeline
# There is no ActiveRecord relation between Ci::Pipeline and notes
# as they are related to a commit sha. This method helps importing
# them using the +Gitlab::ImportExport::RelationFactory+ class.
def
notes
=
(
notes
)
notes
.
each
do
|
note
|
note
[
:id
]
=
nil
note
[
:commit_id
]
=
sha
note
[
:noteable_id
]
=
self
[
'id'
]
note
.
save!
end
end
def
notes
Note
.
for_commit_id
(
sha
)
end
...
...
spec/lib/gitlab/import_export/project.json
View file @
f854f6cd
...
...
@@ -4894,6 +4894,29 @@
"started_at"
:
null
,
"finished_at"
:
null
,
"duration"
:
null
,
"notes"
:
[
{
"id"
:
999
,
"note"
:
"Natus rerum qui dolorem dolorum voluptas."
,
"noteable_type"
:
"Commit"
,
"author_id"
:
1
,
"created_at"
:
"2016-03-22T15:19:59.469Z"
,
"updated_at"
:
"2016-03-22T15:19:59.469Z"
,
"project_id"
:
5
,
"attachment"
:
{
"url"
:
null
},
"line_code"
:
null
,
"commit_id"
:
"be93687618e4b132087f430a4d8fc3a609c9b77c"
,
"noteable_id"
:
36
,
"system"
:
false
,
"st_diff"
:
null
,
"updated_by_id"
:
null
,
"author"
:
{
"name"
:
"Administrator"
}
}
],
"statuses"
:
[
{
"id"
:
71
,
...
...
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
View file @
f854f6cd
...
...
@@ -18,6 +18,12 @@ describe Gitlab::ImportExport::ProjectTreeRestorer, services: true do
it
'restores models based on JSON'
do
expect
(
restored_project_json
).
to
be
true
end
it
'creates a valid pipeline note'
do
restored_project_json
expect
(
Ci
::
Pipeline
.
first
.
notes
).
not_to
be_empty
end
end
end
end
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