Commit f31cdcd6 authored by Robert Speicher's avatar Robert Speicher

Merge branch '13264-allow-to-set-required_instance_ci_template-as-nil' into 'master'

Allow unsetting "Required pipeline configuration" for CI/CD

See merge request gitlab-org/gitlab!28432
parents a03732ee 9ab201a3
...@@ -192,6 +192,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController ...@@ -192,6 +192,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
params[:application_setting][:import_sources]&.delete("") params[:application_setting][:import_sources]&.delete("")
params[:application_setting][:restricted_visibility_levels]&.delete("") params[:application_setting][:restricted_visibility_levels]&.delete("")
params[:application_setting].delete(:elasticsearch_aws_secret_access_key) if params[:application_setting][:elasticsearch_aws_secret_access_key].blank? params[:application_setting].delete(:elasticsearch_aws_secret_access_key) if params[:application_setting][:elasticsearch_aws_secret_access_key].blank?
params[:application_setting][:required_instance_ci_template] = nil if params[:application_setting][:required_instance_ci_template].blank?
# TODO Remove domain_blacklist_raw in APIv5 (See https://gitlab.com/gitlab-org/gitlab-foss/issues/67204) # TODO Remove domain_blacklist_raw in APIv5 (See https://gitlab.com/gitlab-org/gitlab-foss/issues/67204)
params.delete(:domain_blacklist_raw) if params[:domain_blacklist_file] params.delete(:domain_blacklist_raw) if params[:domain_blacklist_file]
params.delete(:domain_blacklist_raw) if params[:domain_blacklist] params.delete(:domain_blacklist_raw) if params[:domain_blacklist]
......
---
title: Allow unsetting "Required pipeline configuration" for CI/CD
merge_request: 28432
author:
type: fixed
...@@ -153,6 +153,35 @@ describe Admin::ApplicationSettingsController do ...@@ -153,6 +153,35 @@ describe Admin::ApplicationSettingsController do
it_behaves_like 'settings for licensed features' it_behaves_like 'settings for licensed features'
end end
context 'required instance ci template' do
let(:settings) { { required_instance_ci_template: 'Auto-DevOps' } }
let(:feature) { :required_ci_templates }
it_behaves_like 'settings for licensed features'
context 'when ApplicationSetting already has a required_instance_ci_template value' do
before do
ApplicationSetting.current.update!(required_instance_ci_template: 'Auto-DevOps')
end
context 'with a valid value' do
let(:settings) { { required_instance_ci_template: 'Code-Quality' } }
it_behaves_like 'settings for licensed features'
end
context 'with an empty value' do
it 'sets required_instance_ci_template as nil' do
stub_licensed_features(required_ci_templates: true)
put :update, params: { application_setting: { required_instance_ci_template: '' } }
expect(ApplicationSetting.current.required_instance_ci_template).to be_nil
end
end
end
end
it 'updates repository_size_limit' do it 'updates repository_size_limit' do
put :update, params: { application_setting: { repository_size_limit: '100' } } put :update, params: { application_setting: { repository_size_limit: '100' } }
......
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