diff options
author | Alessio Caiazza <acaiazza@gitlab.com> | 2018-10-01 15:03:48 +0200 |
---|---|---|
committer | Alessio Caiazza <acaiazza@gitlab.com> | 2018-10-05 21:14:59 +0200 |
commit | 94fc0619365c7df284a29e76b1abc194a266efc2 (patch) | |
tree | 60770d1ed6013416831c0795ee66f30a3eb71760 /app/models/project_auto_devops.rb | |
parent | 1a90632cc9555d06edfa3a86808ab65f47558be9 (diff) | |
download | gitlab-ce-94fc0619365c7df284a29e76b1abc194a266efc2.tar.gz |
Add timed incremental rollout to Auto DevOps
Auto DevOps deployment strategies now supports timed incremental
rollout. We are deprecating the usage of INCREMENTAL_ROLLOUT_ENABLED
environment variable in Auto DevOps template.
The new behavior will be driven by the INCREMENTAL_ROLLOUT_MODE variable
that can either be manual (same as INCREMENTAL_ROLLOUT_ENABLED) or
timed.
Rollout deployments will be executed using a 5 minute delay between each
job.
Diffstat (limited to 'app/models/project_auto_devops.rb')
-rw-r--r-- | app/models/project_auto_devops.rb | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/app/models/project_auto_devops.rb b/app/models/project_auto_devops.rb index dc6736dd9cd..2253ad7b543 100644 --- a/app/models/project_auto_devops.rb +++ b/app/models/project_auto_devops.rb @@ -5,7 +5,8 @@ class ProjectAutoDevops < ActiveRecord::Base enum deploy_strategy: { continuous: 0, - manual: 1 + manual: 1, + timed_incremental: 2 } scope :enabled, -> { where(enabled: true) } @@ -30,10 +31,7 @@ class ProjectAutoDevops < ActiveRecord::Base value: domain.presence || instance_domain) end - if manual? - variables.append(key: 'STAGING_ENABLED', value: '1') - variables.append(key: 'INCREMENTAL_ROLLOUT_ENABLED', value: '1') - end + variables.concat(deployment_strategy_default_variables) end end @@ -51,4 +49,16 @@ class ProjectAutoDevops < ActiveRecord::Base !project.public? && !project.deploy_tokens.find_by(name: DeployToken::GITLAB_DEPLOY_TOKEN_NAME).present? end + + def deployment_strategy_default_variables + Gitlab::Ci::Variables::Collection.new.tap do |variables| + if manual? + variables.append(key: 'STAGING_ENABLED', value: '1') + variables.append(key: 'INCREMENTAL_ROLLOUT_ENABLED', value: '1') # deprecated + variables.append(key: 'INCREMENTAL_ROLLOUT_MODE', value: 'manual') + elsif timed_incremental? + variables.append(key: 'INCREMENTAL_ROLLOUT_MODE', value: 'timed') + end + end + end end |