Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-10-28 03:09:37 +00:00
parent 0c4afb9f56
commit 3b73b8fffe
12 changed files with 69 additions and 87 deletions

View File

@ -1,7 +1,7 @@
<script> <script>
import { GlFilteredSearchToken } from '@gitlab/ui'; import { GlFilteredSearchToken } from '@gitlab/ui';
import { mapActions } from 'vuex'; import { mapActions } from 'vuex';
import BoardFilteredSearch from '~/boards/components/board_filtered_search.vue'; import BoardFilteredSearch from 'ee_else_ce/boards/components/board_filtered_search.vue';
import { BoardType } from '~/boards/constants'; import { BoardType } from '~/boards/constants';
import issueBoardFilters from '~/boards/issue_board_filters'; import issueBoardFilters from '~/boards/issue_board_filters';
import { TYPE_USER } from '~/graphql_shared/constants'; import { TYPE_USER } from '~/graphql_shared/constants';

View File

@ -10,7 +10,9 @@ Gitlab.ee do
end end
end end
ActiveRecord::Base.establish_connection(Gitlab::Database.main.db_config_with_default_pool_size) unless Gitlab::Utils.to_boolean(ENV["GITLAB_LB_CONFIGURE_CONNECTION"], default: true)
ActiveRecord::Base.establish_connection(Gitlab::Database.main.db_config_with_default_pool_size)
end
Gitlab.ee do Gitlab.ee do
if Gitlab::Runtime.sidekiq? && Gitlab::Geo.geo_database_configured? if Gitlab::Runtime.sidekiq? && Gitlab::Geo.geo_database_configured?

View File

@ -239,8 +239,8 @@ There are two different ways to add a new project to a group:
### Specify who can add projects to a group ### Specify who can add projects to a group
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/2534) in GitLab Premium 10.5. > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/2534) in GitLab 10.5.
> - [Moved](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/25975) to GitLab Free in 11.10. > - [Moved](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/25975) from GitLab Premium to GitLab Free in 11.10.
By default, [Developers and Maintainers](../permissions.md#group-members-permissions) can create projects under a group. By default, [Developers and Maintainers](../permissions.md#group-members-permissions) can create projects under a group.
@ -258,8 +258,7 @@ To change this setting globally, see [Default project creation protection](../ad
## Group activity analytics **(PREMIUM)** ## Group activity analytics **(PREMIUM)**
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/207164) in GitLab 12.10 as > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/207164) in GitLab 12.10 as a [beta feature](https://about.gitlab.com/handbook/product/#beta).
a [beta feature](https://about.gitlab.com/handbook/product/#beta).
For a group, you can view how many merge requests, issues, and members were created in the last 90 days. For a group, you can view how many merge requests, issues, and members were created in the last 90 days.
@ -309,7 +308,7 @@ All the members of the `Engineering` group are added to the `Frontend` group.
> - Enabled on GitLab.com. > - Enabled on GitLab.com.
> - Recommended for production use. > - Recommended for production use.
> - Replaces the existing form with buttons to open a modal window. > - Replaces the existing form with buttons to open a modal window.
> - To use in GitLab self-managed instances, ask a GitLab administrator to [enable it](../project/members/index.md#enable-or-disable-modal-window). **(FREE SELF)** > - To use in GitLab self-managed instances, ask a GitLab administrator to [enable it](../project/members/index.md#enable-or-disable-modal-window).
WARNING: WARNING:
This feature might not be available to you. Check the **version history** note above for details. This feature might not be available to you. Check the **version history** note above for details.
@ -412,7 +411,7 @@ because the project cannot be moved.
## Use a custom name for the initial branch ## Use a custom name for the initial branch
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/43290) in GitLab 13.6. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/43290) in GitLab 13.6.
When you create a new project in GitLab, a default branch is created with the When you create a new project in GitLab, a default branch is created with the
first push. The group owner can first push. The group owner can
@ -432,7 +431,7 @@ This action removes the group. It also adds a background job to delete all proje
Specifically: Specifically:
- In [GitLab 12.8 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/33257), on [Premium](https://about.gitlab.com/pricing/premium/) or higher tiers, this action adds a background job to mark a group for deletion. By default, the job schedules the deletion 7 days in the future. You can modify this waiting period through the [instance settings](../admin_area/settings/visibility_and_access_controls.md#default-deletion-delay). - In [GitLab 12.8 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/33257), on [GitLab Premium](https://about.gitlab.com/pricing/premium/) or higher tiers, this action adds a background job to mark a group for deletion. By default, the job schedules the deletion 7 days in the future. You can modify this waiting period through the [instance settings](../admin_area/settings/visibility_and_access_controls.md#default-deletion-delay).
- In [GitLab 13.6 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/39504), if the user who sets up the deletion is removed from the group before the - In [GitLab 13.6 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/39504), if the user who sets up the deletion is removed from the group before the
deletion happens, the job is cancelled, and the group is no longer scheduled for deletion. deletion happens, the job is cancelled, and the group is no longer scheduled for deletion.
@ -538,8 +537,8 @@ You can export a list of members in a group as a CSV.
## Restrict group access by IP address **(PREMIUM)** ## Restrict group access by IP address **(PREMIUM)**
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/1985) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 12.0. > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/1985) in GitLab 12.0.
> - [Moved](https://gitlab.com/gitlab-org/gitlab/-/issues/215410) to [GitLab Premium](https://about.gitlab.com/pricing/) in 13.1. > - [Moved](https://gitlab.com/gitlab-org/gitlab/-/issues/215410) from GitLab Ultimate to GitLab Premium in 13.1.
To ensure only people from your organization can access particular To ensure only people from your organization can access particular
resources, you can restrict access to groups by IP address. This group-level setting resources, you can restrict access to groups by IP address. This group-level setting
@ -574,7 +573,7 @@ To restrict group access by IP address:
## Restrict group access by domain **(PREMIUM)** ## Restrict group access by domain **(PREMIUM)**
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/7297) in [GitLab Premium](https://about.gitlab.com/pricing/) 12.2. > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/7297) in GitLab 12.2.
> - Support for specifying multiple email domains [added](https://gitlab.com/gitlab-org/gitlab/-/issues/33143) in GitLab 13.1. > - Support for specifying multiple email domains [added](https://gitlab.com/gitlab-org/gitlab/-/issues/33143) in GitLab 13.1.
> - Support for restricting access to projects within the group [added](https://gitlab.com/gitlab-org/gitlab/-/issues/14004) in GitLab 14.1.2. > - Support for restricting access to projects within the group [added](https://gitlab.com/gitlab-org/gitlab/-/issues/14004) in GitLab 14.1.2.
@ -617,7 +616,7 @@ To learn how to create templates for issues and merge requests, see
[Description templates](../project/description_templates.md). [Description templates](../project/description_templates.md).
Define project templates at a group level by setting a group as the template source. Define project templates at a group level by setting a group as the template source.
[Learn more about group-level project templates](custom_project_templates.md). **(PREMIUM)** [Learn more about group-level project templates](custom_project_templates.md).
### Enable group file template **(PREMIUM)** ### Enable group file template **(PREMIUM)**
@ -696,7 +695,7 @@ In GitLab 13.11 and above the group setting for delayed project removal is inher
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/216987) in GitLab 13.3. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/216987) in GitLab 13.3.
By default, projects in a group can be forked. By default, projects in a group can be forked.
Optionally, on [Premium](https://about.gitlab.com/pricing/) or higher tiers, Optionally, on [GitLab Premium](https://about.gitlab.com/pricing/) or higher tiers,
you can prevent the projects in a group from being forked outside of the current top-level group. you can prevent the projects in a group from being forked outside of the current top-level group.
Previously, this setting was available only for groups enforcing a Previously, this setting was available only for groups enforcing a
@ -757,20 +756,20 @@ To view the merge request approval rules UI for a group:
## Related topics ## Related topics
- [Group wikis](../project/wiki/index.md) - [Group wikis](../project/wiki/index.md)
- [Maximum artifacts size](../admin_area/settings/continuous_integration.md#maximum-artifacts-size). **(FREE SELF)** - [Maximum artifacts size](../admin_area/settings/continuous_integration.md#maximum-artifacts-size).
- [Repositories analytics](repositories_analytics/index.md): View overall activity of all projects with code coverage. **(PREMIUM)** - [Repositories analytics](repositories_analytics/index.md): View overall activity of all projects with code coverage.
- [Contribution analytics](contribution_analytics/index.md): View the contributions (pushes, merge requests, - [Contribution analytics](contribution_analytics/index.md): View the contributions (pushes, merge requests,
and issues) of group members. **(PREMIUM)** and issues) of group members.
- [Issue analytics](issues_analytics/index.md): View a bar chart of your group's number of issues per month. **(PREMIUM)** - [Issue analytics](issues_analytics/index.md): View a bar chart of your group's number of issues per month.
- Use GitLab as a [dependency proxy](../packages/dependency_proxy/index.md) for upstream Docker images. - Use GitLab as a [dependency proxy](../packages/dependency_proxy/index.md) for upstream Docker images.
- [Epics](epics/index.md): Track groups of issues that share a theme. **(ULTIMATE)** - [Epics](epics/index.md): Track groups of issues that share a theme.
- [Security Dashboard](../application_security/security_dashboard/index.md): View the vulnerabilities of all - [Security Dashboard](../application_security/security_dashboard/index.md): View the vulnerabilities of all
the projects in a group and its subgroups. **(ULTIMATE)** the projects in a group and its subgroups.
- [Insights](insights/index.md): Configure insights like triage hygiene, issues created/closed per a given period, and - [Insights](insights/index.md): Configure insights like triage hygiene, issues created/closed per a given period, and
average time for merge requests to be merged. **(ULTIMATE)** average time for merge requests to be merged.
- [Webhooks](../project/integrations/webhooks.md). - [Webhooks](../project/integrations/webhooks.md).
- [Kubernetes cluster integration](clusters/index.md). - [Kubernetes cluster integration](clusters/index.md).
- [Audit Events](../../administration/audit_events.md#group-events). **(PREMIUM)** - [Audit Events](../../administration/audit_events.md#group-events).
- [Pipelines quota](../admin_area/settings/continuous_integration.md): Keep track of the pipeline quota for the group. - [Pipelines quota](../admin_area/settings/continuous_integration.md): Keep track of the pipeline quota for the group.
- [Integrations](../admin_area/settings/project_integration_management.md). - [Integrations](../admin_area/settings/project_integration_management.md).
- [Transfer a project into a group](../project/settings/index.md#transferring-an-existing-project-into-another-namespace). - [Transfer a project into a group](../project/settings/index.md#transferring-an-existing-project-into-another-namespace).
@ -778,7 +777,7 @@ To view the merge request approval rules UI for a group:
- [Lock the sharing with group feature](#prevent-a-project-from-being-shared-with-groups). - [Lock the sharing with group feature](#prevent-a-project-from-being-shared-with-groups).
- [Enforce two-factor authentication (2FA)](../../security/two_factor_authentication.md#enforce-2fa-for-all-users-in-a-group): Enforce 2FA - [Enforce two-factor authentication (2FA)](../../security/two_factor_authentication.md#enforce-2fa-for-all-users-in-a-group): Enforce 2FA
for all group members. for all group members.
- Namespaces [API](../../api/namespaces.md) and [Rake tasks](../../raketasks/features.md).. - Namespaces [API](../../api/namespaces.md) and [Rake tasks](../../raketasks/features.md).
## Troubleshooting ## Troubleshooting

View File

@ -242,7 +242,7 @@ On subsequent visits, you should be able to go [sign in to GitLab.com with SAML]
### Configure user settings from SAML response ### Configure user settings from SAML response
[Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/263661) in GitLab 13.7. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/263661) in GitLab 13.7.
GitLab allows setting certain user attributes based on values from the SAML response. GitLab allows setting certain user attributes based on values from the SAML response.
This affects users created on first sign-in via Group SAML. Existing users' This affects users created on first sign-in via Group SAML. Existing users'

View File

@ -7,7 +7,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w
# SCIM provisioning using SAML SSO for GitLab.com groups **(PREMIUM SAAS)** # SCIM provisioning using SAML SSO for GitLab.com groups **(PREMIUM SAAS)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/9388) in GitLab Premium 11.10. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/9388) in GitLab 11.10.
System for Cross-domain Identity Management (SCIM), is an open standard that enables the System for Cross-domain Identity Management (SCIM), is an open standard that enables the
automation of user provisioning. When SCIM is provisioned for a GitLab group, membership of automation of user provisioning. When SCIM is provisioned for a GitLab group, membership of

View File

@ -5,7 +5,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w
type: reference, howto, concepts type: reference, howto, concepts
--- ---
# Subgroups # Subgroups **(FREE)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/2772) in GitLab 9.0. > [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/2772) in GitLab 9.0.

View File

@ -59,6 +59,7 @@ module Gitlab
adapter_name.casecmp('postgresql') == 0 adapter_name.casecmp('postgresql') == 0
end end
# TODO: To be removed with GITLAB_LB_CONFIGURE_CONNECTION
def db_config_with_default_pool_size def db_config_with_default_pool_size
db_config_object = scope.connection_db_config db_config_object = scope.connection_db_config
config = db_config_object config = db_config_object
@ -72,20 +73,6 @@ module Gitlab
) )
end end
# Disables prepared statements for the current database connection.
def disable_prepared_statements
db_config_object = scope.connection_db_config
config = db_config_object.configuration_hash.merge(prepared_statements: false)
hash_config = ActiveRecord::DatabaseConfigurations::HashConfig.new(
db_config_object.env_name,
db_config_object.name,
config
)
scope.establish_connection(hash_config)
end
# Check whether the underlying database is in read-only mode # Check whether the underlying database is in read-only mode
def db_read_only? def db_read_only?
pg_is_in_recovery = pg_is_in_recovery =

View File

@ -14,20 +14,30 @@ module Gitlab
end end
def setup def setup
disable_prepared_statements configure_connection
setup_load_balancer setup_load_balancer
setup_service_discovery setup_service_discovery
end end
def disable_prepared_statements def configure_connection
db_config_object = @model.connection_db_config db_config_object = @model.connection_db_config
config =
db_config_object.configuration_hash.merge(prepared_statements: false) hash =
if Gitlab::Utils.to_boolean(ENV["GITLAB_LB_CONFIGURE_CONNECTION"], default: true)
db_config_object.configuration_hash.merge(
prepared_statements: false,
pool: Gitlab::Database.default_pool_size
)
else
db_config_object.configuration_hash.merge(
prepared_statements: false
)
end
hash_config = ActiveRecord::DatabaseConfigurations::HashConfig.new( hash_config = ActiveRecord::DatabaseConfigurations::HashConfig.new(
db_config_object.env_name, db_config_object.env_name,
db_config_object.name, db_config_object.name,
config hash
) )
@model.establish_connection(hash_config) @model.establish_connection(hash_config)

View File

@ -1,5 +1,5 @@
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import BoardFilteredSearch from '~/boards/components/board_filtered_search.vue'; import BoardFilteredSearch from 'ee_else_ce/boards/components/board_filtered_search.vue';
import IssueBoardFilteredSpec from '~/boards/components/issue_board_filtered_search.vue'; import IssueBoardFilteredSpec from '~/boards/components/issue_board_filtered_search.vue';
import issueBoardFilters from '~/boards/issue_board_filters'; import issueBoardFilters from '~/boards/issue_board_filters';
import { mockTokens } from '../mock_data'; import { mockTokens } from '../mock_data';
@ -9,6 +9,8 @@ jest.mock('~/boards/issue_board_filters');
describe('IssueBoardFilter', () => { describe('IssueBoardFilter', () => {
let wrapper; let wrapper;
const findBoardsFilteredSearch = () => wrapper.findComponent(BoardFilteredSearch);
const createComponent = ({ epicFeatureAvailable = false } = {}) => { const createComponent = ({ epicFeatureAvailable = false } = {}) => {
wrapper = shallowMount(IssueBoardFilteredSpec, { wrapper = shallowMount(IssueBoardFilteredSpec, {
propsData: { fullPath: 'gitlab-org', boardType: 'group' }, propsData: { fullPath: 'gitlab-org', boardType: 'group' },
@ -40,13 +42,13 @@ describe('IssueBoardFilter', () => {
}); });
it('finds BoardFilteredSearch', () => { it('finds BoardFilteredSearch', () => {
expect(wrapper.find(BoardFilteredSearch).exists()).toBe(true); expect(findBoardsFilteredSearch().exists()).toBe(true);
}); });
it('passes the correct tokens to BoardFilteredSearch', () => { it('passes the correct tokens to BoardFilteredSearch', () => {
const tokens = mockTokens(fetchLabelsSpy, fetchAuthorsSpy, wrapper.vm.fetchMilestones); const tokens = mockTokens(fetchLabelsSpy, fetchAuthorsSpy, wrapper.vm.fetchMilestones);
expect(wrapper.find(BoardFilteredSearch).props('tokens')).toEqual(tokens); expect(findBoardsFilteredSearch().props('tokens')).toEqual(tokens);
}); });
}); });
}); });

View File

@ -9,6 +9,7 @@ RSpec.describe 'Database config initializer', :reestablished_active_record_base
before do before do
allow(Gitlab::Runtime).to receive(:max_threads).and_return(max_threads) allow(Gitlab::Runtime).to receive(:max_threads).and_return(max_threads)
stub_env('GITLAB_LB_CONFIGURE_CONNECTION', 'false')
end end
let(:max_threads) { 8 } let(:max_threads) { 8 }
@ -41,6 +42,16 @@ RSpec.describe 'Database config initializer', :reestablished_active_record_base
expect(ActiveRecord::Base.connection_db_config.pool).to eq(18) expect(ActiveRecord::Base.connection_db_config.pool).to eq(18)
end end
context 'when GITLAB_LB_CONFIGURE_CONNECTION=true' do
before do
stub_env('GITLAB_LB_CONFIGURE_CONNECTION', 'true')
end
it 'does not overwrite custom pool settings' do
expect { subject }.not_to change { ActiveRecord::Base.connection_db_config.pool }
end
end
end end
context "when specifying headroom through an ENV variable" do context "when specifying headroom through an ENV variable" do

View File

@ -126,39 +126,6 @@ RSpec.describe Gitlab::Database::Connection do
end end
end end
describe '#disable_prepared_statements', :reestablished_active_record_base do
it 'disables prepared statements' do
connection.scope.establish_connection(
::Gitlab::Database.main.config.merge(prepared_statements: true)
)
expect(connection.scope.connection.prepared_statements).to eq(true)
connection.disable_prepared_statements
expect(connection.scope.connection.prepared_statements).to eq(false)
end
it 'retains the connection name' do
connection.disable_prepared_statements
expect(connection.scope.connection_db_config.name).to eq('main')
end
context 'with dynamic connection pool size' do
before do
connection.scope.establish_connection(connection.config.merge(pool: 7))
end
it 'retains the set pool size' do
connection.disable_prepared_statements
expect(connection.scope.connection.prepared_statements).to eq(false)
expect(connection.scope.connection.pool.size).to eq(7)
end
end
end
describe '#db_read_only?' do describe '#db_read_only?' do
it 'detects a read-only database' do it 'detects a read-only database' do
allow(connection.scope.connection) allow(connection.scope.connection)

View File

@ -7,7 +7,7 @@ RSpec.describe Gitlab::Database::LoadBalancing::Setup do
it 'sets up the load balancer' do it 'sets up the load balancer' do
setup = described_class.new(ActiveRecord::Base) setup = described_class.new(ActiveRecord::Base)
expect(setup).to receive(:disable_prepared_statements) expect(setup).to receive(:configure_connection)
expect(setup).to receive(:setup_load_balancer) expect(setup).to receive(:setup_load_balancer)
expect(setup).to receive(:setup_service_discovery) expect(setup).to receive(:setup_service_discovery)
@ -15,11 +15,11 @@ RSpec.describe Gitlab::Database::LoadBalancing::Setup do
end end
end end
describe '#disable_prepared_statements' do describe '#configure_connection' do
it 'disables prepared statements and reconnects to the database' do it 'configures pool, prepared statements and reconnects to the database' do
config = double( config = double(
:config, :config,
configuration_hash: { host: 'localhost' }, configuration_hash: { host: 'localhost', pool: 2, prepared_statements: true },
env_name: 'test', env_name: 'test',
name: 'main' name: 'main'
) )
@ -27,7 +27,11 @@ RSpec.describe Gitlab::Database::LoadBalancing::Setup do
expect(ActiveRecord::DatabaseConfigurations::HashConfig) expect(ActiveRecord::DatabaseConfigurations::HashConfig)
.to receive(:new) .to receive(:new)
.with('test', 'main', { host: 'localhost', prepared_statements: false }) .with('test', 'main', {
host: 'localhost',
prepared_statements: false,
pool: Gitlab::Database.default_pool_size
})
.and_call_original .and_call_original
# HashConfig doesn't implement its own #==, so we can't directly compare # HashConfig doesn't implement its own #==, so we can't directly compare
@ -36,7 +40,7 @@ RSpec.describe Gitlab::Database::LoadBalancing::Setup do
.to receive(:establish_connection) .to receive(:establish_connection)
.with(an_instance_of(ActiveRecord::DatabaseConfigurations::HashConfig)) .with(an_instance_of(ActiveRecord::DatabaseConfigurations::HashConfig))
described_class.new(model).disable_prepared_statements described_class.new(model).configure_connection
end end
end end