Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2023-01-17 03:07:21 +00:00
parent 73c608b8c9
commit bd37e94aec
15 changed files with 129 additions and 52 deletions

View File

@ -95,7 +95,6 @@ InternalAffairs/DeprecateCopHelper:
- spec/rubocop/**/*.rb
Lint/LastKeywordArgument:
Enabled: true
Safe: false
Lint/EmptyFile:

View File

@ -200,7 +200,7 @@ gem 'diffy', '~> 3.4'
gem 'diff_match_patch', '~> 0.1.0'
# Application server
gem 'rack', '~> 2.2.5'
gem 'rack', '~> 2.2.6'
# https://github.com/zombocom/rack-timeout/blob/master/README.md#rails-apps-manually
gem 'rack-timeout', '~> 0.6.3', require: 'rack/timeout/base'

View File

@ -441,7 +441,7 @@
{"name":"raabro","version":"1.4.0","platform":"ruby","checksum":"d4fa9ff5172391edb92b242eed8be802d1934b1464061ae5e70d80962c5da882"},
{"name":"racc","version":"1.6.1","platform":"java","checksum":"b3e9cc3892367fdd7eeef0c9210e9ab7f54f106b9202ed00efec892367f5bb27"},
{"name":"racc","version":"1.6.1","platform":"ruby","checksum":"c8226cc9788c8a43329b75f031dec9ae0423591534bd04e8a117653a442cc85c"},
{"name":"rack","version":"2.2.5","platform":"ruby","checksum":"724426d0d1dd60f35247024413af93f8e1071c7cfe2c012e59503e5bd7f4b293"},
{"name":"rack","version":"2.2.6","platform":"ruby","checksum":"d903a6529095f624bb7bd3b6b0e29a1aa0fdcd85d476033648d93e7a68760308"},
{"name":"rack-accept","version":"0.4.5","platform":"ruby","checksum":"66247b5449db64ebb93ae2ec4af4764b87d1ae8a7463c7c68893ac13fa8d4da2"},
{"name":"rack-attack","version":"6.6.1","platform":"ruby","checksum":"187e5d248c6a162ed8cafa8241a7b5947d9b9cf122a4870eb1cdd0db861f3a11"},
{"name":"rack-cors","version":"1.1.1","platform":"ruby","checksum":"4702644ac6d63ebbddff372a3cd4cd573513287e3524b5a5415f678970057a4b"},

View File

@ -1111,7 +1111,7 @@ GEM
pyu-ruby-sasl (0.0.3.3)
raabro (1.4.0)
racc (1.6.1)
rack (2.2.5)
rack (2.2.6)
rack-accept (0.4.5)
rack (>= 0.4)
rack-attack (6.6.1)
@ -1781,7 +1781,7 @@ DEPENDENCIES
pry-shell (~> 0.5.1)
puma (~> 5.6.5)
puma_worker_killer (~> 0.3.1)
rack (~> 2.2.5)
rack (~> 2.2.6)
rack-attack (~> 6.6.1)
rack-cors (~> 1.1.1)
rack-oauth2 (~> 1.21.3)

View File

@ -32,6 +32,16 @@ export const config = {
},
},
},
WorkItemWidgetProgress: {
fields: {
progress: {
// We want to show null progress as 0 as per https://gitlab.com/gitlab-org/gitlab/-/issues/386117
read(existing) {
return existing === null ? 0 : existing;
},
},
},
},
WorkItem: {
fields: {
// widgets policy because otherwise the subscriptions invalidate the cache

View File

@ -109,9 +109,7 @@ Example response:
"ssh_url_to_repo": "git@gitlab.example.com:diaspora/diaspora-client.git",
"http_url_to_repo": "https://gitlab.example.com/diaspora/diaspora-client.git",
"web_url": "https://gitlab.example.com/diaspora/diaspora-client",
"readme_url": "https://gitlab.example.com/diaspora/diaspora-client/blob/master/README.md",
"avatar_url": "https://gitlab.example.com/uploads/project/avatar/4/uploads/avatar.png",
"forks_count": 0,
"star_count": 0,
"last_activity_at": "2013-09-30T13:46:02Z",
"namespace": {

View File

@ -59,6 +59,7 @@ Example response:
"ssh_url_to_repo": "ssh://jarka@localhost:2222/twitter/flight.git",
"http_url_to_repo": "http://localhost:3000/twitter/flight.git",
"web_url": "http://localhost:3000/twitter/flight",
"readme_url": "http://localhost:3000/twitter/flight/-/blob/master/README.md",
"avatar_url": null,
"star_count": 0,
"forks_count": 0,
@ -478,6 +479,7 @@ Example response:
"ssh_url_to_repo": "ssh://jarka@localhost:2222/twitter/flight.git",
"http_url_to_repo": "http://localhost:3000/twitter/flight.git",
"web_url": "http://localhost:3000/twitter/flight",
"readme_url": "http://localhost:3000/twitter/flight/-/blob/master/README.md",
"avatar_url": null,
"star_count": 0,
"forks_count": 0,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

View File

@ -31,15 +31,37 @@ If you migrate from GitLab.com to self-managed GitLab, an administrator can crea
FLAG:
On self-managed GitLab, by default [migrating group items](#migrated-group-items) is not available. To show the
feature, ask an administrator to [enable it in application settings](../../admin_area/settings/visibility_and_access_controls.md#enable-migration-of-groups-and-projects-by-direct-transfer).
Also on self-managed GitLab, by default [migrating project items](#migrated-project-items) is not available. To show
Also on self-managed GitLab, by default [migrating project items](#migrated-project-items-beta) is not available. To show
this feature, ask an administrator to [enable the feature flag](../../../administration/feature_flags.md) named
`bulk_import_projects`. The feature is not ready for production use. On GitLab.com, migration of both groups and projects is available.
You can migrate top-level groups to:
- Another top-level group.
- The subgroup of any existing top-level group.
- Another GitLab instance, including GitLab.com.
You can migrate:
- By direct transfer through either the UI or the [API](../../../api/bulk_imports.md).
- Many groups at once.
- With projects (in [Beta](../../../policy/alpha-beta-support.md#beta-features) and not ready for production use) or
without projects.
When you migrate a group by direct transfer, you can also migrate subgroups and projects. When you migrate a group:
- To GitLab.com, all its subgroups and projects are migrated too.
- To a self-managed instance, migrating project items is not available by default. An administrator must
[enable the feature flag](../../../administration/feature_flags.md) named `bulk_import_projects`.
WARNING:
When you migrate a group to GitLab.com, all its subgroups and projects are migrated too. This feature is in [Beta](../../../policy/alpha-beta-support.md#beta-features) and not ready for production use.
On self-managed GitLab, migrating project items is not available by default. To show
this Beta feature, ask an administrator to [enable the feature flag](../../../administration/feature_flags.md) named
`bulk_import_projects`.
Migrating subgroups and projects this way is in [Beta](../../../policy/alpha-beta-support.md#beta-features) and is not
ready for production use.
Not all group and project resources are imported. See list of migrated resources below:
- [Migrated group items](#migrated-group-items).
- [Migrated project items](#migrated-project-items-beta).
Prerequisites:
@ -50,27 +72,6 @@ Prerequisites:
- At least the Maintainer role on the destination group to migrate to. Using the Developer role for this purpose was
[deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/387891) in GitLab 15.8 and will be removed in GitLab 16.0.
You can import top-level groups to:
- Another top-level group.
- The subgroup of any existing top-level group.
- Another GitLab instance, including GitLab.com.
You can migrate:
- By direct transfer using either the UI or the [API](../../../api/bulk_imports.md).
- Many groups at once.
You can migrate:
- With projects - this feature is in [Beta](../../../policy/alpha-beta-support.md#beta-features) and not ready for production use.
- Without projects.
Not all group and project resources are imported. See list of migrated resources below:
- [Migrated group items](#migrated-group-items).
- [Migrated project items](#migrated-project-items).
### Preparation
GitLab maps users and their contributions correctly provided:
@ -108,16 +109,19 @@ Create the group you want to import to and connect the source:
### Select the groups to import
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/385689) in GitLab 15.8, option to import groups with or without projects.
After you have authorized access to the source GitLab instance, you are redirected to the GitLab group
importer page. The top-level groups on the connected source instance you have the Owner role for are listed.
1. By default, the proposed group namespaces match the names as they exist in source instance, but based on your permissions, you can choose to edit these names before you proceed to import any of them.
1. Next to the groups you want to import, select from the dropdown **Import with projects** or **Import without projects**. Remember that importing projects is in [Beta](../../../policy/alpha-beta-support.md#beta-features). This feature is not ready for production use. On self-manage GitLab, if `bulk_import_projects` feature flag is disabled and the feature is not available, select **Import**.
1. Next to the groups you want to import, select either:
- **Import with projects**. Importing groups with projects is in [Beta](../../../policy/alpha-beta-support.md#beta-features). This feature is not ready for production use.
- **Import without projects**.
- **Import** on self-managed GitLab, when the `bulk_import_projects` feature flag is disabled and the feature is not available.
1. The **Status** column shows the import status of each group. If you leave the page open, it updates in real-time.
1. After a group has been imported, select its GitLab path to open its GitLab URL.
![Group Importer page](img/bulk_imports_v14_1.png)
### Group import history
You can view all groups migrated by you by direct transfer listed on the group import history page. This list includes:
@ -169,19 +173,25 @@ Group items that are migrated to the target instance include:
Any other items are **not** migrated.
### Migrated project items
### Migrated project items (beta)
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/267945) in GitLab 14.4 [with a flag](../../feature_flags.md) named `bulk_import_projects`. Disabled by default.
> - [Enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/339941) in GitLab 15.6.
FLAG:
On self-managed GitLab, migrating project resources when migrating groups is not available by default. To make it available ask an administrator to [enable the feature flag](../../../administration/feature_flags.md) named `bulk_import_projects`. On GitLab.com, groups are migrated with all their projects by default.
On self-managed GitLab, migrating project resources when migrating groups is not available by default.
To make it available ask an administrator to [enable the feature flag](../../../administration/feature_flags.md) named
`bulk_import_projects`. On GitLab.com, groups are migrated with all their projects by default.
The [`import_export.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/import_export/project/import_export.yml)
file for projects lists many of the items imported when migrating projects using group migration. View this file in the branch
for your version of GitLab to see the list of items relevant to you. For example,
[`import_export.yml` on the `14-10-stable-ee` branch](https://gitlab.com/gitlab-org/gitlab/-/blob/14-10-stable-ee/lib/gitlab/import_export/project/import_export.yml).
WARNING:
Migrating projects when migrating groups by direct transfer is in [Beta](../../../policy/alpha-beta-support.md#beta-features)
and is not ready for production use.
Project items that are migrated to the target instance include:
- Projects ([Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/267945) in GitLab 14.4)

View File

@ -31,15 +31,16 @@ see the [external status checks epic](https://gitlab.com/groups/gitlab-org/-/epi
## Block merges of merge requests unless all status checks have passed
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/369859) in GitLab 15.5 [with a flag](../../../administration/feature_flags.md) named `only_allow_merge_if_all_status_checks_passed`. Disabled by default.
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/369859) in GitLab 15.5 [with a flag](../../../administration/feature_flags.md) named `only_allow_merge_if_all_status_checks_passed`. Disabled by default.
> - [Enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/372340) in GitLab 15.8.
FLAG:
On self-managed GitLab, by default this feature is not available. To make it available per project or for your entire instance, ask an administrator to
[enable the feature flag](../../../administration/feature_flags.md) named `only_allow_merge_if_all_status_checks_passed`. On GitLab.com, this feature is not available.
[enable the feature flag](../../../administration/feature_flags.md) named `only_allow_merge_if_all_status_checks_passed`. On GitLab.com, this feature is available but can be configured by GitLab.com administrators only.
By default, merge requests in projects can be merged even if external status checks fail. To block the merging of merge requests when external checks fail, enable this feature
using the [project API](../../../api/projects.md#edit-project). You must also [enable the feature flag](../../../administration/feature_flags.md) named
`only_allow_merge_if_all_status_checks_passed`.
`only_allow_merge_if_all_status_checks_passed` on self-managed GitLab.
## Lifecycle

View File

@ -15,7 +15,10 @@ module API
expose :ssh_url_to_repo, documentation: { type: 'string', example: 'git@gitlab.example.com:gitlab/gitlab.git' }
expose :http_url_to_repo, documentation: { type: 'string', example: 'https://gitlab.example.com/gitlab/gitlab.git' }
expose :web_url, documentation: { type: 'string', example: 'https://gitlab.example.com/gitlab/gitlab' }
expose :readme_url, documentation: { type: 'string', example: 'https://gitlab.example.com/gitlab/gitlab/blob/master/README.md' }
with_options if: ->(_, _) { user_has_access_to_project_repository? } do
expose :readme_url, documentation: { type: 'string', example: 'https://gitlab.example.com/gitlab/gitlab/blob/master/README.md' }
expose :forks_count, documentation: { type: 'integer', example: 1 }
end
expose :license_url, if: :license, documentation: { type: 'string', example: 'https://gitlab.example.com/gitlab/gitlab/blob/master/LICENCE' } do |project|
license = project.repository.license_blob
@ -33,7 +36,6 @@ module API
project.avatar_url(only_path: false)
end
expose :forks_count, documentation: { type: 'integer', example: 1 }
expose :star_count, documentation: { type: 'integer', example: 1 }
expose :last_activity_at, documentation: { type: 'dateTime', example: '2013-09-30T13:46:02Z' }
expose :namespace, using: 'API::Entities::NamespaceBasic'
@ -74,6 +76,10 @@ module API
project.topics.pluck(:name).sort # rubocop:disable CodeReuse/ActiveRecord
end
end
def user_has_access_to_project_repository?
Ability.allowed?(options[:current_user], :read_code, project)
end
end
end
end

View File

@ -18,6 +18,8 @@ module RuboCop
KEYWORD_DEPRECATION_STR = 'maybe ** should be added to the call'
def on_send(node)
return if target_ruby_version >= 3.0
arg = get_last_argument(node)
return unless arg
@ -49,13 +51,13 @@ module RuboCop
end
def known_match?(file_path, line_number, method_name)
file_path_from_root = file_path.sub(File.expand_path('../../..', __dir__), '')
file_and_line = "#{file_path_from_root}:#{line_number}"
method_name = 'initialize' if method_name == 'new'
return unless self.class.keyword_warnings[method_name]
file_path_from_root = file_path.sub(File.expand_path('../../..', __dir__), '')
file_and_line = "#{file_path_from_root}:#{line_number}"
self.class.keyword_warnings[method_name].any? do |warning|
warning.include?(file_and_line)
end

View File

@ -14,3 +14,7 @@ Style/MutableConstant:
Enabled: false
Style/RedundantFreeze:
Enabled: false
# No longer needed because Ruby 3.0 will fail due to kwargs issues.
Lint/LastKeywordArgument:
Enabled: false

View File

@ -2,14 +2,16 @@
require 'spec_helper'
RSpec.describe API::Entities::BasicProjectDetails do
let_it_be(:project) { create(:project) }
let(:current_user) { project.first_owner }
RSpec.describe API::Entities::BasicProjectDetails, feature_category: :api do
let_it_be(:project_with_repository_restriction) { create(:project, :public, :repository_private) }
let(:member_user) { project_with_repository_restriction.first_owner }
subject(:output) { described_class.new(project, current_user: current_user).as_json }
describe '#default_branch' do
let(:current_user) { member_user }
let(:project) { project_with_repository_restriction }
it 'delegates to Project#default_branch_or_main' do
expect(project).to receive(:default_branch_or_main).twice.and_call_original
@ -20,7 +22,42 @@ RSpec.describe API::Entities::BasicProjectDetails do
let(:current_user) { nil }
it 'is not included' do
expect(output.keys).not_to include(:default_branch)
expect(output).not_to include(:default_branch)
end
end
end
describe '#readme_url #forks_count' do
using RSpec::Parameterized::TableSyntax
let_it_be(:non_member_user) { create(:user) } # Creates a fresh user that is why it is not the member of the project
context 'public project with repository is accessible by the user' do
let_it_be(:project_without_restriction) { create(:project, :public) }
where(:current_user, :project) do
ref(:member_user) | ref(:project_without_restriction)
ref(:non_member_user) | ref(:project_without_restriction)
nil | ref(:project_without_restriction)
ref(:member_user) | ref(:project_with_repository_restriction)
end
with_them do
it 'exposes readme_url and forks_count' do
expect(output).to include readme_url: project.readme_url, forks_count: project.forks_count
end
end
end
context 'public project with repository is not accessible by the user' do
where(:current_user, :project) do
ref(:non_member_user) | ref(:project_with_repository_restriction)
nil | ref(:project_with_repository_restriction)
end
with_them do
it 'does not expose readme_url and forks_count' do
expect(output).not_to include :readme_url, :forks_count
end
end
end
end

View File

@ -3,7 +3,7 @@
require 'rubocop_spec_helper'
require_relative '../../../../rubocop/cop/lint/last_keyword_argument'
RSpec.describe RuboCop::Cop::Lint::LastKeywordArgument do
RSpec.describe RuboCop::Cop::Lint::LastKeywordArgument, :ruby27, feature_category: :not_owned do
before do
described_class.instance_variable_set(:@keyword_warnings, nil)
allow(Dir).to receive(:glob).and_call_original
@ -156,5 +156,13 @@ RSpec.describe RuboCop::Cop::Lint::LastKeywordArgument do
users.call(params)
SOURCE
end
context 'with Ruby 3.0', :ruby30 do
it 'does not register an offense with known warning' do
expect_no_offenses(<<~SOURCE, 'create_service.rb')
users.call(params)
SOURCE
end
end
end
end