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
bf4a3af0
Commit
bf4a3af0
authored
Mar 27, 2018
by
Tiago Botelho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Project creation does not fail silently on DB related changes
parent
c628f8f4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
8 deletions
+26
-8
create_service.rb
app/services/projects/create_service.rb
+11
-8
44392-resolve-projects-creation-silently-failing-on-after-create-error.yml
...jects-creation-silently-failing-on-after-create-error.yml
+5
-0
create_service_spec.rb
spec/services/projects/create_service_spec.rb
+10
-0
No files found.
app/services/projects/create_service.rb
View file @
bf4a3af0
...
...
@@ -90,9 +90,6 @@ module Projects
unless
@project
.
gitlab_project_import?
@project
.
write_repository_config
@project
.
create_wiki
unless
skip_wiki?
create_services_from_active_templates
(
@project
)
@project
.
create_labels
end
event_service
.
create_project
(
@project
,
current_user
)
...
...
@@ -121,21 +118,27 @@ module Projects
Project
.
transaction
do
@project
.
create_or_update_import_data
(
data:
import_data
[
:data
],
credentials:
import_data
[
:credentials
])
if
import_data
if
@project
.
save
&&
!
@project
.
import?
raise
'Failed to create repository'
unless
@project
.
create_repository
if
@project
.
save
unless
@project
.
gitlab_project_import?
create_services_from_active_templates
(
@project
)
@project
.
create_labels
end
unless
@project
.
import?
raise
'Failed to create repository'
unless
@project
.
create_repository
end
end
end
end
def
fail
(
error
:)
message
=
"Unable to save project. Error:
#{
error
}
"
message
<<
"Project ID:
#{
@project
.
id
}
"
if
@project
&&
@project
.
id
Rails
.
logger
.
error
(
message
)
if
@project
&&
@project
.
import?
if
@project
@project
.
errors
.
add
(
:base
,
message
)
@project
.
mark_import_as_failed
(
message
)
@project
.
mark_import_as_failed
(
message
)
if
@project
.
import?
end
@project
...
...
changelogs/unreleased/44392-resolve-projects-creation-silently-failing-on-after-create-error.yml
0 → 100644
View file @
bf4a3af0
---
title
:
Project creation will now raise an error if a service template is invalid
merge_request
:
18013
author
:
type
:
fixed
spec/services/projects/create_service_spec.rb
View file @
bf4a3af0
...
...
@@ -70,6 +70,16 @@ describe Projects::CreateService, '#execute' do
opts
[
:default_branch
]
=
'master'
expect
(
create_project
(
user
,
opts
)).
to
eq
(
nil
)
end
it
'handles invalid service'
do
create
(
:service
,
type:
'JiraService'
,
project:
nil
,
template:
true
,
active:
true
)
project
=
create_project
(
user
,
opts
)
expect
(
project
).
not_to
be_persisted
expect
(
project
.
errors
.
full_messages_for
(
:base
).
first
).
to
match
(
/Unable to save project. Error: Unable to save JiraService/
)
expect
(
project
.
services
.
count
).
to
eq
0
end
end
context
'wiki_enabled creates repository directory'
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