Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2024-02-15 09:11:18 +00:00
parent 755ffed2a9
commit 4838569d51
60 changed files with 276 additions and 68 deletions

View File

@ -0,0 +1,22 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Scan result policy violation data",
"type": "object",
"properties": {
"context": {
"type": "object"
},
"violations": {
"type": "object"
},
"errors": {
"type": "array",
"items": {
"type": "object",
"required": [
"error"
]
}
}
}
}

View File

@ -0,0 +1,9 @@
---
name: use_registry_api_to_list_tags
feature_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/432470
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/143730
rollout_issue_url: https://gitlab.com/gitlab-com/gl-infra/production/-/issues/17527
milestone: '16.10'
group: group::container registry
type: gitlab_com_derisk
default_enabled: false

View File

@ -4,7 +4,7 @@ key_path: counts.instances_assembla_active
description: Count of active instance-level integrations for Assembla
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
time_frame: all

View File

@ -4,7 +4,7 @@ key_path: counts.templates_bamboo_active
description: Count of active service templates for Bamboo CI
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: removed
milestone_removed: '14.4'

View File

@ -4,7 +4,7 @@ key_path: counts.projects_inheriting_bugzilla_active
description: Count of active projects inheriting integrations for Bugzilla
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
time_frame: all

View File

@ -4,7 +4,7 @@ key_path: counts.templates_buildkite_active
description: Count of active service templates for Buildkite
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: removed
milestone_removed: '14.4'

View File

@ -4,7 +4,7 @@ key_path: counts.instances_buildkite_active
description: Count of active instance-level integrations for Buildkite
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
time_frame: all

View File

@ -4,7 +4,7 @@ key_path: counts.groups_inheriting_buildkite_active
description: Count of active groups inheriting integrations for Buildkite
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
time_frame: all

View File

@ -4,7 +4,7 @@ key_path: counts.instances_campfire_active
description: Count of active instance-level integrations for Campfire
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
time_frame: all

View File

@ -4,7 +4,7 @@ key_path: counts.projects_inheriting_campfire_active
description: Count of active projects inheriting integrations for Campfire
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
time_frame: all

View File

@ -4,7 +4,7 @@ key_path: counts.projects_confluence_active
description: Count of projects with active integrations for Confluence
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
time_frame: all

View File

@ -4,7 +4,7 @@ key_path: counts.projects_custom_issue_tracker_active
description: Count of projects with active integrations for a Custom Issue Tracker
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
time_frame: all

View File

@ -4,7 +4,7 @@ key_path: counts.projects_inheriting_custom_issue_tracker_active
description: Count of active projects inheriting integrations for a Custom Issue Tracker
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
time_frame: all

View File

@ -4,7 +4,7 @@ key_path: counts.groups_discord_active
description: Count of groups with active integrations for Discord
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
time_frame: all

View File

@ -4,7 +4,7 @@ key_path: counts.projects_inheriting_discord_active
description: Count of active projects inheriting integrations for Discord
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
time_frame: all

View File

@ -4,7 +4,7 @@ key_path: counts.projects_emails_on_push_active
description: Count of projects with active integrations for Emails on Push
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
time_frame: all

View File

@ -4,7 +4,7 @@ key_path: counts.groups_flowdock_active
description: Count of groups with active integrations for Flowdock
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: removed
removed_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/102394

View File

@ -4,7 +4,7 @@ key_path: counts.templates_flowdock_active
description: Count of active service templates for Flowdock
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: removed
milestone_removed: '14.4'

View File

@ -4,7 +4,7 @@ key_path: counts.projects_hangouts_chat_active
description: Count of projects with active integrations for Hangouts Chat
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
time_frame: all

View File

@ -4,7 +4,7 @@ key_path: counts.projects_inheriting_hipchat_active
description: Count of active projects inheriting integrations for HipChat
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: removed
milestone_removed: '13.11'

View File

@ -4,7 +4,7 @@ key_path: counts.projects_irker_active
description: Count of projects with active integrations for Irker
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
time_frame: all

View File

@ -4,7 +4,7 @@ key_path: counts.projects_inheriting_irker_active
description: Count of active projects inheriting integrations for Irker
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
time_frame: all

View File

@ -4,7 +4,7 @@ key_path: counts.templates_jenkins_active
description: Count of active service templates for Jenkins
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: removed
milestone_removed: '14.4'

View File

@ -4,7 +4,7 @@ key_path: counts.projects_microsoft_teams_active
description: Count of projects with active integrations for Microsoft Teams
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
time_frame: all

View File

@ -4,7 +4,7 @@ key_path: counts.templates_microsoft_teams_active
description: Count of active service templates for Microsoft Teams
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: removed
milestone_removed: '14.4'

View File

@ -4,7 +4,7 @@ key_path: counts.projects_pipelines_email_active
description: Count of projects with active integrations for Pipeline Emails
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
time_frame: all

View File

@ -4,7 +4,7 @@ key_path: counts.groups_pushover_active
description: Count of groups with active integrations for Pushover
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
time_frame: all

View File

@ -4,7 +4,7 @@ key_path: counts.templates_redmine_active
description: Count of active service templates for Redmine
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: removed
milestone_removed: '14.4'

View File

@ -4,7 +4,7 @@ key_path: counts.groups_inheriting_redmine_active
description: Count of active groups inheriting integrations for Redmine
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
time_frame: all

View File

@ -4,7 +4,7 @@ key_path: counts.instances_slack_active
description: Count of active instance-level integrations for Slack
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
time_frame: all

View File

@ -4,7 +4,7 @@ key_path: counts.projects_slack_slash_commands_active
description: Count of projects with active integrations for Slack (slash commands)
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
time_frame: all

View File

@ -4,7 +4,7 @@ key_path: counts.groups_teamcity_active
description: Count of groups with active integrations for Teamcity CI
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
time_frame: all

View File

@ -4,7 +4,7 @@ key_path: counts.groups_inheriting_teamcity_active
description: Count of active groups inheriting integrations for Teamcity CI
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
time_frame: all

View File

@ -4,7 +4,7 @@ key_path: counts.templates_unify_circuit_active
description: Count of active service templates for Unifiy Circuit
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: removed
milestone_removed: '14.4'

View File

@ -4,7 +4,7 @@ key_path: counts.templates_webex_teams_active
description: Count of active service templates for Webex Teams
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: removed
milestone_removed: '14.4'

View File

@ -4,7 +4,7 @@ key_path: counts.instances_webex_teams_active
description: Count of active instance-level integrations for Webex Teams
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
time_frame: all

View File

@ -4,7 +4,7 @@ key_path: counts.groups_inheriting_youtrack_active
description: Count of active groups inheriting integrations for YouTrack
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
time_frame: all

View File

@ -4,7 +4,7 @@ key_path: counts.projects_jira_cloud_active
description: Count of active integrations with Jira Cloud (Saas)
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: removed
time_frame: all

View File

@ -4,7 +4,7 @@ key_path: counts.projects_jira_dvcs_server_active
description: Count of active integrations with Jira Software (DVCS connector)
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
time_frame: all

View File

@ -5,7 +5,7 @@ instrumentation_class: JiraImportsTotalImportedIssuesCountMetric
description: Count of total issues imported via the Jira Importer
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
time_frame: all

View File

@ -4,7 +4,7 @@ key_path: counts.instances_datadog_active
description: Count of active instance-level integrations for Datadog
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
time_frame: all

View File

@ -3,7 +3,7 @@ key_path: counts.projects_gitlab_slack_application_active
description: Count projects with active slack application
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
milestone: "14.3"

View File

@ -3,7 +3,7 @@ key_path: counts.instances_gitlab_slack_application_active
description: Count instances with active slack application
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
milestone: "14.3"

View File

@ -3,7 +3,7 @@ key_path: counts.instances_shimo_active
description: Count of instances with active Shimo integrations
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: removed
removed_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/136143

View File

@ -3,7 +3,7 @@ key_path: counts.projects_inheriting_shimo_active
description: Count of projects that inherit active Shimo integrations
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: removed
removed_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/136143

View File

@ -4,7 +4,7 @@ key_path: counts.projects_harbor_active
description: Count of projects with active integrations for Harbor
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
time_frame: all

View File

@ -3,7 +3,7 @@ key_path: counts.instances_apple_app_store_active
description: Count of instances with active integrations for Apple App Store
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
milestone: "15.8"

View File

@ -3,7 +3,7 @@ key_path: counts.projects_jira_server_deployment_type_active
description: Count of active integrations with Jira Software with server deployment type
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
milestone: "15.9"

View File

@ -3,7 +3,7 @@ key_path: counts.projects_jira_cloud_deployment_type_active
description: Count of active integrations with Jira Software with cloud deployment type
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
milestone: "15.9"

View File

@ -3,7 +3,7 @@ key_path: counts.groups_google_play_active
description: Count of active groups inheriting integrations for Google Play
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
milestone: "15.10"

View File

@ -3,7 +3,7 @@ key_path: counts.projects_inheriting_squash_tm_active
description: Count of active projects inheriting integrations for Squash TM
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
milestone: "15.10"

View File

@ -3,7 +3,7 @@ key_path: counts.groups_inheriting_clickup_active
description: Count of active groups inheriting integrations for ClickUp
product_section: dev
product_stage: manage
product_group: integrations
product_group: import_and_integrate
value_type: number
status: active
milestone: "16.1"

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
class AddAdminCicdVariablesToMemberRoles < Gitlab::Database::Migration[2.2]
milestone '16.9'
milestone '16.10'
enable_lock_retries!

View File

@ -0,0 +1,10 @@
# frozen_string_literal: true
class AddViolationDataToScanResultPolicyViolations < Gitlab::Database::Migration[2.2]
enable_lock_retries!
milestone '16.10'
def change
add_column :scan_result_policy_violations, :violation_data, :jsonb, null: true
end
end

View File

@ -0,0 +1 @@
5f9073fc752c552134286eca244bae41e71a92f62b20328a7601f8ea8ef887dd

View File

@ -15262,7 +15262,8 @@ CREATE TABLE scan_result_policy_violations (
merge_request_id bigint NOT NULL,
project_id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL
updated_at timestamp with time zone NOT NULL,
violation_data jsonb
);
CREATE SEQUENCE scan_result_policy_violations_id_seq

View File

@ -14,9 +14,8 @@ OpenShift helps you to develop, deploy, and manage container-based applications.
## Use OpenShift to run GitLab self-managed
Running GitLab within an OpenShift cluster is officially supported using the GitLab Operator. You can learn more on
[setting up GitLab on OpenShift on the GitLab Operator's documentation](https://docs.gitlab.com/charts/installation/operator.html).
Some components (documented on the GitLab Operator doc) are not supported yet.
You can run GitLab in an OpenShift cluster with the GitLab Operator. For more information about
setting up GitLab on OpenShift, see [GitLab Operator](https://docs.gitlab.com/charts/installation/operator.html).
## Use OpenShift to run a GitLab Runner Fleet

View File

@ -264,11 +264,13 @@ To view group import history:
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/429109) in GitLab 16.6 [with a flag](../../feature_flags.md) named `bulk_import_details_page`. Enabled by default.
> - Feature flag `bulk_import_details_page` removed in GitLab 16.8.
> - Details for partially completed and completed imports [added](https://gitlab.com/gitlab-org/gitlab/-/issues/437874) in GitLab 16.9.
To review the results of an import:
1. Go to the [Group import history page](#group-import-history).
1. To see the details of a failed import, select the **See failures** link on any import with a **Failed** or **Partially completed** status.
1. If the import has a **Partially completed** or **Complete** status, to see which items were and were not imported, select **Details**.
## Migrated group items

View File

@ -9,6 +9,7 @@ module API
REPOSITORY_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(
tag_name: API::NO_SLASH_URL_PART_REGEX)
DEFAULT_PAGE_COUNT = 20
before { authorize_read_container_images! }
@ -72,7 +73,8 @@ module API
success Entities::ContainerRegistry::Tag
failure [
{ code: 401, message: 'Unauthorized' },
{ code: 404, message: 'Not Found' }
{ code: 404, message: 'Not Found' },
{ code: 405, message: 'Method Not Allowed' }
]
is_array true
tags %w[container_registry]
@ -81,13 +83,29 @@ module API
requires :repository_id, type: Integer, desc: 'The ID of the repository'
use :pagination
end
get ':id/registry/repositories/:repository_id/tags', requirements: REPOSITORY_ENDPOINT_REQUIREMENTS do
authorize_read_container_image!
tags = Kaminari.paginate_array(repository.tags)
track_package_event('list_tags', :container, project: user_project, namespace: user_project.namespace)
paginated_tags =
if params[:pagination] == 'keyset'
not_allowed! unless repository.migrated? &&
Feature.enabled?(:use_registry_api_to_list_tags, repository.project, type: :gitlab_com_derisk)
present paginate(tags), with: Entities::ContainerRegistry::Tag
per_page_param = params[:per_page] || DEFAULT_PAGE_COUNT
sort_param = params[:sort] == 'desc' ? '-name' : 'name'
response = repository.tags_page(page_size: per_page_param, sort: sort_param, last: params[:last])
add_next_link_if_next_page_exists(response)
response[:tags]
else
tags = Kaminari.paginate_array(repository.tags)
paginate(tags)
end
track_package_event('list_tags', :container, project: user_project, namespace: user_project.namespace)
present paginated_tags, with: Entities::ContainerRegistry::Tag
end
desc 'Delete repository tags (in bulk)' do
@ -202,6 +220,22 @@ module API
.try_obtain
end
def add_next_link_if_next_page_exists(response)
next_link_uri = response.dig(:pagination, :next, :uri)
return unless next_link_uri.present?
parsed_params = Rack::Utils.parse_query(next_link_uri.query)
next_params = {
per_page: parsed_params['n'],
last: parsed_params['last'],
sort: parsed_params['sort'] == '-name' ? 'desc' : 'asc'
}.compact
Gitlab::Pagination::Keyset::HeaderBuilder
.new(self)
.add_next_page_header(next_params)
end
def repository
@repository ||= user_project.container_repositories.find(params[:repository_id])
end

View File

@ -141,6 +141,22 @@ RSpec.describe API::ProjectContainerRepositories, feature_category: :container_r
describe 'GET /projects/:id/registry/repositories/:repository_id/tags' do
let(:url) { "/projects/#{project.id}/registry/repositories/#{root_repository.id}/tags" }
shared_examples 'returning values correctly' do
it 'returns a list of tags' do
subject
expect(json_response.length).to eq(2)
expect(json_response.map { |repository| repository['name'] }).to eq %w[latest rootA]
end
it 'returns a matching schema' do
subject
expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('registry/tags')
end
end
['using API user', 'using job token'].each do |context|
context context do
include_context context
@ -157,19 +173,133 @@ RSpec.describe API::ProjectContainerRepositories, feature_category: :container_r
end
it_behaves_like 'a package tracking event', described_class.name, 'list_tags'
it_behaves_like 'returning values correctly'
it 'returns a list of tags' do
subject
context 'when pagination is set to keyset' do
let(:url) { "/projects/#{project.id}/registry/repositories/#{root_repository.id}/tags?pagination=keyset" }
expect(json_response.length).to eq(2)
expect(json_response.map { |repository| repository['name'] }).to eq %w[latest rootA]
end
context 'when repository is migrated', :saas do
let_it_be(:tags_response) do
[
{
name: 'latest',
digest: 'sha256:4c8e63ca4cb663ce6c688cb06f1',
config_digest: 'sha256:d7a513a663c1a6dcdba9',
size_bytes: 2319870,
created_at: 1.minute.ago
},
{
name: 'rootA',
digest: 'sha256:4c8e63ca4cb663ce6c688cb06f1',
config_digest: 'sha256:d7a513a663c1a6dcdba9',
size_bytes: 2319871,
created_at: 2.minutes.ago
}
]
end
it 'returns a matching schema' do
subject
let(:pagination) do
{
previous: { uri: URI('/test?before=prev-cursor') },
next: { uri: URI('/test?n=10&sort=-name&last=last-item') }
}
end
expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('registry/tags')
let(:response_body) do
{
pagination: pagination,
response_body: ::Gitlab::Json.parse(tags_response.to_json)
}
end
before do
allow(ContainerRegistry::GitlabApiClient).to receive(:supports_gitlab_api?).and_return(true)
allow_next_instance_of(ContainerRegistry::GitlabApiClient) do |client|
allow(client).to receive(:tags).and_return(response_body)
end
end
using RSpec::Parameterized::TableSyntax
where(:parameter, :per_page, :sort, :last_param) do
"per_page=5" | 5 | 'name' | nil
"last=abc" | 20 | 'name' | 'abc'
"sort=asc" | 20 | 'name' | nil
"sort=desc" | 20 | '-name' | nil
"sort=desc&last=a&per_page=10" | 10 | '-name' | 'a'
end
with_them do
let(:url) { "/projects/#{project.id}/registry/repositories/#{root_repository.id}/tags?pagination=keyset&#{parameter}" }
it "passes the parameters correctly to the Container Registry API" do
expect_next_instance_of(ContainerRegistry::GitlabApiClient) do |client|
expect(client).to receive(:tags).with(
root_repository.path,
page_size: per_page,
sort: sort,
last: last_param,
name: nil,
before: nil,
referrers: nil
)
end
subject
end
end
context 'when the Gitlab API returns a tag' do
it_behaves_like 'returning values correctly'
it_behaves_like 'a package tracking event', described_class.name, 'list_tags'
it 'returns the correct link to the next page' do
subject
expect(response.header['Link']).to include('pagination=keyset')
expect(response.header['Link']).to include('per_page=10')
expect(response.header['Link']).to include('sort=desc')
expect(response.header['Link']).to include('last=last-item')
end
context 'when there is no pagination link returned' do
let(:pagination) { {} }
it 'does not return a Link to the next page' do
subject
expect(response.header).not_to include('Link')
end
end
end
context 'when the Gitlab API does not return a tag' do
let(:tags_response) { [] }
it 'returns an empty array' do
subject
expect(json_response).to be_empty
end
end
end
context 'when the repository is not migrated' do
it 'returns method not allowed' do
subject
expect(response).to have_gitlab_http_status(:method_not_allowed)
end
end
context 'when the feature use_registry_api_to_list_tags is disabled' do
before do
stub_feature_flags(use_registry_api_to_list_tags: false)
end
it 'returns method not allowed' do
subject
expect(response).to have_gitlab_http_status(:method_not_allowed)
end
end
end
end
end