summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2017-09-13 09:00:50 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2017-09-13 09:00:50 +0000
commitda4ca9f44caaa3876d2b6d2021366d2d0e035241 (patch)
treef5ed3b81129c41c6d9bdcec6bf91068a73bfef73
parente19827ab3b9979324b978422978518d86ba3b3a9 (diff)
parentb1d5186d0a2d8ea2b594398fbcfe28acb3e8ed23 (diff)
downloadgitlab-ce-da4ca9f44caaa3876d2b6d2021366d2d0e035241.tar.gz
Merge branch 'zj-feature-flipper-disable-banner' into 'master'
Allow all AutoDevOps banners to be disabled Closes #37653 See merge request !14218
-rw-r--r--app/helpers/auto_devops_helper.rb3
-rw-r--r--changelogs/unreleased/zj-feature-flipper-disable-banner.yml5
-rw-r--r--doc/topics/autodevops/index.md17
-rw-r--r--spec/helpers/auto_devops_helper_spec.rb10
4 files changed, 34 insertions, 1 deletions
diff --git a/app/helpers/auto_devops_helper.rb b/app/helpers/auto_devops_helper.rb
index 4ff38f86b5f..c132daed323 100644
--- a/app/helpers/auto_devops_helper.rb
+++ b/app/helpers/auto_devops_helper.rb
@@ -1,6 +1,7 @@
module AutoDevopsHelper
def show_auto_devops_callout?(project)
- show_callout?('auto_devops_settings_dismissed') &&
+ Feature.get(:auto_devops_banner_disabled).off? &&
+ show_callout?('auto_devops_settings_dismissed') &&
can?(current_user, :admin_pipeline, project) &&
project.has_auto_devops_implicitly_disabled?
end
diff --git a/changelogs/unreleased/zj-feature-flipper-disable-banner.yml b/changelogs/unreleased/zj-feature-flipper-disable-banner.yml
new file mode 100644
index 00000000000..fd5dd1bbe37
--- /dev/null
+++ b/changelogs/unreleased/zj-feature-flipper-disable-banner.yml
@@ -0,0 +1,5 @@
+---
+title: Allow all AutoDevOps banners to be turned off
+merge_request:
+author:
+type: changed
diff --git a/doc/topics/autodevops/index.md b/doc/topics/autodevops/index.md
index babf44d2665..b31b8eaaca0 100644
--- a/doc/topics/autodevops/index.md
+++ b/doc/topics/autodevops/index.md
@@ -323,6 +323,23 @@ container registry. **Restarting a pod, scaling a service, or other actions whic
require on-going access to the registry will fail**. On-going secure access is
planned for a subsequent release.
+## Disable the banner instance wide
+
+If an administrater would like to disable the banners on an instance level, this
+feature can be disabled either through the console:
+
+```basb
+$ gitlab-rails console
+[1] pry(main)> Feature.get(:auto_devops_banner_disabled).disable
+=> true
+```
+
+Or through the HTTP API with the admin access token:
+
+```
+curl --data "value=true" --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/features/auto_devops_banner_disabled
+```
+
## Troubleshooting
- Auto Build and Auto Test may fail in detecting your language/framework. There
diff --git a/spec/helpers/auto_devops_helper_spec.rb b/spec/helpers/auto_devops_helper_spec.rb
index b6d892548ef..80d58ff6bf7 100644
--- a/spec/helpers/auto_devops_helper_spec.rb
+++ b/spec/helpers/auto_devops_helper_spec.rb
@@ -10,6 +10,8 @@ describe AutoDevopsHelper do
before do
allow(helper).to receive(:can?).with(user, :admin_pipeline, project) { allowed }
allow(helper).to receive(:current_user) { user }
+
+ Feature.get(:auto_devops_banner_disabled).disable
end
subject { helper.show_auto_devops_callout?(project) }
@@ -18,6 +20,14 @@ describe AutoDevopsHelper do
it { is_expected.to eq(true) }
end
+ context 'when the banner is disabled by feature flag' do
+ it 'allows the feature flag to disable' do
+ Feature.get(:auto_devops_banner_disabled).enable
+
+ expect(subject).to be(false)
+ end
+ end
+
context 'when dismissed' do
before do
helper.request.cookies[:auto_devops_settings_dismissed] = 'true'