Commit 64cd675b authored by Nick Thomas's avatar Nick Thomas

Merge branch 'auto_devops_enabled_ci_variable' into 'master'

Add CI variable to show when Auto-DevOps is explicitly enabled

See merge request gitlab-org/gitlab!20332
parents 8764bb33 8ab39eee
......@@ -16,6 +16,7 @@ class ProjectAutoDevops < ApplicationRecord
def predefined_variables
Gitlab::Ci::Variables::Collection.new.tap do |variables|
variables.append(key: 'AUTO_DEVOPS_EXPLICITLY_ENABLED', value: '1') if enabled?
variables.concat(deployment_strategy_default_variables)
end
end
......
---
title: Add CI variable to show when Auto-DevOps is explicitly enabled
merge_request: 20332
author:
type: changed
......@@ -23,7 +23,8 @@ describe ProjectAutoDevops do
[
{ key: 'INCREMENTAL_ROLLOUT_MODE', value: 'manual' },
{ key: 'STAGING_ENABLED', value: '1' },
{ key: 'INCREMENTAL_ROLLOUT_ENABLED', value: '1' }
{ key: 'INCREMENTAL_ROLLOUT_ENABLED', value: '1' },
{ key: 'AUTO_DEVOPS_EXPLICITLY_ENABLED', value: '1' }
]
end
......@@ -33,6 +34,8 @@ describe ProjectAutoDevops do
context 'when deploy_strategy is continuous' do
let(:auto_devops) { build_stubbed(:project_auto_devops, :continuous_deployment, project: project) }
it { expect(auto_devops.predefined_variables).to include(key: 'AUTO_DEVOPS_EXPLICITLY_ENABLED', value: '1') }
it do
expect(auto_devops.predefined_variables.map { |var| var[:key] })
.not_to include("STAGING_ENABLED", "INCREMENTAL_ROLLOUT_ENABLED")
......@@ -44,11 +47,19 @@ describe ProjectAutoDevops do
it { expect(auto_devops.predefined_variables).to include(key: 'INCREMENTAL_ROLLOUT_MODE', value: 'timed') }
it { expect(auto_devops.predefined_variables).to include(key: 'AUTO_DEVOPS_EXPLICITLY_ENABLED', value: '1') }
it do
expect(auto_devops.predefined_variables.map { |var| var[:key] })
.not_to include("STAGING_ENABLED", "INCREMENTAL_ROLLOUT_ENABLED")
end
end
context 'when auto-devops is explicitly disabled' do
let(:auto_devops) { build_stubbed(:project_auto_devops, :disabled, project: project) }
it { expect(auto_devops.predefined_variables.to_hash).to be_empty }
end
end
describe '#create_gitlab_deploy_token' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment