diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-03-28 15:56:17 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-03-28 15:56:17 +0000 |
commit | bc2eff8dfb8d90b852ae69b59831e557322caeb8 (patch) | |
tree | cf343fb36051472b950a409b1e90e4d00bfaa577 /app/services | |
parent | 5ac5767e05474a0dfe37b6a0a619948bd91fccd8 (diff) | |
parent | 7fd9e39d885c7d7520ba0a7e45e8c58847f1c11d (diff) | |
download | gitlab-ce-bc2eff8dfb8d90b852ae69b59831e557322caeb8.tar.gz |
Merge branch '44392-resolve-projects-creation-silently-failing-on-after-create-error' into 'master'
Resolve "For new created projects permissions are not inherited from group level"
Closes #44692
See merge request gitlab-org/gitlab-ce!18013
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/projects/create_service.rb | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/app/services/projects/create_service.rb b/app/services/projects/create_service.rb index 7fa1387084c..633e2c8236c 100644 --- a/app/services/projects/create_service.rb +++ b/app/services/projects/create_service.rb @@ -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,29 @@ 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 + log_message = message.dup - Rails.logger.error(message) + log_message << " Project ID: #{@project.id}" if @project&.id + Rails.logger.error(log_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 |