Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-09-15 00:00:15 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2016-09-19 11:07:13 +0300
commit6b979687459ad1ab5f1953bf451ee80fdb899b96 (patch)
treeff19ce3e4386a562a68cf9a9d9071ea7d02934ec /app
parente1b3ab5af290f6d2eeb56c4b72e341324414a6d2 (diff)
Update support for dynamic environments
Diffstat (limited to 'app')
-rw-r--r--app/models/ci/build.rb2
-rw-r--r--app/services/create_deployment_service.rb16
2 files changed, 9 insertions, 9 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 47dedef38d0..d5724af4cce 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -86,7 +86,7 @@ module Ci
ref: build.ref,
tag: build.tag,
options: build.options[:environment],
- variables: variables)
+ variables: build.variables)
service.execute(build)
end
end
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