Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
528b36a16f
commit
8e06c5ffdd
|
|
@ -16,9 +16,9 @@ rspec:artifact-collector as-if-foss:
|
|||
# optional: true
|
||||
- project: "${CI_PROJECT_NAMESPACE}/gitlab-foss"
|
||||
ref: as-if-foss/${CI_COMMIT_REF_NAME}
|
||||
job: rspec:artifact-collector system
|
||||
job: rspec:artifact-collector part-a
|
||||
# optional: true
|
||||
- project: "${CI_PROJECT_NAMESPACE}/gitlab-foss"
|
||||
ref: as-if-foss/${CI_COMMIT_REF_NAME}
|
||||
job: rspec:artifact-collector remainder
|
||||
job: rspec:artifact-collector part-b
|
||||
# optional: true
|
||||
|
|
|
|||
|
|
@ -436,29 +436,29 @@ rspec:artifact-collector unit:
|
|||
- .artifact-collector
|
||||
- .rails:rules:artifact-collector-unit
|
||||
needs:
|
||||
- job: rspec unit pg14 # 32 jobs
|
||||
- job: rspec unit pg14 # 44 jobs
|
||||
optional: true
|
||||
- job: rspec unit clickhouse # 1 job
|
||||
optional: true
|
||||
|
||||
rspec:artifact-collector system:
|
||||
rspec:artifact-collector part-a:
|
||||
extends:
|
||||
- .artifact-collector
|
||||
- .rails:rules:artifact-collector-system
|
||||
- .rails:rules:artifact-collector-part-a
|
||||
needs:
|
||||
- job: rspec system pg14 # 32 jobs
|
||||
optional: true
|
||||
- job: rspec background_migration pg14 # 10 jobs
|
||||
optional: true
|
||||
|
||||
rspec:artifact-collector remainder:
|
||||
rspec:artifact-collector part-b:
|
||||
extends:
|
||||
- .artifact-collector
|
||||
- .rails:rules:artifact-collector-remainder
|
||||
- .rails:rules:artifact-collector-part-b
|
||||
needs:
|
||||
- job: rspec integration pg14 # 16 jobs
|
||||
- job: rspec integration pg14 # 20 jobs
|
||||
optional: true
|
||||
- job: rspec migration pg14 # 15 jobs
|
||||
optional: true
|
||||
- job: rspec background_migration pg14 # 5 jobs
|
||||
- job: rspec migration pg14 # 26 jobs
|
||||
optional: true
|
||||
|
||||
rspec:artifact-collector unit single-redis:
|
||||
|
|
@ -466,7 +466,7 @@ rspec:artifact-collector unit single-redis:
|
|||
- .artifact-collector
|
||||
- .rails:rules:single-redis
|
||||
needs:
|
||||
- job: rspec unit pg14 single-redis # 32 jobs
|
||||
- job: rspec unit pg14 single-redis # 44 jobs
|
||||
optional: true
|
||||
|
||||
rspec:artifact-collector system single-redis:
|
||||
|
|
@ -482,26 +482,32 @@ rspec:artifact-collector remainder single-redis:
|
|||
- .artifact-collector
|
||||
- .rails:rules:single-redis
|
||||
needs:
|
||||
- job: rspec integration pg14 single-redis # 16 jobs
|
||||
- job: rspec integration pg14 single-redis # 20 jobs
|
||||
optional: true
|
||||
|
||||
rspec:artifact-collector ee single-redis:
|
||||
rspec:artifact-collector ee unit single-redis:
|
||||
extends:
|
||||
- .artifact-collector
|
||||
- .rails:rules:single-redis
|
||||
needs:
|
||||
- job: rspec-ee unit pg14 single-redis # 28 jobs
|
||||
- job: rspec-ee unit pg14 single-redis # 39 jobs
|
||||
optional: true
|
||||
- job: rspec-ee integration pg14 single-redis # 7 jobs
|
||||
|
||||
rspec:artifact-collector ee remainder single-redis:
|
||||
extends:
|
||||
- .artifact-collector
|
||||
- .rails:rules:single-redis
|
||||
needs:
|
||||
- job: rspec-ee integration pg14 single-redis # 9 jobs
|
||||
optional: true
|
||||
- job: rspec-ee system pg14 single-redis # 14 jobs
|
||||
- job: rspec-ee system pg14 single-redis # 16 jobs
|
||||
optional: true
|
||||
|
||||
rspec:artifact-collector ee unit:
|
||||
extends:
|
||||
- .artifact-collector
|
||||
needs:
|
||||
- job: rspec-ee unit pg14 # 28 jobs
|
||||
- job: rspec-ee unit pg14 # 39 jobs
|
||||
optional: true
|
||||
rules:
|
||||
- !reference ['.rails:rules:ee-only-unit', rules]
|
||||
|
|
@ -512,13 +518,13 @@ rspec:artifact-collector ee remainder:
|
|||
needs:
|
||||
- job: rspec-ee migration pg14 # 2 jobs
|
||||
optional: true
|
||||
- job: rspec-ee background_migration pg14 # 2 jobs
|
||||
- job: rspec-ee background_migration pg14 # 3 jobs
|
||||
optional: true
|
||||
- job: rspec-ee unit clickhouse # 1 job
|
||||
optional: true
|
||||
- job: rspec-ee integration pg14 # 7 jobs
|
||||
- job: rspec-ee integration pg14 # 9 jobs
|
||||
optional: true
|
||||
- job: rspec-ee system pg14 # 14 jobs
|
||||
- job: rspec-ee system pg14 # 16 jobs
|
||||
optional: true
|
||||
rules:
|
||||
- !reference ['.rails:rules:ee-only-migration', rules]
|
||||
|
|
@ -538,9 +544,9 @@ rspec:coverage:
|
|||
# FOSS/EE jobs
|
||||
- job: rspec:artifact-collector unit
|
||||
optional: true
|
||||
- job: rspec:artifact-collector system
|
||||
- job: rspec:artifact-collector part-a
|
||||
optional: true
|
||||
- job: rspec:artifact-collector remainder
|
||||
- job: rspec:artifact-collector part-b
|
||||
optional: true
|
||||
- job: rspec:artifact-collector unit single-redis
|
||||
optional: true
|
||||
|
|
@ -552,7 +558,9 @@ rspec:coverage:
|
|||
- job: rspec:artifact-collector as-if-foss
|
||||
optional: true
|
||||
# EE jobs
|
||||
- job: rspec:artifact-collector ee single-redis
|
||||
- job: rspec:artifact-collector ee unit single-redis
|
||||
optional: true
|
||||
- job: rspec:artifact-collector ee remainder single-redis
|
||||
optional: true
|
||||
- job: rspec:artifact-collector ee unit
|
||||
optional: true
|
||||
|
|
|
|||
|
|
@ -339,33 +339,51 @@ include:
|
|||
# rspec job parallel configs
|
||||
# Adjusting these parallel job counts has an impact on the
|
||||
# rspec:artifact-collector jobs in .gitlab/ci/rails.gitlab-ci.yml
|
||||
# Please double-check and adjust accordingly
|
||||
# Please double-check and adjust accordingly. At the moment,
|
||||
# each job can only have needs from up to 50 jobs.
|
||||
#
|
||||
# To calculate the number of jobs we need for each RSpec, follow this formula:
|
||||
#
|
||||
# parallel_job_count = ceil(current_job_count * (average_duration / target_duration))
|
||||
#
|
||||
# At the moment, we set the target to 30 minutes
|
||||
#
|
||||
# https://app.snowflake.com/ys68254/gitlab/w2woEkSvsfYa/chart
|
||||
.rspec-migration-parallel:
|
||||
parallel: 15
|
||||
parallel: 26
|
||||
|
||||
# https://app.snowflake.com/ys68254/gitlab/wpUmrAF0RJL/chart
|
||||
.rspec-background-migration-parallel:
|
||||
parallel: 5
|
||||
parallel: 10
|
||||
|
||||
# https://app.snowflake.com/ys68254/gitlab/w4cxPH8ySQlP/chart
|
||||
.rspec-ee-migration-parallel:
|
||||
parallel: 2
|
||||
|
||||
# https://app.snowflake.com/ys68254/gitlab/w20QT8KSVZAi/chart
|
||||
.rspec-ee-background-migration-parallel:
|
||||
parallel: 2
|
||||
parallel: 3
|
||||
|
||||
# https://app.snowflake.com/ys68254/gitlab/w1tkkoZAXSsZ/chart
|
||||
.rspec-unit-parallel:
|
||||
parallel: 32
|
||||
parallel: 44
|
||||
|
||||
# https://app.snowflake.com/ys68254/gitlab/w2GlD4YqHSbO/chart
|
||||
.rspec-ee-unit-parallel:
|
||||
parallel: 28
|
||||
parallel: 39
|
||||
|
||||
# https://app.snowflake.com/ys68254/gitlab/w56UXaCA4xkG/chart
|
||||
.rspec-integration-parallel:
|
||||
parallel: 16
|
||||
parallel: 20
|
||||
|
||||
# https://app.snowflake.com/ys68254/gitlab/w4tXhUkSsFj/chart
|
||||
.rspec-ee-integration-parallel:
|
||||
parallel: 7
|
||||
parallel: 9
|
||||
|
||||
# https://app.snowflake.com/ys68254/gitlab/w3Y3rkdbS25v/chart
|
||||
.rspec-system-parallel:
|
||||
parallel: 32
|
||||
|
||||
# https://app.snowflake.com/ys68254/gitlab/w4zGboX1YRrY/chart
|
||||
.rspec-ee-system-parallel:
|
||||
parallel: 14
|
||||
parallel: 16
|
||||
|
|
|
|||
|
|
@ -1767,6 +1767,7 @@
|
|||
- <<: *if-dot-com-gitlab-org-schedule
|
||||
variables:
|
||||
KNAPSACK_GENERATE_REPORT: "true"
|
||||
PROCESS_TEST_RESULTS: "true"
|
||||
QA_SAVE_TEST_METRICS: "true"
|
||||
QA_EXPORT_TEST_METRICS: "false"
|
||||
allow_failure: true
|
||||
|
|
@ -2323,17 +2324,17 @@
|
|||
- if: '$START_AS_IF_FOSS == "true"'
|
||||
- !reference [".rails:rules:ee-and-foss-unit", rules]
|
||||
|
||||
.rails:rules:artifact-collector-system:
|
||||
.rails:rules:artifact-collector-part-a:
|
||||
rules:
|
||||
- if: '$START_AS_IF_FOSS == "true"'
|
||||
- !reference [".rails:rules:ee-and-foss-system", rules]
|
||||
- !reference ['.rails:rules:ee-and-foss-background-migration', rules]
|
||||
|
||||
.rails:rules:artifact-collector-remainder:
|
||||
.rails:rules:artifact-collector-part-b:
|
||||
rules:
|
||||
- if: '$START_AS_IF_FOSS == "true"'
|
||||
- !reference ['.rails:rules:ee-and-foss-integration', rules]
|
||||
- !reference ['.rails:rules:ee-and-foss-migration', rules]
|
||||
- !reference ['.rails:rules:ee-and-foss-background-migration', rules]
|
||||
|
||||
.rails:rules:detect-tests:
|
||||
rules:
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
e0d259fbab04ca8f84b6ca1f39b4f1fa52361c7d
|
||||
3de800d8941899f2495baa33ea20fb58ff93dd7d
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
#
|
||||
# REQUIRED FIELDS
|
||||
#
|
||||
- title: "Atlassian Crowd OmniAuth provider" # (required) The name of the feature to be deprecated
|
||||
announcement_milestone: "15.3" # (required) The milestone when this feature was first announced as deprecated.
|
||||
removal_milestone: "18.0" # (required) The milestone when this feature is planned to be removed
|
||||
breaking_change: true # (required) If this deprecation is a breaking change, set this value to true
|
||||
reporter: hsutor # (required) GitLab username of the person reporting the deprecation
|
||||
stage: Manage # (required) String value of the stage that the feature was created in. e.g., Growth
|
||||
issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/369117 # (required) Link to the deprecation issue in GitLab
|
||||
body: | # (required) Do not modify this line, instead modify the lines below.
|
||||
The `omniauth_crowd` gem that provides GitLab with the Atlassian Crowd OmniAuth provider will be removed in our
|
||||
next major release, GitLab 18.0. This gem sees very little use and its
|
||||
[lack of compatibility](https://github.com/robdimarco/omniauth_crowd/issues/37) with OmniAuth 2.0 is
|
||||
[blocking our upgrade](https://gitlab.com/gitlab-org/gitlab/-/issues/30073).
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
migration_job_name: BackfillUpstreamPipelinePartitionIdOnPCiBuilds
|
||||
description: # Please capture what BackfillUpstreamPipelinePartitionIdOnPCiBuilds does
|
||||
feature_category: continuous_integration
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/158622
|
||||
milestone: '17.3'
|
||||
queued_migration_version: 20240708105034
|
||||
# Replace with the approximate date you think it's best to ensure the completion of this BBM.
|
||||
finalize_after: '2024-08-22'
|
||||
finalized_by: # version of the migration that finalized this BBM
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddCodeSuggestionsApiRateLimitToApplicationSettings < Gitlab::Database::Migration[2.2]
|
||||
milestone '17.0'
|
||||
milestone '17.2'
|
||||
|
||||
def change
|
||||
add_column :application_settings, :code_suggestions_api_rate_limit, :integer, default: 60, null: false
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddUpstreamPipelinePartitionIdToPCiBuilds < Gitlab::Database::Migration[2.2]
|
||||
milestone '17.3'
|
||||
|
||||
# rubocop:disable Migration/AddColumnsToWideTables -- composable FK
|
||||
def change
|
||||
add_column :p_ci_builds, :upstream_pipeline_partition_id, :bigint
|
||||
end
|
||||
# rubocop:enable Migration/AddColumnsToWideTables
|
||||
end
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class QueueBackfillUpstreamPipelinePartitionIdOnPCiBuilds < Gitlab::Database::Migration[2.2]
|
||||
milestone '17.3'
|
||||
restrict_gitlab_migration gitlab_schema: :gitlab_ci
|
||||
|
||||
MIGRATION = "BackfillUpstreamPipelinePartitionIdOnPCiBuilds"
|
||||
DELAY_INTERVAL = 2.minutes
|
||||
BATCH_SIZE = 1_000
|
||||
SUB_BATCH_SIZE = 100
|
||||
|
||||
def up
|
||||
queue_batched_background_migration(
|
||||
MIGRATION,
|
||||
:p_ci_builds,
|
||||
:upstream_pipeline_id,
|
||||
batch_class_name: 'LooseIndexScanBatchingStrategy',
|
||||
job_interval: DELAY_INTERVAL,
|
||||
batch_size: BATCH_SIZE,
|
||||
sub_batch_size: SUB_BATCH_SIZE
|
||||
)
|
||||
end
|
||||
|
||||
def down
|
||||
delete_batched_background_migration(MIGRATION, :p_ci_builds, :upstream_pipeline_id, [])
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1 @@
|
|||
f44cf2abd285e9ac420c926b1f4daeeddcbd4bb048d0d1c75329d11c0434b2f7
|
||||
|
|
@ -0,0 +1 @@
|
|||
cf6cbca050e00abce963c37fdaa28e4732201ceb5b18f6becb8ca592a1b421cd
|
||||
|
|
@ -2197,6 +2197,7 @@ CREATE TABLE p_ci_builds (
|
|||
upstream_pipeline_id bigint,
|
||||
user_id bigint,
|
||||
execution_config_id bigint,
|
||||
upstream_pipeline_partition_id bigint,
|
||||
CONSTRAINT check_1e2fbd1b39 CHECK ((lock_version IS NOT NULL))
|
||||
)
|
||||
PARTITION BY LIST (partition_id);
|
||||
|
|
@ -7514,6 +7515,7 @@ CREATE TABLE ci_builds (
|
|||
upstream_pipeline_id bigint,
|
||||
user_id bigint,
|
||||
execution_config_id bigint,
|
||||
upstream_pipeline_partition_id bigint,
|
||||
CONSTRAINT check_1e2fbd1b39 CHECK ((lock_version IS NOT NULL))
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -298,6 +298,47 @@ result in `403 Forbidden` responses from GitLab.com.
|
|||
|
||||
For more information on authentication request limits, see [Git and container registry failed authentication ban](../user/gitlab_com/index.md#git-and-container-registry-failed-authentication-ban).
|
||||
|
||||
### Identify expired access tokens from logs
|
||||
|
||||
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/464652) in GitLab 17.2.
|
||||
|
||||
Prerequisites:
|
||||
|
||||
You must:
|
||||
|
||||
- Be an administrator.
|
||||
- Have access to the [`api_json.log`](../administration/logs/index.md#api_jsonlog) file.
|
||||
|
||||
To identify which `401 Unauthorized` requests are failing due to
|
||||
expired access tokens, use the following fields in the `api_json.log` file:
|
||||
|
||||
|Field name|Description|
|
||||
|----------|-----------|
|
||||
|`meta.auth_fail_reason`|The reason the request was rejected. Possible values: `token_expired`, `token_revoked`, `insufficient_scope`, and `impersonation_disabled`.|
|
||||
|`meta.auth_fail_token_id`|A string describing the type and ID of the attempted token.|
|
||||
|
||||
When a user attempts to use an expired token, the `meta.auth_fail_reason`
|
||||
is `token_expired`. The following shows an excerpt from a log
|
||||
entry:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": 401,
|
||||
"method": "GET",
|
||||
"path": "/api/v4/user",
|
||||
...
|
||||
"meta.auth_fail_reason": "token_expired",
|
||||
"meta.auth_fail_token_id": "PersonalAccessToken/12",
|
||||
}
|
||||
```
|
||||
|
||||
`meta.auth_fail_token_id` indicates that an access token of ID 12 was used.
|
||||
|
||||
To find more information about this token, use the [personal access token API](../api/personal_access_tokens.md#get-single-personal-access-token).
|
||||
You can also use the API to [rotate the token](../api/personal_access_tokens.md#rotate-a-personal-access-token).
|
||||
|
||||
### Replace expired access tokens
|
||||
|
||||
To replace the token:
|
||||
|
||||
1. Check where this token may have been used previously, and remove it from any
|
||||
|
|
|
|||
|
|
@ -101,23 +101,6 @@ automatically from GitLab 16.0 onwards.
|
|||
|
||||
<div class="deprecation breaking-change" data-milestone="18.0">
|
||||
|
||||
### Atlassian Crowd OmniAuth provider
|
||||
|
||||
<div class="deprecation-notes">
|
||||
- Announced in GitLab <span class="milestone">15.3</span>
|
||||
- Removal in GitLab <span class="milestone">18.0</span> ([breaking change](https://docs.gitlab.com/ee/update/terminology.html#breaking-change))
|
||||
- To discuss this change or learn more, see the [deprecation issue](https://gitlab.com/gitlab-org/gitlab/-/issues/369117).
|
||||
</div>
|
||||
|
||||
The `omniauth_crowd` gem that provides GitLab with the Atlassian Crowd OmniAuth provider will be removed in our
|
||||
next major release, GitLab 18.0. This gem sees very little use and its
|
||||
[lack of compatibility](https://github.com/robdimarco/omniauth_crowd/issues/37) with OmniAuth 2.0 is
|
||||
[blocking our upgrade](https://gitlab.com/gitlab-org/gitlab/-/issues/30073).
|
||||
|
||||
</div>
|
||||
|
||||
<div class="deprecation breaking-change" data-milestone="18.0">
|
||||
|
||||
### Behavior change for protected variables and multi-project pipelines
|
||||
|
||||
<div class="deprecation-notes">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Gitlab
|
||||
module BackgroundMigration
|
||||
class BackfillUpstreamPipelinePartitionIdOnPCiBuilds < BatchedMigrationJob
|
||||
operation_name :update_all
|
||||
feature_category :continuous_integration
|
||||
|
||||
def perform
|
||||
distinct_each_batch do |batch|
|
||||
pipeline_ids = batch.pluck(batch_column)
|
||||
base_relation
|
||||
.where(batch_column => pipeline_ids)
|
||||
.where('p_ci_builds.upstream_pipeline_id = ci_pipelines.id')
|
||||
.update_all('upstream_pipeline_partition_id = ci_pipelines.partition_id FROM ci_pipelines')
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def base_relation
|
||||
define_batchable_model(batch_table, connection: connection, primary_key: :id)
|
||||
.where(batch_column => start_id..end_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -432,7 +432,7 @@ module Gitlab
|
|||
@committer_name = commit.committer.name.dup
|
||||
@committer_email = commit.committer.email.dup
|
||||
@parent_ids = Array(commit.parent_ids)
|
||||
@trailers = commit.trailers.to_h { |t| [t.key, t.value] }
|
||||
@trailers = commit.trailers.to_h { |t| [t.key, encode!(t.value)] }
|
||||
@extended_trailers = parse_commit_trailers(commit.trailers)
|
||||
@referenced_by = Array(commit.referenced_by)
|
||||
end
|
||||
|
|
@ -440,7 +440,7 @@ module Gitlab
|
|||
# Turn the commit trailers into a hash of key: [value, value] arrays
|
||||
def parse_commit_trailers(trailers)
|
||||
trailers.each_with_object({}) do |trailer, hash|
|
||||
(hash[trailer.key] ||= []) << trailer.value
|
||||
(hash[trailer.key] ||= []) << encode!(trailer.value)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
module Gitlab
|
||||
class WikiFileFinder < FileFinder
|
||||
extend ::Gitlab::Utils::Override
|
||||
|
||||
attr_reader :repository
|
||||
|
||||
def initialize(project, ref)
|
||||
|
|
@ -12,12 +14,24 @@ module Gitlab
|
|||
|
||||
private
|
||||
|
||||
override :search_paths
|
||||
def search_paths(query)
|
||||
safe_query = Regexp.escape(query.tr(' ', '-'))
|
||||
safe_query = Regexp.new(safe_query, Regexp::IGNORECASE)
|
||||
paths = repository.ls_files(ref)
|
||||
paths.select { |path| valid_format_wiki_file?(path) }.grep(safe_query)
|
||||
end
|
||||
|
||||
paths.grep(safe_query)
|
||||
override :find_by_content
|
||||
def find_by_content(query, options)
|
||||
repository.search_files_by_content(query, ref, options).filter_map do |result|
|
||||
blob = Gitlab::Search::FoundBlob.new(content_match: result, project: project, ref: ref, repository: repository)
|
||||
blob if valid_format_wiki_file?(blob.path)
|
||||
end
|
||||
end
|
||||
|
||||
def valid_format_wiki_file?(path)
|
||||
Wiki::MARKUPS.values.pluck(:extension_regex).any? { |regex| regex.match?(path) } # rubocop: disable CodeReuse/ActiveRecord -- Not an ActiveRecord
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ module QA
|
|||
end.not_to raise_error
|
||||
end
|
||||
|
||||
it 'can be used to commit via the API',
|
||||
it 'can be used to commit via the API', :blocking,
|
||||
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347859' do
|
||||
expect do
|
||||
create(:commit,
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ RSpec.describe 'Database schema', feature_category: :database do
|
|||
broadcast_messages: %w[namespace_id],
|
||||
chat_names: %w[chat_id team_id user_id],
|
||||
chat_teams: %w[team_id],
|
||||
ci_builds: %w[project_id runner_id user_id erased_by_id trigger_request_id partition_id auto_canceled_by_partition_id execution_config_id],
|
||||
ci_builds: %w[project_id runner_id user_id erased_by_id trigger_request_id partition_id auto_canceled_by_partition_id execution_config_id upstream_pipeline_partition_id],
|
||||
ci_daily_build_group_report_results: %w[partition_id],
|
||||
ci_job_artifacts: %w[partition_id project_id job_id],
|
||||
ci_namespace_monthly_usages: %w[namespace_id],
|
||||
|
|
@ -129,7 +129,7 @@ RSpec.describe 'Database schema', feature_category: :database do
|
|||
oauth_access_tokens: %w[resource_owner_id application_id],
|
||||
oauth_applications: %w[owner_id],
|
||||
oauth_device_grants: %w[resource_owner_id application_id],
|
||||
p_ci_builds: %w[erased_by_id trigger_request_id partition_id auto_canceled_by_partition_id execution_config_id],
|
||||
p_ci_builds: %w[erased_by_id trigger_request_id partition_id auto_canceled_by_partition_id execution_config_id upstream_pipeline_partition_id],
|
||||
p_batched_git_ref_updates_deletions: %w[project_id partition_id],
|
||||
p_catalog_resource_sync_events: %w[catalog_resource_id project_id partition_id],
|
||||
p_catalog_resource_component_usages: %w[used_by_project_id], # No FK constraint because we want to preserve historical usage data
|
||||
|
|
|
|||
|
|
@ -0,0 +1,60 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
RSpec.describe Gitlab::BackgroundMigration::BackfillUpstreamPipelinePartitionIdOnPCiBuilds, feature_category: :continuous_integration do
|
||||
let(:pipelines_table) { table(:ci_pipelines, database: :ci) { |t| t.primary_key = :id } }
|
||||
let(:jobs_table) { table(:p_ci_builds, database: :ci) { |t| t.primary_key = :id } }
|
||||
|
||||
let!(:pipeline_1) { pipelines_table.create!(partition_id: 100, project_id: 1) }
|
||||
let!(:pipeline_2) { pipelines_table.create!(partition_id: 100, project_id: 1) }
|
||||
let!(:pipeline_3) { pipelines_table.create!(partition_id: 100, project_id: 1) }
|
||||
|
||||
let!(:job_1) { jobs_table.create!(commit_id: pipeline_1.id, partition_id: pipeline_1.partition_id, project_id: 1) }
|
||||
let!(:job_2) { jobs_table.create!(commit_id: pipeline_2.id, partition_id: pipeline_2.partition_id, project_id: 1) }
|
||||
let!(:job_3) { jobs_table.create!(commit_id: pipeline_2.id, partition_id: pipeline_2.partition_id, project_id: 1) }
|
||||
|
||||
let(:migration_attrs) do
|
||||
{
|
||||
start_id: jobs_table.minimum(:upstream_pipeline_id),
|
||||
end_id: jobs_table.maximum(:upstream_pipeline_id),
|
||||
batch_table: :p_ci_builds,
|
||||
batch_column: :upstream_pipeline_id,
|
||||
sub_batch_size: 2,
|
||||
pause_ms: 0,
|
||||
connection: connection
|
||||
}
|
||||
end
|
||||
|
||||
let!(:migration) { described_class.new(**migration_attrs) }
|
||||
let(:connection) { Ci::ApplicationRecord.connection }
|
||||
|
||||
around do |example|
|
||||
connection.transaction do
|
||||
connection.execute(<<~SQL)
|
||||
ALTER TABLE ci_pipelines DISABLE TRIGGER ALL;
|
||||
SQL
|
||||
|
||||
example.run
|
||||
|
||||
connection.execute(<<~SQL)
|
||||
ALTER TABLE ci_pipelines ENABLE TRIGGER ALL;
|
||||
SQL
|
||||
end
|
||||
end
|
||||
|
||||
describe '#perform' do
|
||||
before do
|
||||
job_2.update!(upstream_pipeline_id: pipeline_1.id)
|
||||
job_3.update!(upstream_pipeline_id: pipeline_3.id)
|
||||
pipeline_3.update!(partition_id: 101)
|
||||
end
|
||||
|
||||
it 'backfills upstream_pipeline_partition_id' do
|
||||
expect { migration.perform }
|
||||
.to not_change { job_1.reload.upstream_pipeline_partition_id }
|
||||
.and change { job_2.reload.upstream_pipeline_partition_id }.from(nil).to(100)
|
||||
.and change { job_3.reload.upstream_pipeline_partition_id }.from(nil).to(101)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -51,6 +51,30 @@ RSpec.describe Gitlab::Git::Commit, feature_category: :source_code_management do
|
|||
)
|
||||
end
|
||||
|
||||
context 'non-ASCII content' do
|
||||
let(:body) do
|
||||
body = +<<~BODY
|
||||
Äpfel
|
||||
|
||||
Changelog: Äpfel
|
||||
BODY
|
||||
|
||||
[subject, "\n", body.force_encoding("ASCII-8BIT")].join
|
||||
end
|
||||
|
||||
it "parses non-ASCII commit trailers" do
|
||||
expect(commit.trailers).to eq(
|
||||
{ 'Changelog' => 'Äpfel' }
|
||||
)
|
||||
end
|
||||
|
||||
it "parses non-ASCII extended commit trailers" do
|
||||
expect(commit.extended_trailers).to eq(
|
||||
{ 'Changelog' => ['Äpfel'] }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context 'non-UTC dates' do
|
||||
let(:seconds) { Time.now.to_i }
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require 'spec_helper'
|
||||
|
||||
RSpec.describe Gitlab::WikiFileFinder do
|
||||
RSpec.describe Gitlab::WikiFileFinder, feature_category: :global_search do
|
||||
describe '#find' do
|
||||
let_it_be(:project) do
|
||||
create(:project, :public, :wiki_repo).tap do |project|
|
||||
|
|
@ -17,5 +17,10 @@ RSpec.describe Gitlab::WikiFileFinder do
|
|||
let(:expected_file_by_path) { 'Files/Title.md' }
|
||||
let(:expected_file_by_content) { 'CHANGELOG.md' }
|
||||
end
|
||||
|
||||
it 'does not include .gitlab/redirects.yml' do
|
||||
results = described_class.new(project, project.wiki.default_branch).find(Wiki::REDIRECTS_YML)
|
||||
expect(results.map(&:blob_path)).not_to include Wiki::REDIRECTS_YML
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
require_migration!
|
||||
|
||||
RSpec.describe QueueBackfillUpstreamPipelinePartitionIdOnPCiBuilds, migration: :gitlab_ci, feature_category: :continuous_integration do
|
||||
let!(:batched_migration) { described_class::MIGRATION }
|
||||
|
||||
it 'schedules a new batched migration' do
|
||||
reversible_migration do |migration|
|
||||
migration.before -> {
|
||||
expect(batched_migration).not_to have_scheduled_batched_migration
|
||||
}
|
||||
|
||||
migration.after -> {
|
||||
expect(batched_migration).to have_scheduled_batched_migration(
|
||||
table_name: :p_ci_builds,
|
||||
column_name: :upstream_pipeline_id,
|
||||
gitlab_schema: :gitlab_ci,
|
||||
interval: described_class::DELAY_INTERVAL,
|
||||
batch_size: described_class::BATCH_SIZE,
|
||||
sub_batch_size: described_class::SUB_BATCH_SIZE
|
||||
)
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -92,7 +92,8 @@ RSpec.describe Ci::Processable, feature_category: :continuous_integration do
|
|||
runner_id tag_taggings taggings tags trigger_request_id
|
||||
user_id auto_canceled_by_id retried failure_reason
|
||||
sourced_pipelines sourced_pipeline artifacts_file_store artifacts_metadata_store
|
||||
metadata runner_manager_build runner_manager runner_session trace_chunks upstream_pipeline_id
|
||||
metadata runner_manager_build runner_manager runner_session trace_chunks
|
||||
upstream_pipeline_id upstream_pipeline_partition_id
|
||||
artifacts_file artifacts_metadata artifacts_size commands
|
||||
resource resource_group_id processed security_scans author
|
||||
pipeline_id report_results pending_state pages_deployments
|
||||
|
|
|
|||
Loading…
Reference in New Issue