Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-03-25 18:07:24 +00:00
parent aeea252f44
commit c05f1d2fbb
12 changed files with 100 additions and 26 deletions

View file

@ -33,15 +33,25 @@ qa:selectors:
script:
- bundle exec bin/qa Test::Sanity::Selectors
qa:auto_quarantine:
qa:master-auto-quarantine-dequarantine:
extends:
- .qa-job-base
rules:
- if: '$QA_TRIGGER_AUTO_QUARANTINE =~ /true|yes|1/i'
script:
- bundle exec confiner -r .confiner/quarantine.yml
- bundle exec confiner -r .confiner/master.yml
allow_failure: true
qa:nightly-auto-quarantine-dequarantine:
extends:
- .qa-job-base
rules:
- if: '$QA_TRIGGER_AUTO_QUARANTINE =~ /true|yes|1/i'
script:
- bundle exec confiner -r .confiner/nightly.yml
allow_failure: true
qa:selectors-as-if-foss:
extends:
- qa:selectors

View file

@ -0,0 +1,17 @@
# frozen_string_literal: true
class AddMigrationPlanIndexToContainerRepositories < Gitlab::Database::Migration[1.0]
INDEX_NAME = 'idx_container_repos_on_migration_state_migration_plan_created'
disable_ddl_transaction!
def up
add_concurrent_index :container_repositories,
[:migration_state, :migration_plan, :created_at],
name: INDEX_NAME
end
def down
remove_concurrent_index_by_name :container_repositories, INDEX_NAME
end
end

View file

@ -0,0 +1,15 @@
# frozen_string_literal: true
class PrepareIndexForCiJobArtifactsUnlockedWithExpireAt < Gitlab::Database::Migration[1.0]
TABLE_NAME = 'ci_job_artifacts'
INDEX_NAME = 'index_ci_job_artifacts_on_expire_at_for_removal'
CONDITIONS = 'locked = 0 AND expire_at IS NOT NULL'
def up
prepare_async_index TABLE_NAME, [:expire_at], where: CONDITIONS, name: INDEX_NAME
end
def down
unprepare_async_index_by_name TABLE_NAME, INDEX_NAME
end
end

View file

@ -0,0 +1 @@
b37315953ac3cdc6d75f5287a4c264ebdee932f19cfe975f5d2c57b353da35d9

View file

@ -0,0 +1 @@
fd738cf8a5642f96dc67a294dcf913d797b580a19f35d5ef76573c63bf2dd920

View file

@ -26472,6 +26472,8 @@ CREATE INDEX idx_container_repos_on_exp_cleanup_status_project_id_start_date ON
CREATE INDEX idx_container_repos_on_import_started_at_when_importing ON container_repositories USING btree (migration_import_started_at) WHERE (migration_state = 'importing'::text);
CREATE INDEX idx_container_repos_on_migration_state_migration_plan_created ON container_repositories USING btree (migration_state, migration_plan, created_at);
CREATE INDEX idx_container_repos_on_pre_import_done_at_when_pre_import_done ON container_repositories USING btree (migration_pre_import_done_at) WHERE (migration_state = 'pre_import_done'::text);
CREATE INDEX idx_container_repos_on_pre_import_started_at_when_pre_importing ON container_repositories USING btree (migration_pre_import_started_at) WHERE (migration_state = 'pre_importing'::text);

View file

@ -7,9 +7,8 @@ disqus_identifier: 'https://docs.gitlab.com/ee/workflow/repository_mirroring.htm
# Repository mirroring **(FREE)**
You can _mirror_ a repository to and from external sources. You can select which
repository serves as the source, and modify which parts of the repository are copied.
Branches, tags, and commits can be mirrored.
You can _mirror_ a repository to and from external sources. You can select which repository
serves as the source. Branches, tags, and commits can be mirrored.
Several mirroring methods exist:
@ -23,11 +22,7 @@ Mirror a repository when:
copy of your project at its previous home, configure your GitLab repository as a
[push mirror](push.md). Changes you make to your GitLab repository are copied to
the old location.
- Your GitLab project is private, but some components can be shared publicly.
Configure your primary repository as a [push mirror](push.md) and push the portions
you want to make public. With this configuration, you can open-source specific
projects, contribute back to the open-source community, and protect the sensitive
parts of your project.
- Your GitLab instance is private, but you want to open-source some projects.
- You migrated to GitLab, but the canonical version of your project is somewhere else.
Configure your GitLab repository as a [pull mirror](pull.md) of the other project.
Your GitLab repository pulls copies of the commits, tags, and branches of project.

View file

@ -2,6 +2,17 @@
module ContainerRegistry
module Migration
# Some container repositories do not have a plan associated with them, they will be imported with
# the free tiers
FREE_TIERS = ['free', 'early_adopter', nil].freeze
PREMIUM_TIERS = %w[premium bronze silver premium_trial].freeze
ULTIMATE_TIERS = %w[ultimate gold ultimate_trial].freeze
PLAN_GROUPS = {
'free' => FREE_TIERS,
'premium' => PREMIUM_TIERS,
'ultimate' => ULTIMATE_TIERS
}.freeze
class << self
delegate :container_registry_import_max_tags_count, to: ::Gitlab::CurrentSettings
delegate :container_registry_import_max_retries, to: ::Gitlab::CurrentSettings
@ -46,8 +57,8 @@ module ContainerRegistry
0
end
def self.target_plan
Plan.find_by_name(target_plan_name)
def self.target_plans
PLAN_GROUPS[target_plan_name]
end
def self.all_plans?

19
qa/.confiner/nightly.yml Normal file
View file

@ -0,0 +1,19 @@
- name: Quarantine E2E tests in Nightly that fail consistently
plugin:
name: gitlab
args:
threshold: 3
private_token: $QA_GITLAB_CI_TOKEN
project_id: gitlab-org/quality/nightly # https://gitlab.com/gitlab-org/quality/nightly/
target_project: gitlab-org/gitlab
failure_issue_labels: QA,Quality,found:nightly
failure_issue_prefix: "Failure in "
pwd: qa
timeout: 30
ref: master
environment:
name: nightly
pattern: 'pipeline: :nightly'
job_pattern: '^((?!quarantine).)*$'
actions:
- quarantine

View file

@ -154,15 +154,21 @@ RSpec.describe ContainerRegistry::Migration do
end
end
describe '.target_plan' do
let_it_be(:plan) { create(:plan) }
describe '.target_plans' do
subject { described_class.target_plans }
before do
stub_application_setting(container_registry_import_target_plan: plan.name)
where(:target_plan, :result) do
'free' | described_class::FREE_TIERS
'premium' | described_class::PREMIUM_TIERS
'ultimate' | described_class::ULTIMATE_TIERS
end
it 'returns the matching application_setting' do
expect(described_class.target_plan).to eq(plan)
with_them do
before do
stub_application_setting(container_registry_import_target_plan: target_plan)
end
it { is_expected.to eq(result) }
end
end

View file

@ -1274,7 +1274,7 @@ RSpec.describe ContainerRepository, :aggregate_failures do
subject { described_class.ready_for_import }
before do
stub_application_setting(container_registry_import_target_plan: root_group.actual_plan_name)
stub_application_setting(container_registry_import_target_plan: valid_container_repository.migration_plan)
end
it 'works' do

View file

@ -1,13 +1,10 @@
# frozen_string_literal: true
RSpec.shared_context 'importable repositories' do
let_it_be(:root_group) { create(:group) }
let_it_be(:group) { create(:group, parent_id: root_group.id) }
let_it_be(:project) { create(:project, namespace: group) }
let_it_be(:valid_container_repository) { create(:container_repository, project: project, created_at: 2.days.ago) }
let_it_be(:valid_container_repository2) { create(:container_repository, project: project, created_at: 1.year.ago) }
let_it_be(:importing_container_repository) { create(:container_repository, :importing, project: project, created_at: 2.days.ago) }
let_it_be(:new_container_repository) { create(:container_repository, project: project) }
let_it_be(:valid_container_repository) { create(:container_repository, created_at: 2.days.ago, migration_plan: 'free') }
let_it_be(:valid_container_repository2) { create(:container_repository, created_at: 1.year.ago, migration_plan: 'free') }
let_it_be(:importing_container_repository) { create(:container_repository, :importing, created_at: 2.days.ago, migration_plan: 'free') }
let_it_be(:new_container_repository) { create(:container_repository, migration_plan: 'free') }
let_it_be(:denied_root_group) { create(:group) }
let_it_be(:denied_group) { create(:group, parent_id: denied_root_group.id) }