summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2018-06-01 23:47:38 +0200
committerMatija Čupić <matteeyah@gmail.com>2018-06-01 23:58:39 +0200
commit39412d0a163625bd91632267a1dd36c1ebb23906 (patch)
treef4c063a0f54fdc777965d326f89b6f1c51aa172d
parent5e9687a198f205131d8e65c747f6b4ac2ae092f1 (diff)
downloadgitlab-ce-39412d0a163625bd91632267a1dd36c1ebb23906.tar.gz
Add deploy strategy related predefined variables
-rw-r--r--app/models/project_auto_devops.rb5
-rw-r--r--spec/factories/project_auto_devops.rb1
-rw-r--r--spec/models/project_auto_devops_spec.rb13
3 files changed, 19 insertions, 0 deletions
diff --git a/app/models/project_auto_devops.rb b/app/models/project_auto_devops.rb
index 8464b1d9157..d5e00f84cf7 100644
--- a/app/models/project_auto_devops.rb
+++ b/app/models/project_auto_devops.rb
@@ -25,6 +25,11 @@ class ProjectAutoDevops < ActiveRecord::Base
variables.append(key: 'AUTO_DEVOPS_DOMAIN',
value: domain.presence || instance_domain)
end
+
+ if continuous?
+ variables.append(key: 'STAGING_ENABLED', value: 1)
+ variables.append(key: 'INCREMENTAL_ROLLOUT_ENABLED', value: 1)
+ end
end
end
end
diff --git a/spec/factories/project_auto_devops.rb b/spec/factories/project_auto_devops.rb
index 5ce1988c76f..a59087cd7eb 100644
--- a/spec/factories/project_auto_devops.rb
+++ b/spec/factories/project_auto_devops.rb
@@ -3,5 +3,6 @@ FactoryBot.define do
project
enabled true
domain "example.com"
+ deploy_strategy :continuous
end
end
diff --git a/spec/models/project_auto_devops_spec.rb b/spec/models/project_auto_devops_spec.rb
index 1bfc6befb4b..37cd1f571e5 100644
--- a/spec/models/project_auto_devops_spec.rb
+++ b/spec/models/project_auto_devops_spec.rb
@@ -69,6 +69,19 @@ describe ProjectAutoDevops do
end
end
+ context 'when deploy_strategy is continuous' do
+ let(:domain) { 'example.com' }
+
+ before do
+ auto_devops.deploy_strategy = 'continuous'
+ end
+
+ it do
+ expect(auto_devops.predefined_variables.map { |var| var[:key] })
+ .to include("STAGING_ENABLED", "INCREMENTAL_ROLLOUT_ENABLED")
+ end
+ end
+
def domain_variable
{ key: 'AUTO_DEVOPS_DOMAIN', value: 'example.com', public: true }
end