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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
37e9e71e
Commit
37e9e71e
authored
Oct 02, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecessary fork ci logic
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
5de0b078
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
84 deletions
+8
-84
app/models/project_services/gitlab_ci_service.rb
app/models/project_services/gitlab_ci_service.rb
+0
-15
app/services/ci/create_project_service.rb
app/services/ci/create_project_service.rb
+0
-30
app/services/projects/fork_service.rb
app/services/projects/fork_service.rb
+7
-1
spec/services/ci/create_project_service_spec.rb
spec/services/ci/create_project_service_spec.rb
+0
-37
spec/services/projects/fork_service_spec.rb
spec/services/projects/fork_service_spec.rb
+1
-1
No files found.
app/models/project_services/gitlab_ci_service.rb
View file @
37e9e71e
...
...
@@ -72,21 +72,6 @@ class GitlabCiService < CiService
:error
end
def
fork_registration
(
new_project
,
current_user
)
params
=
OpenStruct
.
new
({
id:
new_project
.
id
,
default_branch:
new_project
.
default_branch
})
ci_project
=
Ci
::
Project
.
find_by!
(
gitlab_id:
project
.
id
)
Ci
::
CreateProjectService
.
new
.
execute
(
current_user
,
params
,
ci_project
)
end
def
commit_coverage
(
sha
,
ref
)
get_ci_commit
(
sha
,
ref
).
coverage
rescue
ActiveRecord
::
RecordNotFound
...
...
app/services/ci/create_project_service.rb
deleted
100644 → 0
View file @
5de0b078
module
Ci
class
CreateProjectService
include
Gitlab
::
Application
.
routes
.
url_helpers
def
execute
(
current_user
,
params
,
forked_project
=
nil
)
@project
=
Ci
::
Project
.
parse
(
params
)
Ci
::
Project
.
transaction
do
@project
.
save!
gl_project
=
::
Project
.
find
(
@project
.
gitlab_id
)
gl_project
.
build_missing_services
gl_project
.
gitlab_ci_service
.
update_attributes
(
active:
true
)
end
if
forked_project
# Copy settings
settings
=
forked_project
.
attributes
.
select
do
|
attr_name
,
value
|
[
"public"
,
"shared_runners_enabled"
,
"allow_git_fetch"
].
include?
attr_name
end
@project
.
update
(
settings
)
end
Ci
::
EventService
.
new
.
create_project
(
current_user
,
@project
)
@project
end
end
end
app/services/projects/fork_service.rb
View file @
37e9e71e
...
...
@@ -18,7 +18,13 @@ module Projects
if
new_project
.
persisted?
if
@project
.
gitlab_ci?
@project
.
gitlab_ci_service
.
fork_registration
(
new_project
,
@current_user
)
new_project
.
enable_ci
settings
=
@project
.
gitlab_ci_project
.
attributes
.
select
do
|
attr_name
,
value
|
[
"public"
,
"shared_runners_enabled"
,
"allow_git_fetch"
].
include?
attr_name
end
new_project
.
gitlab_ci_project
.
update
(
settings
)
end
end
...
...
spec/services/ci/create_project_service_spec.rb
deleted
100644 → 0
View file @
5de0b078
require
'spec_helper'
describe
Ci
::
CreateProjectService
do
let
(
:service
)
{
Ci
::
CreateProjectService
.
new
}
let
(
:current_user
)
{
double
.
as_null_object
}
let
(
:project
)
{
FactoryGirl
.
create
:project
}
describe
:execute
do
context
'valid params'
do
subject
{
service
.
execute
(
current_user
,
project
)
}
it
{
is_expected
.
to
be_kind_of
(
Ci
::
Project
)
}
it
{
is_expected
.
to
be_persisted
}
end
context
'without project dump'
do
it
'should raise exception'
do
expect
{
service
.
execute
(
current_user
,
''
,
''
)
}.
to
raise_error
(
NoMethodError
)
end
end
context
"forking"
do
let
(
:ci_origin_project
)
do
FactoryGirl
.
create
(
:ci_project
,
shared_runners_enabled:
true
,
public:
true
,
allow_git_fetch:
true
)
end
subject
{
service
.
execute
(
current_user
,
project
,
ci_origin_project
)
}
it
"uses project as a template for settings and jobs"
do
expect
(
subject
.
shared_runners_enabled
).
to
be_truthy
expect
(
subject
.
public
).
to
be_truthy
expect
(
subject
.
allow_git_fetch
).
to
be_truthy
end
end
end
end
spec/services/projects/fork_service_spec.rb
View file @
37e9e71e
...
...
@@ -48,7 +48,7 @@ describe Projects::ForkService do
@from_project
.
build_missing_services
@from_project
.
gitlab_ci_service
.
update_attributes
(
active:
true
)
expect_any_instance_of
(
Ci
::
CreateProjectService
).
to
receive
(
:execute
)
expect_any_instance_of
(
Project
).
to
receive
(
:enable_ci
)
fork_project
(
@from_project
,
@to_user
)
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