Commit 36318139 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch '210018-remove-admin-ability-not-to-use-hashed-storage' into 'master'

Remove admin ability not to use Hashed Storage

Closes #210018

See merge request gitlab-org/gitlab!31801
parents 05329dd2 c9aa4585
......@@ -266,6 +266,8 @@ class ApplicationSetting < ApplicationRecord
validates :email_restrictions, untrusted_regexp: true
validates :hashed_storage_enabled, inclusion: { in: [true], message: _("Hashed storage can't be disabled anymore for new projects") }
SUPPORTED_KEY_TYPES.each do |type|
validates :"#{type}_key_restriction", presence: true, key_restriction: { type: type }
end
......
......@@ -6,10 +6,10 @@
%h4= _("Hashed repository storage paths")
.form-group
.form-check
= f.check_box :hashed_storage_enabled, class: 'form-check-input qa-hashed-storage-checkbox'
= f.check_box :hashed_storage_enabled, class: 'form-check-input qa-hashed-storage-checkbox', disabled: @application_setting.hashed_storage_enabled?
= f.label :hashed_storage_enabled, _("Use hashed storage"), class: 'label-bold form-check-label'
.form-text.text-muted
= _("Use hashed storage paths for newly created and renamed repositories. Enable immutable, hash-based paths and repository names to store repositories on disk. This prevents repositories from having to be moved or renamed when the Repository URL changes and may improve disk I/O performance.")
= _("Use hashed storage paths for newly created and renamed repositories. Enable immutable, hash-based paths and repository names to store repositories on disk. This prevents repositories from having to be moved or renamed when the Repository URL changes and may improve disk I/O performance. (Always enabled since 13.0)")
.sub-section
%h4= _("Storage nodes for new repositories")
.form-group
......
---
title: Force hashed storage to always be enabled
merge_request: 31801
author:
type: changed
# frozen_string_literal: true
class EnableHashedStorage < ActiveRecord::Migration[6.0]
DOWNTIME = false
class ApplicationSetting < ActiveRecord::Base
self.table_name = 'application_settings'
end
def up
ApplicationSetting.update_all(hashed_storage_enabled: true)
end
def down
# in 13.0 we are forcing hashed storage to always be enabled for new projects
end
end
......@@ -13823,6 +13823,7 @@ COPY "schema_migrations" (version) FROM STDIN;
20200512085150
20200512164334
20200513160930
20200513171959
20200513234502
20200513235347
20200513235532
......
......@@ -262,7 +262,7 @@ are listed in the descriptions of the relevant settings.
| `grafana_enabled` | boolean | no | Enable Grafana. |
| `grafana_url` | string | no | Grafana URL. |
| `gravatar_enabled` | boolean | no | Enable Gravatar. |
| `hashed_storage_enabled` | boolean | no | Create new projects using hashed storage paths: Enable immutable, hash-based paths and repository names to store repositories on disk. This prevents repositories from having to be moved or renamed when the Project URL changes and may improve disk I/O performance. (EXPERIMENTAL) |
| `hashed_storage_enabled` | boolean | no | Create new projects using hashed storage paths: Enable immutable, hash-based paths and repository names to store repositories on disk. This prevents repositories from having to be moved or renamed when the Project URL changes and may improve disk I/O performance. (Always enabled since 13.0, configuration will be removed in 14.0) |
| `help_page_hide_commercial_content` | boolean | no | Hide marketing-related entries from help. |
| `help_page_support_url` | string | no | Alternate support URL for help page and help dropdown. |
| `help_page_text` | string | no | Custom text displayed on the help page. |
......
......@@ -185,6 +185,9 @@ module API
attrs[:allow_local_requests_from_web_hooks_and_services] = attrs.delete(:allow_local_requests_from_hooks_and_services)
end
# since 13.0 it's not possible to disable hashed storage - support can be removed in 14.0
attrs.delete(:hashed_storage_enabled) if attrs.has_key?(:hashed_storage_enabled)
attrs = filter_attributes_using_license(attrs)
if ApplicationSettings::UpdateService.new(current_settings, current_user, attrs).execute
......
......@@ -11042,6 +11042,9 @@ msgstr ""
msgid "Hashed repository storage paths"
msgstr ""
msgid "Hashed storage can't be disabled anymore for new projects"
msgstr ""
msgid "Have your users email"
msgstr ""
......@@ -23301,7 +23304,7 @@ msgstr ""
msgid "Use hashed storage"
msgstr ""
msgid "Use hashed storage paths for newly created and renamed repositories. Enable immutable, hash-based paths and repository names to store repositories on disk. This prevents repositories from having to be moved or renamed when the Repository URL changes and may improve disk I/O performance."
msgid "Use hashed storage paths for newly created and renamed repositories. Enable immutable, hash-based paths and repository names to store repositories on disk. This prevents repositories from having to be moved or renamed when the Repository URL changes and may improve disk I/O performance. (Always enabled since 13.0)"
msgstr ""
msgid "Use one line per URI"
......
......@@ -103,6 +103,8 @@ describe ApplicationSetting do
it { is_expected.not_to allow_value(10.5).for(:raw_blob_request_limit) }
it { is_expected.not_to allow_value(-1).for(:raw_blob_request_limit) }
it { is_expected.not_to allow_value(false).for(:hashed_storage_enabled) }
context 'grafana_url validations' do
before do
subject.instance_variable_set(:@parsed_grafana_url, nil)
......
......@@ -159,6 +159,14 @@ describe API::Settings, 'Settings' do
expect(json_response['allow_local_requests_from_hooks_and_services']).to eq(true)
end
it 'disables ability to switch to legacy storage' do
put api("/application/settings", admin),
params: { hashed_storage_enabled: false }
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['hashed_storage_enabled']).to eq(true)
end
context 'external policy classification settings' do
let(:settings) 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