BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
5de0b078
Unverified
Commit
5de0b078
authored
Oct 02, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent creating 2 Ci::Project entities when enable CI
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
e3bc0e21
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
5 additions
and
10 deletions
+5
-10
project.rb
app/models/project.rb
+1
-5
git_push_service.rb
app/services/git_push_service.rb
+1
-1
commits.rb
features/steps/project/commits/commits.rb
+1
-1
project.rb
features/steps/shared/project.rb
+1
-1
project_spec.rb
spec/models/project_spec.rb
+1
-2
No files found.
app/models/project.rb
View file @
5de0b078
...
...
@@ -751,13 +751,9 @@ class Project < ActiveRecord::Base
gitlab_ci_project
||
create_gitlab_ci_project
end
def
enable_ci
(
user
)
# Enable service
def
enable_ci
service
=
gitlab_ci_service
||
create_gitlab_ci_service
service
.
active
=
true
service
.
save
# Create Ci::Project
Ci
::
CreateProjectService
.
new
.
execute
(
user
,
self
)
end
end
app/services/git_push_service.rb
View file @
5de0b078
...
...
@@ -58,7 +58,7 @@ class GitPushService
# If CI was disabled but .gitlab-ci.yml file was pushed
# we enable CI automatically
if
!
project
.
gitlab_ci?
&&
gitlab_ci_yaml?
(
newrev
)
project
.
enable_ci
(
user
)
project
.
enable_ci
end
EventCreateService
.
new
.
push
(
project
,
user
,
@push_data
)
...
...
features/steps/project/commits/commits.rb
View file @
5de0b078
...
...
@@ -103,7 +103,7 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
end
step
'commit has ci status'
do
@project
.
enable_ci
(
@user
)
@project
.
enable_ci
create
:ci_commit
,
gl_project:
@project
,
sha:
sample_commit
.
id
end
...
...
features/steps/shared/project.rb
View file @
5de0b078
...
...
@@ -199,7 +199,7 @@ module SharedProject
step
'project "Shop" has CI enabled'
do
project
=
Project
.
find_by
(
name:
"Shop"
)
project
.
enable_ci
(
@user
)
project
.
enable_ci
end
step
'project "Shop" has CI build'
do
...
...
spec/models/project_spec.rb
View file @
5de0b078
...
...
@@ -417,9 +417,8 @@ describe Project do
describe
:enable_ci
do
let
(
:project
)
{
create
:project
}
let
(
:user
)
{
create
:user
}
before
{
project
.
enable_ci
(
user
)
}
before
{
project
.
enable_ci
}
it
{
expect
(
project
.
gitlab_ci?
).
to
be_truthy
}
it
{
expect
(
project
.
gitlab_ci_project
).
to
be_a
(
Ci
::
Project
)
}
...
...
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