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
Boxiang Sun
gitlab-ce
Commits
069bc264
Commit
069bc264
authored
Jun 13, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored loads of things due to commits to pipeline change
parent
771f7351
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
20 deletions
+26
-20
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+4
-4
lib/gitlab/import_export/import_export.yml
lib/gitlab/import_export/import_export.yml
+2
-2
lib/gitlab/import_export/import_export_reader.rb
lib/gitlab/import_export/import_export_reader.rb
+1
-2
spec/lib/gitlab/import_export/import_export_reader_spec.rb
spec/lib/gitlab/import_export/import_export_reader_spec.rb
+5
-1
spec/lib/gitlab/import_export/project_tree_saver_spec.rb
spec/lib/gitlab/import_export/project_tree_saver_spec.rb
+14
-11
No files found.
app/models/ci/pipeline.rb
View file @
069bc264
...
@@ -161,6 +161,10 @@ module Ci
...
@@ -161,6 +161,10 @@ module Ci
git_commit_message
=~
/(\[ci skip\])/
if
git_commit_message
git_commit_message
=~
/(\[ci skip\])/
if
git_commit_message
end
end
def
notes
Note
.
for_commit_id
(
sha
)
end
private
private
def
update_state
def
update_state
...
@@ -181,9 +185,5 @@ module Ci
...
@@ -181,9 +185,5 @@ module Ci
self
.
yaml_errors
=
error
self
.
yaml_errors
=
error
update_state
update_state
end
end
def
notes
Note
.
for_commit_id
(
valid_commit_sha
)
end
end
end
end
end
lib/gitlab/import_export/import_export.yml
View file @
069bc264
...
@@ -16,10 +16,10 @@ project_tree:
...
@@ -16,10 +16,10 @@ project_tree:
-
notes
:
-
notes
:
:author
:author
-
:merge_request_diff
-
:merge_request_diff
-
ci_commits
:
-
pipelines
:
-
:statuses
-
notes
:
-
notes
:
:author
:author
-
:statuses
-
:variables
-
:variables
-
:triggers
-
:triggers
-
:deploy_keys
-
:deploy_keys
...
...
lib/gitlab/import_export/import_export_reader.rb
View file @
069bc264
...
@@ -3,9 +3,8 @@ module Gitlab
...
@@ -3,9 +3,8 @@ module Gitlab
class
ImportExportReader
class
ImportExportReader
def
initialize
(
shared
:)
def
initialize
(
shared
:)
config
=
ImportExport
.
config_file
@shared
=
shared
@shared
=
shared
config_hash
=
YAML
.
load_file
(
config
).
deep_symbolize_keys
config_hash
=
YAML
.
load_file
(
Gitlab
::
ImportExport
.
config_file
).
deep_symbolize_keys
@tree
=
config_hash
[
:project_tree
]
@tree
=
config_hash
[
:project_tree
]
@attributes_finder
=
Gitlab
::
ImportExport
::
AttributesFinder
.
new
(
included_attributes:
config_hash
[
:included_attributes
],
@attributes_finder
=
Gitlab
::
ImportExport
::
AttributesFinder
.
new
(
included_attributes:
config_hash
[
:included_attributes
],
excluded_attributes:
config_hash
[
:excluded_attributes
],
excluded_attributes:
config_hash
[
:excluded_attributes
],
...
...
spec/lib/gitlab/import_export/import_export_reader_spec.rb
View file @
069bc264
...
@@ -16,7 +16,11 @@ describe Gitlab::ImportExport::ImportExportReader, lib: true do
...
@@ -16,7 +16,11 @@ describe Gitlab::ImportExport::ImportExportReader, lib: true do
}
}
end
end
before
do
allow_any_instance_of
(
Gitlab
::
ImportExport
).
to
receive
(
:config_file
).
and_return
(
test_config
)
end
it
'generates hash from project tree config'
do
it
'generates hash from project tree config'
do
expect
(
described_class
.
new
(
config:
test_config
,
shared:
shared
).
project_tree
).
to
match
(
project_tree_hash
)
expect
(
described_class
.
new
(
shared:
shared
).
project_tree
).
to
match
(
project_tree_hash
)
end
end
end
end
spec/lib/gitlab/import_export/project_tree_saver_spec.rb
View file @
069bc264
...
@@ -89,20 +89,20 @@ describe Gitlab::ImportExport::ProjectTreeSaver, services: true do
...
@@ -89,20 +89,20 @@ describe Gitlab::ImportExport::ProjectTreeSaver, services: true do
expect
(
saved_project_json
[
'merge_requests'
].
first
[
'notes'
].
first
[
'author'
]).
not_to
be_empty
expect
(
saved_project_json
[
'merge_requests'
].
first
[
'notes'
].
first
[
'author'
]).
not_to
be_empty
end
end
it
'has
commit
statuses'
do
it
'has
pipeline
statuses'
do
expect
(
saved_project_json
[
'
ci_commit
s'
].
first
[
'statuses'
]).
not_to
be_empty
expect
(
saved_project_json
[
'
pipeline
s'
].
first
[
'statuses'
]).
not_to
be_empty
end
end
it
'has
CI
builds'
do
it
'has
pipeline
builds'
do
expect
(
saved_project_json
[
'
ci_commit
s'
].
first
[
'statuses'
].
first
[
'type'
]).
to
eq
(
'Ci::Build'
)
expect
(
saved_project_json
[
'
pipeline
s'
].
first
[
'statuses'
].
first
[
'type'
]).
to
eq
(
'Ci::Build'
)
end
end
it
'has
ci
commits'
do
it
'has
pipeline
commits'
do
expect
(
saved_project_json
[
'
ci_commit
s'
]).
not_to
be_empty
expect
(
saved_project_json
[
'
pipeline
s'
]).
not_to
be_empty
end
end
it
'has ci
commits
notes'
do
it
'has ci
pipeline
notes'
do
expect
(
saved_project_json
[
'
ci_commit
s'
].
first
[
'notes'
]).
not_to
be_empty
expect
(
saved_project_json
[
'
pipeline
s'
].
first
[
'notes'
]).
not_to
be_empty
end
end
end
end
end
end
...
@@ -125,18 +125,21 @@ describe Gitlab::ImportExport::ProjectTreeSaver, services: true do
...
@@ -125,18 +125,21 @@ describe Gitlab::ImportExport::ProjectTreeSaver, services: true do
commit_status
=
create
(
:commit_status
,
project:
project
)
commit_status
=
create
(
:commit_status
,
project:
project
)
ci_
commit
=
create
(
:ci_commit
,
ci_
pipeline
=
create
(
:ci_pipeline
,
project:
project
,
project:
project
,
sha:
merge_request
.
last_commit
.
id
,
sha:
merge_request
.
last_commit
.
id
,
ref:
merge_request
.
source_branch
,
ref:
merge_request
.
source_branch
,
statuses:
[
commit_status
])
statuses:
[
commit_status
])
create
(
:ci_build
,
commit:
ci_commit
,
project:
project
)
create
(
:ci_build
,
pipeline:
ci_pipeline
,
project:
project
)
create
(
:milestone
,
project:
project
)
create
(
:milestone
,
project:
project
)
create
(
:note
,
noteable:
issue
,
project:
project
)
create
(
:note
,
noteable:
issue
,
project:
project
)
create
(
:note
,
noteable:
merge_request
,
project:
project
)
create
(
:note
,
noteable:
merge_request
,
project:
project
)
create
(
:note
,
noteable:
ci_commit
,
project:
project
)
create
(
:note
,
noteable:
snippet
,
project:
project
)
create
(
:note
,
noteable:
snippet
,
project:
project
)
create
(
:note_on_commit
,
author:
user
,
project:
project
,
commit_id:
ci_pipeline
.
sha
)
project
project
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