summaryrefslogtreecommitdiff
path: root/app/services
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-09-14 23:00:15 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2016-09-19 10:07:13 +0200
commit6b979687459ad1ab5f1953bf451ee80fdb899b96 (patch)
treeff19ce3e4386a562a68cf9a9d9071ea7d02934ec /app/services
parente1b3ab5af290f6d2eeb56c4b72e341324414a6d2 (diff)
downloadgitlab-ce-6b979687459ad1ab5f1953bf451ee80fdb899b96.tar.gz
Update support for dynamic environments
Diffstat (limited to 'app/services')
-rw-r--r--app/services/create_deployment_service.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/app/services/create_deployment_service.rb b/app/services/create_deployment_service.rb
index 577ba731583..e6667132e27 100644
--- a/app/services/create_deployment_service.rb
+++ b/app/services/create_deployment_service.rb
@@ -2,13 +2,7 @@ require_relative 'base_service'
class CreateDeploymentService < BaseService
def execute(deployable = nil)
- environment = project.environments.find_or_create_by(
- name: expanded_name
- )
-
- if expanded_url
- environment.external_url = expanded_url
- end
+ environment = find_or_create_environment
project.deployments.create(
environment: environment,
@@ -22,6 +16,12 @@ class CreateDeploymentService < BaseService
private
+ def find_or_create_environment
+ project.environments.find_or_create_by(name: expanded_name) do |environment|
+ environment.external_url = expanded_url
+ end
+ end
+
def expanded_name
ExpandVariables.expand(name, variables)
end
@@ -41,7 +41,7 @@ class CreateDeploymentService < BaseService
end
def options
- params[:environment] || {}
+ params[:options] || {}
end
def variables