diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-10-14 11:19:16 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-10-14 11:19:16 +0300 |
commit | 3726dc4bb73647123ebef5c97f401f5537d3ae16 (patch) | |
tree | e26c4735f2f42132d7cbd125ae968280be185b9b /app/services/create_deployment_service.rb | |
parent | 4e9342599b472a28928a95fd43efc4df851f8e33 (diff) |
Check if project exists before creating deployment
Diffstat (limited to 'app/services/create_deployment_service.rb')
-rw-r--r-- | app/services/create_deployment_service.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/services/create_deployment_service.rb b/app/services/create_deployment_service.rb index c6dc2148c11..ff9a8310a8c 100644 --- a/app/services/create_deployment_service.rb +++ b/app/services/create_deployment_service.rb @@ -2,6 +2,8 @@ require_relative 'base_service' class CreateDeploymentService < BaseService def execute(deployable = nil) + return unless executable? + ActiveRecord::Base.transaction do @deployable = deployable @environment = prepare_environment @@ -14,6 +16,10 @@ class CreateDeploymentService < BaseService private + def executable? + project && name.present? + end + def deploy project.deployments.create( environment: @environment, |