Commit e602dd42 authored by Imre Farkas's avatar Imre Farkas

Merge branch 'bbodenmiller-master-patch-01817' into 'master'

Use "read-only" rather than "read only"

See merge request gitlab-org/gitlab!59065
parents 94fbd217 64e3b295
...@@ -114,7 +114,7 @@ module RepositoryStorageMovable ...@@ -114,7 +114,7 @@ module RepositoryStorageMovable
private private
def container_repository_writable def container_repository_writable
add_error(_('is read only')) if container&.repository_read_only? add_error(_('is read-only')) if container&.repository_read_only?
end end
def error_key def error_key
......
...@@ -54,7 +54,7 @@ module Clusters ...@@ -54,7 +54,7 @@ module Clusters
## ##
# If we haven't created a provider record yet, # If we haven't created a provider record yet,
# we restrict ourselves to read only access so # we restrict ourselves to read-only access so
# that we can safely expose credentials to the # that we can safely expose credentials to the
# frontend (to be used when populating the # frontend (to be used when populating the
# creation form). # creation form).
......
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
.text-warning.center.prepend-top-20 .text-warning.center.prepend-top-20
%p %p
= sprite_icon('warning-solid') = sprite_icon('warning-solid')
= _('Archived project! Repository and other project resources are read only') = _('Archived project! Repository and other project resources are read-only')
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
method: :post, class: "gl-button btn btn-confirm" method: :post, class: "gl-button btn btn-confirm"
- else - else
- link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: help_page_path('user/project/settings/index', anchor: 'archiving-a-project') } - link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: help_page_path('user/project/settings/index', anchor: 'archiving-a-project') }
%p= _("Archiving the project will make it entirely read only. It is hidden from the dashboard and doesn't show up in searches. %{strong_start}The repository cannot be committed to, and no issues, comments, or other entities can be created.%{strong_end} %{link_start}Learn more.%{link_end}").html_safe % { strong_start: '<strong>'.html_safe, strong_end: '</strong>'.html_safe, link_start: link_start, link_end: '</a>'.html_safe } %p= _("Archiving the project will make it entirely read-only. It is hidden from the dashboard and doesn't show up in searches. %{strong_start}The repository cannot be committed to, and no issues, comments, or other entities can be created.%{strong_end} %{link_start}Learn more.%{link_end}").html_safe % { strong_start: '<strong>'.html_safe, strong_end: '</strong>'.html_safe, link_start: link_start, link_end: '</a>'.html_safe }
= link_to _('Archive project'), archive_project_path(@project), = link_to _('Archive project'), archive_project_path(@project),
data: { confirm: _("Are you sure that you want to archive this project?"), qa_selector: 'archive_project_link' }, data: { confirm: _("Are you sure that you want to archive this project?"), qa_selector: 'archive_project_link' },
method: :post, class: "gl-button btn btn-warning" method: :post, class: "gl-button btn btn-warning"
...@@ -110,7 +110,7 @@ Gitaly Cluster supports: ...@@ -110,7 +110,7 @@ Gitaly Cluster supports:
- [Strong consistency](praefect.md#strong-consistency) of the secondary replicas. - [Strong consistency](praefect.md#strong-consistency) of the secondary replicas.
- [Automatic failover](praefect.md#automatic-failover-and-primary-election-strategies) from the primary to the secondary. - [Automatic failover](praefect.md#automatic-failover-and-primary-election-strategies) from the primary to the secondary.
- Reporting of possible data loss if replication queue is non-empty. - Reporting of possible data loss if replication queue is non-empty.
- Marking repositories as [read only](praefect.md#read-only-mode) if data loss is detected to prevent data inconsistencies. - Marking repositories as [read-only](praefect.md#read-only-mode) if data loss is detected to prevent data inconsistencies.
Follow the [Gitaly Cluster epic](https://gitlab.com/groups/gitlab-org/-/epics/1489) Follow the [Gitaly Cluster epic](https://gitlab.com/groups/gitlab-org/-/epics/1489)
for improvements including for improvements including
......
...@@ -1440,7 +1440,7 @@ GitLab repositories can be associated with projects, groups, and snippets. Each ...@@ -1440,7 +1440,7 @@ GitLab repositories can be associated with projects, groups, and snippets. Each
have a separate API to schedule the respective repositories to move. To move all repositories have a separate API to schedule the respective repositories to move. To move all repositories
on a GitLab instance, each of these types must be scheduled to move for each storage. on a GitLab instance, each of these types must be scheduled to move for each storage.
Each repository is made read only for the duration of the move. The repository is not writable Each repository is made read-only for the duration of the move. The repository is not writable
until the move has completed. until the move has completed.
After creating and configuring Gitaly Cluster: After creating and configuring Gitaly Cluster:
......
...@@ -947,7 +947,7 @@ To enable the read-only mode: ...@@ -947,7 +947,7 @@ To enable the read-only mode:
sudo gitlab-ctl reconfigure sudo gitlab-ctl reconfigure
``` ```
This command sets the Container Registry into the read only mode. This command sets the Container Registry into the read-only mode.
1. Next, trigger one of the garbage collect commands: 1. Next, trigger one of the garbage collect commands:
......
...@@ -120,7 +120,7 @@ Few notes on the service itself: ...@@ -120,7 +120,7 @@ Few notes on the service itself:
- The service runs under a system account, by default `gitlab-consul`. - The service runs under a system account, by default `gitlab-consul`.
- If you are using a different username, you will have to specify it. We - If you are using a different username, you will have to specify it. We
will refer to it with `CONSUL_USERNAME`, will refer to it with `CONSUL_USERNAME`,
- There will be a database user created with read only access to the repmgr - There will be a database user created with read-only access to the repmgr
database database
- Passwords will be stored in the following locations: - Passwords will be stored in the following locations:
- `/etc/gitlab/gitlab.rb`: hashed - `/etc/gitlab/gitlab.rb`: hashed
......
...@@ -15,7 +15,7 @@ Although branching strategies usually work well enough for source code and ...@@ -15,7 +15,7 @@ Although branching strategies usually work well enough for source code and
plain text because different versions can be merged together, they do not work plain text because different versions can be merged together, they do not work
for binary files. for binary files.
When file locking is setup, lockable files are **read only** by default. When file locking is setup, lockable files are **read-only** by default.
When a file is locked, only the user who locked the file may modify it. This When a file is locked, only the user who locked the file may modify it. This
user is said to "hold the lock" or have "taken the lock", since only one user user is said to "hold the lock" or have "taken the lock", since only one user
......
...@@ -226,7 +226,7 @@ describe('License Management', () => { ...@@ -226,7 +226,7 @@ describe('License Management', () => {
expect(wrapper.find(DeleteConfirmationModal).exists()).toBe(false); expect(wrapper.find(DeleteConfirmationModal).exists()).toBe(false);
}); });
it('renders the read only row', () => { it('renders the read-only row', () => {
expect(wrapper.find(LicenseManagementRow).exists()).toBe(true); expect(wrapper.find(LicenseManagementRow).exists()).toBe(true);
expect(wrapper.find(AdminLicenseManagementRow).exists()).toBe(false); expect(wrapper.find(AdminLicenseManagementRow).exists()).toBe(false);
}); });
......
...@@ -827,7 +827,7 @@ RSpec.describe Group do ...@@ -827,7 +827,7 @@ RSpec.describe Group do
expect { group.saml_discovery_token }.to change { group.reload.read_attribute(:saml_discovery_token) } expect { group.saml_discovery_token }.to change { group.reload.read_attribute(:saml_discovery_token) }
end end
context 'in read only mode' do context 'in read-only mode' do
before do before do
allow(Gitlab::Database).to receive(:read_only?).and_return(true) allow(Gitlab::Database).to receive(:read_only?).and_return(true)
allow(group).to receive(:create_or_update).and_raise(ActiveRecord::ReadOnlyRecord) allow(group).to receive(:create_or_update).and_raise(ActiveRecord::ReadOnlyRecord)
......
...@@ -32,7 +32,7 @@ RSpec.describe Groups::UpdateRepositoryStorageService do ...@@ -32,7 +32,7 @@ RSpec.describe Groups::UpdateRepositoryStorageService do
end end
context 'when the move succeeds' do context 'when the move succeeds' do
it 'moves the repository to the new storage and unmarks the repository as read only', :aggregate_failures do it 'moves the repository to the new storage and unmarks the repository as read-only', :aggregate_failures do
old_path = Gitlab::GitalyClient::StorageSettings.allow_disk_access do old_path = Gitlab::GitalyClient::StorageSettings.allow_disk_access do
wiki.repository.path_to_repo wiki.repository.path_to_repo
end end
......
...@@ -19,7 +19,7 @@ RSpec.shared_examples 'resource with requirement permissions' do ...@@ -19,7 +19,7 @@ RSpec.shared_examples 'resource with requirement permissions' do
it { is_expected.to be_disallowed(:destroy_requirement) } it { is_expected.to be_disallowed(:destroy_requirement) }
end end
shared_examples 'user with read only permissions' do shared_examples 'user with read-only permissions' do
it { is_expected.to be_allowed(:read_requirement) } it { is_expected.to be_allowed(:read_requirement) }
it { is_expected.to be_disallowed(*non_read_permissions) } it { is_expected.to be_disallowed(*non_read_permissions) }
end end
...@@ -32,7 +32,7 @@ RSpec.shared_examples 'resource with requirement permissions' do ...@@ -32,7 +32,7 @@ RSpec.shared_examples 'resource with requirement permissions' do
context 'with admin' do context 'with admin' do
let(:current_user) { admin } let(:current_user) { admin }
it_behaves_like 'user with read only permissions' it_behaves_like 'user with read-only permissions'
end end
context 'with owner' do context 'with owner' do
...@@ -62,13 +62,13 @@ RSpec.shared_examples 'resource with requirement permissions' do ...@@ -62,13 +62,13 @@ RSpec.shared_examples 'resource with requirement permissions' do
context 'with guest' do context 'with guest' do
let(:current_user) { guest } let(:current_user) { guest }
it_behaves_like 'user with read only permissions' it_behaves_like 'user with read-only permissions'
end end
context 'with non member' do context 'with non member' do
let(:current_user) { create(:user) } let(:current_user) { create(:user) }
it_behaves_like 'user with read only permissions' it_behaves_like 'user with read-only permissions'
context 'with private resource parent' do context 'with private resource parent' do
before do before do
...@@ -115,7 +115,7 @@ RSpec.shared_examples 'resource with requirement permissions' do ...@@ -115,7 +115,7 @@ RSpec.shared_examples 'resource with requirement permissions' do
enable_admin_mode!(current_user) enable_admin_mode!(current_user)
end end
it_behaves_like 'user with read only permissions' it_behaves_like 'user with read-only permissions'
end end
end end
...@@ -146,7 +146,7 @@ RSpec.shared_examples 'resource with requirement permissions' do ...@@ -146,7 +146,7 @@ RSpec.shared_examples 'resource with requirement permissions' do
context 'with guest' do context 'with guest' do
let(:current_user) { guest } let(:current_user) { guest }
it_behaves_like 'user with read only permissions' it_behaves_like 'user with read-only permissions'
end end
context 'with non member' do context 'with non member' do
......
...@@ -57,13 +57,13 @@ RSpec.describe UpdateMaxSeatsUsedForGitlabComSubscriptionsWorker do ...@@ -57,13 +57,13 @@ RSpec.describe UpdateMaxSeatsUsedForGitlabComSubscriptionsWorker do
end end
end end
context 'where the DB is read only' do context 'where the DB is read-only' do
let(:db_is_read_only) { true } let(:db_is_read_only) { true }
include_examples 'updates nothing' include_examples 'updates nothing'
end end
context 'when the DB is not read only' do context 'when the DB is not read-only' do
before do before do
gitlab_subscription.update!(subscription_attrs) if subscription_attrs gitlab_subscription.update!(subscription_attrs) if subscription_attrs
end end
......
...@@ -11,7 +11,7 @@ module Gitlab ...@@ -11,7 +11,7 @@ module Gitlab
# This query will read each element in the index matching the project_id filter. # This query will read each element in the index matching the project_id filter.
# If for a project_id has 100_000 issues, all 100_000 elements will be read. # If for a project_id has 100_000 issues, all 100_000 elements will be read.
# #
# A loose index scan will read only one entry from the index for each project_id to reduce the number of disk reads. # A loose index scan will only read one entry from the index for each project_id to reduce the number of disk reads.
# #
# Usage: # Usage:
# #
......
...@@ -4164,16 +4164,13 @@ msgstr "" ...@@ -4164,16 +4164,13 @@ msgstr ""
msgid "Archived in this version" msgid "Archived in this version"
msgstr "" msgstr ""
msgid "Archived project! Repository and other project resources are read only"
msgstr ""
msgid "Archived project! Repository and other project resources are read-only" msgid "Archived project! Repository and other project resources are read-only"
msgstr "" msgstr ""
msgid "Archived projects" msgid "Archived projects"
msgstr "" msgstr ""
msgid "Archiving the project will make it entirely read only. It is hidden from the dashboard and doesn't show up in searches. %{strong_start}The repository cannot be committed to, and no issues, comments, or other entities can be created.%{strong_end} %{link_start}Learn more.%{link_end}" msgid "Archiving the project will make it entirely read-only. It is hidden from the dashboard and doesn't show up in searches. %{strong_start}The repository cannot be committed to, and no issues, comments, or other entities can be created.%{strong_end} %{link_start}Learn more.%{link_end}"
msgstr "" msgstr ""
msgid "Are you ABSOLUTELY SURE you wish to delete this project?" msgid "Are you ABSOLUTELY SURE you wish to delete this project?"
...@@ -38067,7 +38064,7 @@ msgstr "" ...@@ -38067,7 +38064,7 @@ msgstr ""
msgid "is not valid. The iteration group has to match the iteration cadence group." msgid "is not valid. The iteration group has to match the iteration cadence group."
msgstr "" msgstr ""
msgid "is read only" msgid "is read-only"
msgstr "" msgstr ""
msgid "is too long (%{current_value}). The maximum size is %{max_size}." msgid "is too long (%{current_value}). The maximum size is %{max_size}."
......
...@@ -90,7 +90,7 @@ describe('Edit feature flag form', () => { ...@@ -90,7 +90,7 @@ describe('Edit feature flag form', () => {
expect(wrapper.find(GlToggle).props('value')).toBe(true); expect(wrapper.find(GlToggle).props('value')).toBe(true);
}); });
it('should alert users the flag is read only', () => { it('should alert users the flag is read-only', () => {
expect(findAlert().text()).toContain('GitLab is moving to a new way of managing feature flags'); expect(findAlert().text()).toContain('GitLab is moving to a new way of managing feature flags');
}); });
......
...@@ -281,7 +281,7 @@ describe('feature flag form', () => { ...@@ -281,7 +281,7 @@ describe('feature flag form', () => {
}); });
}); });
it('renders read only name', () => { it('renders read-only name', () => {
expect(wrapper.find('.js-scope-all').exists()).toEqual(true); expect(wrapper.find('.js-scope-all').exists()).toEqual(true);
}); });
}); });
......
...@@ -779,7 +779,7 @@ RSpec.describe Gitlab::Auth, :use_clean_rails_memory_store_caching do ...@@ -779,7 +779,7 @@ RSpec.describe Gitlab::Auth, :use_clean_rails_memory_store_caching do
end.not_to change(user, :failed_attempts) end.not_to change(user, :failed_attempts)
end end
context 'when the database is read only' do context 'when the database is read-only' do
before do before do
allow(Gitlab::Database).to receive(:read_only?).and_return(true) allow(Gitlab::Database).to receive(:read_only?).and_return(true)
end end
......
...@@ -395,13 +395,13 @@ RSpec.describe Gitlab::Database do ...@@ -395,13 +395,13 @@ RSpec.describe Gitlab::Database do
allow(ActiveRecord::Base.connection).to receive(:execute).and_call_original allow(ActiveRecord::Base.connection).to receive(:execute).and_call_original
end end
it 'detects a read only database' do it 'detects a read-only database' do
allow(ActiveRecord::Base.connection).to receive(:execute).with('SELECT pg_is_in_recovery()').and_return([{ "pg_is_in_recovery" => "t" }]) allow(ActiveRecord::Base.connection).to receive(:execute).with('SELECT pg_is_in_recovery()').and_return([{ "pg_is_in_recovery" => "t" }])
expect(described_class.db_read_only?).to be_truthy expect(described_class.db_read_only?).to be_truthy
end end
it 'detects a read only database' do it 'detects a read-only database' do
allow(ActiveRecord::Base.connection).to receive(:execute).with('SELECT pg_is_in_recovery()').and_return([{ "pg_is_in_recovery" => true }]) allow(ActiveRecord::Base.connection).to receive(:execute).with('SELECT pg_is_in_recovery()').and_return([{ "pg_is_in_recovery" => true }])
expect(described_class.db_read_only?).to be_truthy expect(described_class.db_read_only?).to be_truthy
......
...@@ -1034,7 +1034,7 @@ RSpec.describe Gitlab::GitAccess do ...@@ -1034,7 +1034,7 @@ RSpec.describe Gitlab::GitAccess do
end end
end end
context 'when the repository is read only' do context 'when the repository is read-only' do
let(:project) { create(:project, :repository, :read_only) } let(:project) { create(:project, :repository, :read_only) }
it 'denies push access' do it 'denies push access' do
......
...@@ -18,7 +18,7 @@ RSpec.describe Boards::Visits::CreateService do ...@@ -18,7 +18,7 @@ RSpec.describe Boards::Visits::CreateService do
expect(service.execute(project_board)).to eq nil expect(service.execute(project_board)).to eq nil
end end
it 'returns nil when database is read only' do it 'returns nil when database is read-only' do
allow(Gitlab::Database).to receive(:read_only?) { true } allow(Gitlab::Database).to receive(:read_only?) { true }
expect(service.execute(project_board)).to eq nil expect(service.execute(project_board)).to eq nil
......
...@@ -87,7 +87,7 @@ RSpec.describe MergeRequests::MergeabilityCheckService, :clean_gitlab_redis_shar ...@@ -87,7 +87,7 @@ RSpec.describe MergeRequests::MergeabilityCheckService, :clean_gitlab_redis_shar
described_class.new(merge_request).async_execute described_class.new(merge_request).async_execute
end end
context 'when read only DB' do context 'when read-only DB' do
before do before do
allow(Gitlab::Database).to receive(:read_only?) { true } allow(Gitlab::Database).to receive(:read_only?) { true }
end end
...@@ -258,7 +258,7 @@ RSpec.describe MergeRequests::MergeabilityCheckService, :clean_gitlab_redis_shar ...@@ -258,7 +258,7 @@ RSpec.describe MergeRequests::MergeabilityCheckService, :clean_gitlab_redis_shar
end end
end end
context 'when read only DB' do context 'when read-only DB' do
it 'returns ServiceResponse.error' do it 'returns ServiceResponse.error' do
allow(Gitlab::Database).to receive(:read_only?) { true } allow(Gitlab::Database).to receive(:read_only?) { true }
......
...@@ -36,7 +36,7 @@ RSpec.describe Projects::UpdateRepositoryStorageService do ...@@ -36,7 +36,7 @@ RSpec.describe Projects::UpdateRepositoryStorageService do
end end
context 'when the move succeeds' do context 'when the move succeeds' do
it 'moves the repository to the new storage and unmarks the repository as read only' do it 'moves the repository to the new storage and unmarks the repository as read-only' do
old_path = Gitlab::GitalyClient::StorageSettings.allow_disk_access do old_path = Gitlab::GitalyClient::StorageSettings.allow_disk_access do
project.repository.path_to_repo project.repository.path_to_repo
end end
......
...@@ -31,7 +31,7 @@ RSpec.describe Snippets::UpdateRepositoryStorageService do ...@@ -31,7 +31,7 @@ RSpec.describe Snippets::UpdateRepositoryStorageService do
end end
context 'when the move succeeds' do context 'when the move succeeds' do
it 'moves the repository to the new storage and unmarks the repository as read only' do it 'moves the repository to the new storage and unmarks the repository as read-only' do
old_path = Gitlab::GitalyClient::StorageSettings.allow_disk_access do old_path = Gitlab::GitalyClient::StorageSettings.allow_disk_access do
snippet.repository.path_to_repo snippet.repository.path_to_repo
end end
......
...@@ -35,7 +35,7 @@ RSpec.shared_examples 'issuable notes filter' do ...@@ -35,7 +35,7 @@ RSpec.shared_examples 'issuable notes filter' do
get :discussions, params: params.merge(notes_filter: notes_filter) get :discussions, params: params.merge(notes_filter: notes_filter)
end end
it 'does not set notes filter when database is in read only mode' do it 'does not set notes filter when database is in read-only mode' do
allow(Gitlab::Database).to receive(:read_only?).and_return(true) allow(Gitlab::Database).to receive(:read_only?).and_return(true)
notes_filter = UserPreference::NOTES_FILTERS[:only_comments] notes_filter = UserPreference::NOTES_FILTERS[:only_comments]
......
...@@ -36,7 +36,7 @@ RSpec.shared_examples 'handles repository moves' do ...@@ -36,7 +36,7 @@ RSpec.shared_examples 'handles repository moves' do
container.set_repository_read_only! container.set_repository_read_only!
expect(subject).not_to be_valid expect(subject).not_to be_valid
expect(subject.errors[error_key].first).to match(/is read only/) expect(subject.errors[error_key].first).to match(/is read-only/)
end end
end end
end end
......
...@@ -47,7 +47,7 @@ RSpec.shared_examples 'moves repository to another storage' do |repository_type| ...@@ -47,7 +47,7 @@ RSpec.shared_examples 'moves repository to another storage' do |repository_type|
expect(original_repository_double).to receive(:remove) expect(original_repository_double).to receive(:remove)
end end
it "moves the project and its #{repository_type} repository to the new storage and unmarks the repository as read only" do it "moves the project and its #{repository_type} repository to the new storage and unmarks the repository as read-only" do
old_project_repository_path = Gitlab::GitalyClient::StorageSettings.allow_disk_access do old_project_repository_path = Gitlab::GitalyClient::StorageSettings.allow_disk_access do
project.repository.path_to_repo project.repository.path_to_repo
end end
......
...@@ -27,7 +27,7 @@ RSpec.shared_examples 'moves repository shard in bulk' do ...@@ -27,7 +27,7 @@ RSpec.shared_examples 'moves repository shard in bulk' do
container.set_repository_read_only! container.set_repository_read_only!
expect(subject).to receive(:log_info) expect(subject).to receive(:log_info)
.with(/Container #{container.full_path} \(#{container.id}\) was skipped: #{container.class} is read only/) .with(/Container #{container.full_path} \(#{container.id}\) was skipped: #{container.class} is read-only/)
expect { subject.execute(source_storage_name, destination_storage_name) } expect { subject.execute(source_storage_name, destination_storage_name) }
.to change(move_service_klass, :count).by(0) .to change(move_service_klass, :count).by(0)
end end
......
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