Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-05-09 18:07:50 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-05-09 18:07:50 +0300
commitfb19b392e2331e7663c3d65c05aeb81a1db3630d (patch)
treeedec8b9bfc56a39279df88578ccb6da5ca4783b4
parente4b9c52cc9ca9478d9881d03f31517be46376060 (diff)
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--.rubocop_todo/layout/space_in_lambda_literal.yml1
-rw-r--r--.rubocop_todo/migration/background_migration_base_class.yml1
-rw-r--r--.rubocop_todo/migration/background_migration_record.yml1
-rw-r--r--.rubocop_todo/rails/skips_model_validations.yml1
-rw-r--r--.rubocop_todo/style/redundant_self.yml1
-rw-r--r--app/assets/javascripts/branches/components/delete_branch_modal.vue37
-rw-r--r--app/assets/javascripts/cycle_analytics/components/value_stream_filters.vue57
-rw-r--r--app/assets/javascripts/invite_members/components/import_a_project_modal.vue2
-rw-r--r--app/assets/javascripts/vue_shared/components/date_time_picker/date_time_picker.vue2
-rw-r--r--app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_create_view.vue2
-rw-r--r--app/helpers/invite_members_helper.rb2
-rw-r--r--app/models/container_repository.rb2
-rw-r--r--app/models/namespace.rb2
-rw-r--r--app/services/concerns/group_linkable.rb2
-rw-r--r--app/views/admin/application_settings/general.html.haml2
-rw-r--r--app/workers/container_registry/migration/enqueuer_worker.rb7
-rw-r--r--config/feature_flags/development/container_registry_migration_phase2_enqueue_twice.yml8
-rw-r--r--config/feature_flags/development/updated_diff_expansion_buttons.yml2
-rw-r--r--db/post_migrate/20210413132500_reschedule_artifact_expiry_backfill_again.rb38
-rw-r--r--doc/administration/geo/setup/database.md2
-rw-r--r--doc/api/graphql/reference/index.md2
-rw-r--r--doc/ci/pipelines/merged_results_pipelines.md2
-rw-r--r--doc/development/gitlab_flavored_markdown/specification_guide/index.md10
-rw-r--r--doc/user/admin_area/settings/account_and_limit_settings.md2
-rw-r--r--doc/user/application_security/policies/index.md5
-rw-r--r--doc/user/application_security/policies/scan-execution-policies.md5
-rw-r--r--doc/user/application_security/policies/scan-result-policies.md5
-rw-r--r--doc/user/project/issues/csv_import.md45
-rw-r--r--doc/user/project/protected_branches.md36
-rw-r--r--lib/api/internal/container_registry/migration.rb2
-rw-r--r--lib/container_registry/migration.rb4
-rw-r--r--lib/gitlab/background_migration/backfill_artifact_expiry_date.rb58
-rw-r--r--lib/gitlab/ci/config/entry/job.rb20
-rw-r--r--lib/gitlab/ci/config/entry/root.rb23
-rw-r--r--lib/gitlab/process_supervisor.rb20
-rw-r--r--locale/gitlab.pot33
-rw-r--r--metrics_server/metrics_server.rb2
-rw-r--r--sidekiq_cluster/cli.rb14
-rw-r--r--spec/commands/sidekiq_cluster/cli_spec.rb26
-rw-r--r--spec/controllers/groups_controller_spec.rb2
-rw-r--r--spec/features/groups/group_settings_spec.rb2
-rw-r--r--spec/frontend/branches/components/delete_branch_modal_spec.js4
-rw-r--r--spec/frontend/cycle_analytics/base_spec.js3
-rw-r--r--spec/frontend/cycle_analytics/value_stream_filters_spec.js54
-rw-r--r--spec/frontend/vue_shared/components/date_time_picker/date_time_picker_spec.js2
-rw-r--r--spec/helpers/invite_members_helper_spec.rb4
-rw-r--r--spec/lib/container_registry/migration_spec.rb14
-rw-r--r--spec/lib/gitlab/background_migration/backfill_artifact_expiry_date_spec.rb82
-rw-r--r--spec/lib/gitlab/ci/config/entry/job_spec.rb2
-rw-r--r--spec/lib/gitlab/ci/config/entry/root_spec.rb37
-rw-r--r--spec/lib/gitlab/ci/yaml_processor_spec.rb10
-rw-r--r--spec/lib/gitlab/process_supervisor_spec.rb76
-rw-r--r--spec/metrics_server/metrics_server_spec.rb27
-rw-r--r--spec/migrations/20210413132500_reschedule_artifact_expiry_backfill_again_spec.rb38
-rw-r--r--spec/models/container_repository_spec.rb14
-rw-r--r--spec/models/namespace_spec.rb9
-rw-r--r--spec/requests/api/graphql/ci/config_spec.rb18
-rw-r--r--spec/requests/api/internal/container_registry/migration_spec.rb6
-rw-r--r--spec/requests/api/lint_spec.rb13
-rw-r--r--spec/support/shared_examples/features/inviting_groups_shared_examples.rb2
-rw-r--r--spec/workers/container_registry/migration/enqueuer_worker_spec.rb17
61 files changed, 296 insertions, 626 deletions
diff --git a/.rubocop_todo/layout/space_in_lambda_literal.yml b/.rubocop_todo/layout/space_in_lambda_literal.yml
index 7a2bd752b6e..2377553ccdb 100644
--- a/.rubocop_todo/layout/space_in_lambda_literal.yml
+++ b/.rubocop_todo/layout/space_in_lambda_literal.yml
@@ -351,7 +351,6 @@ Layout/SpaceInLambdaLiteral:
- 'lib/container_registry/base_client.rb'
- 'lib/container_registry/client.rb'
- 'lib/file_size_validator.rb'
- - 'lib/gitlab/background_migration/backfill_artifact_expiry_date.rb'
- 'lib/gitlab/background_migration/populate_latest_pipeline_ids.rb'
- 'lib/gitlab/background_migration/remove_all_trace_expiration_dates.rb'
- 'lib/gitlab/cache/helpers.rb'
diff --git a/.rubocop_todo/migration/background_migration_base_class.yml b/.rubocop_todo/migration/background_migration_base_class.yml
index 9307aba4685..8d7d8e954e3 100644
--- a/.rubocop_todo/migration/background_migration_base_class.yml
+++ b/.rubocop_todo/migration/background_migration_base_class.yml
@@ -2,7 +2,6 @@
Migration/BackgroundMigrationBaseClass:
Exclude:
- 'lib/gitlab/background_migration/add_primary_email_to_emails_if_user_confirmed.rb'
- - 'lib/gitlab/background_migration/backfill_artifact_expiry_date.rb'
- 'lib/gitlab/background_migration/backfill_ci_namespace_mirrors.rb'
- 'lib/gitlab/background_migration/backfill_ci_project_mirrors.rb'
- 'lib/gitlab/background_migration/backfill_ci_queuing_tables.rb'
diff --git a/.rubocop_todo/migration/background_migration_record.yml b/.rubocop_todo/migration/background_migration_record.yml
index 6ae518a86fb..cbf39285a7d 100644
--- a/.rubocop_todo/migration/background_migration_record.yml
+++ b/.rubocop_todo/migration/background_migration_record.yml
@@ -2,7 +2,6 @@
Migration/BackgroundMigrationRecord:
Exclude:
- lib/gitlab/background_migration/add_primary_email_to_emails_if_user_confirmed.rb
- - lib/gitlab/background_migration/backfill_artifact_expiry_date.rb
- lib/gitlab/background_migration/backfill_ci_namespace_mirrors.rb
- lib/gitlab/background_migration/backfill_ci_project_mirrors.rb
- lib/gitlab/background_migration/backfill_ci_queuing_tables.rb
diff --git a/.rubocop_todo/rails/skips_model_validations.yml b/.rubocop_todo/rails/skips_model_validations.yml
index 9b908b7b997..e6402ef27f2 100644
--- a/.rubocop_todo/rails/skips_model_validations.yml
+++ b/.rubocop_todo/rails/skips_model_validations.yml
@@ -387,7 +387,6 @@ Rails/SkipsModelValidations:
- 'lib/api/commit_statuses.rb'
- 'lib/api/usage_data.rb'
- 'lib/gitlab/background_migration/add_primary_email_to_emails_if_user_confirmed.rb'
- - 'lib/gitlab/background_migration/backfill_artifact_expiry_date.rb'
- 'lib/gitlab/background_migration/backfill_ci_queuing_tables.rb'
- 'lib/gitlab/background_migration/backfill_draft_status_on_merge_requests.rb'
- 'lib/gitlab/background_migration/backfill_jira_tracker_deployment_type2.rb'
diff --git a/.rubocop_todo/style/redundant_self.yml b/.rubocop_todo/style/redundant_self.yml
index 6b5991e9b3c..e363f83761b 100644
--- a/.rubocop_todo/style/redundant_self.yml
+++ b/.rubocop_todo/style/redundant_self.yml
@@ -297,7 +297,6 @@ Style/RedundantSelf:
- 'lib/gitlab/auth/ldap/dn.rb'
- 'lib/gitlab/auth/o_auth/provider.rb'
- 'lib/gitlab/auth/result.rb'
- - 'lib/gitlab/background_migration/backfill_artifact_expiry_date.rb'
- 'lib/gitlab/background_migration/backfill_ci_queuing_tables.rb'
- 'lib/gitlab/background_migration/backfill_project_repositories.rb'
- 'lib/gitlab/background_migration/job_coordinator.rb'
diff --git a/app/assets/javascripts/branches/components/delete_branch_modal.vue b/app/assets/javascripts/branches/components/delete_branch_modal.vue
index 14c2badeb3f..383fa5f7512 100644
--- a/app/assets/javascripts/branches/components/delete_branch_modal.vue
+++ b/app/assets/javascripts/branches/components/delete_branch_modal.vue
@@ -32,17 +32,10 @@ export default {
return sprintf(modalTitle, { branchName: this.branchName });
},
- message() {
- const modalMessage = this.isProtectedBranch
+ modalMessage() {
+ return this.isProtectedBranch
? this.$options.i18n.modalMessageProtectedBranch
: this.$options.i18n.modalMessage;
-
- return sprintf(modalMessage, { branchName: this.branchName });
- },
- unmergedWarning() {
- return sprintf(this.$options.i18n.unmergedWarning, {
- defaultBranchName: this.defaultBranchName,
- });
},
undoneWarning() {
return sprintf(this.$options.i18n.undoneWarning, {
@@ -92,17 +85,15 @@ export default {
i18n: {
modalTitle: s__('Branches|Delete branch. Are you ABSOLUTELY SURE?'),
modalTitleProtectedBranch: s__('Branches|Delete protected branch. Are you ABSOLUTELY SURE?'),
- modalMessage: s__(
- "Branches|You're about to permanently delete the branch %{strongStart}%{branchName}.%{strongEnd}",
- ),
+ modalMessage: s__("Branches|You're about to permanently delete the branch %{branchName}."),
modalMessageProtectedBranch: s__(
- "Branches|You're about to permanently delete the protected branch %{strongStart}%{branchName}.%{strongEnd}",
+ "Branches|You're about to permanently delete the protected branch %{branchName}.",
),
unmergedWarning: s__(
- 'Branches|This branch hasn’t been merged into %{defaultBranchName}. To avoid data loss, consider merging this branch before deleting it.',
+ "Branches|This branch hasn't been merged into %{defaultBranchName}. To avoid data loss, consider merging this branch before deleting it.",
),
undoneWarning: s__(
- 'Branches|Once you confirm and press %{strongStart}%{buttonText},%{strongEnd} it cannot be undone or recovered.',
+ 'Branches|After you confirm and select %{strongStart}%{buttonText},%{strongEnd} you cannot recover this branch.',
),
cancelButtonText: s__('Branches|Cancel, keep branch'),
confirmationText: s__(
@@ -119,13 +110,19 @@ export default {
<gl-modal ref="modal" size="sm" :modal-id="modalId" :title="title">
<gl-alert class="gl-mb-5" variant="danger" :dismissible="false">
<div data-testid="modal-message">
- <gl-sprintf :message="message">
- <template #strong="{ content }">
- <strong> {{ content }} </strong>
+ <gl-sprintf :message="modalMessage">
+ <template #branchName>
+ <strong>
+ <code class="gl-white-space-pre-wrap">{{ branchName }}</code>
+ </strong>
</template>
</gl-sprintf>
<p v-if="!merged" class="gl-mb-0 gl-mt-4">
- {{ unmergedWarning }}
+ <gl-sprintf :message="$options.i18n.unmergedWarning">
+ <template #defaultBranchName>
+ <code class="gl-white-space-pre-wrap">{{ defaultBranchName }}</code>
+ </template>
+ </gl-sprintf>
</p>
</div>
</gl-alert>
@@ -145,7 +142,7 @@ export default {
{{ content }}
</template>
</gl-sprintf>
- <code class="gl-white-space-pre-wrap"> {{ branchName }} </code>
+ <code class="gl-white-space-pre-wrap">{{ branchName }}</code>
<gl-form-input
v-model="enteredBranchName"
name="delete_branch_input"
diff --git a/app/assets/javascripts/cycle_analytics/components/value_stream_filters.vue b/app/assets/javascripts/cycle_analytics/components/value_stream_filters.vue
index 66bccf19496..f686cd0db95 100644
--- a/app/assets/javascripts/cycle_analytics/components/value_stream_filters.vue
+++ b/app/assets/javascripts/cycle_analytics/components/value_stream_filters.vue
@@ -1,21 +1,13 @@
<script>
-import { GlIcon, GlToggle, GlTooltipDirective } from '@gitlab/ui';
-import { s__ } from '~/locale';
+import { GlTooltipDirective } from '@gitlab/ui';
import DateRange from '~/analytics/shared/components/daterange.vue';
import ProjectsDropdownFilter from '~/analytics/shared/components/projects_dropdown_filter.vue';
import { DATE_RANGE_LIMIT, PROJECTS_PER_PAGE } from '~/analytics/shared/constants';
import FilterBar from './filter_bar.vue';
-export const AGGREGATION_TOGGLE_LABEL = s__('CycleAnalytics|Filter by stop date');
-export const AGGREGATION_DESCRIPTION = s__(
- 'CycleAnalytics|When enabled, the results show items with a stop event within the date range. When disabled, the results show items with a start event within the date range.',
-);
-
export default {
name: 'ValueStreamFilters',
components: {
- GlIcon,
- GlToggle,
DateRange,
ProjectsDropdownFilter,
FilterBar,
@@ -57,21 +49,6 @@ export default {
required: false,
default: null,
},
- canToggleAggregation: {
- type: Boolean,
- required: false,
- default: false,
- },
- isAggregationEnabled: {
- type: Boolean,
- required: false,
- default: false,
- },
- isUpdatingAggregationData: {
- type: Boolean,
- required: false,
- default: false,
- },
},
computed: {
projectsQueryParams() {
@@ -81,19 +58,8 @@ export default {
};
},
},
- methods: {
- onUpdateAggregation(ev) {
- if (!this.isUpdatingAggregationData) {
- this.$emit('toggleAggregation', ev);
- }
- },
- },
multiProjectSelect: true,
maxDateRange: DATE_RANGE_LIMIT,
- i18n: {
- AGGREGATION_TOGGLE_LABEL,
- AGGREGATION_DESCRIPTION,
- },
};
</script>
<template>
@@ -123,27 +89,6 @@ export default {
/>
</div>
<div class="gl-display-flex gl-flex-direction-column gl-lg-flex-direction-row">
- <div
- v-if="canToggleAggregation"
- class="gl-display-flex gl-text-align-center gl-my-2 gl-lg-mt-0 gl-lg-mb-0 gl-mr-5"
- >
- <gl-toggle
- class="gl-flex-direction-row"
- :value="isAggregationEnabled"
- :label="$options.i18n.AGGREGATION_TOGGLE_LABEL"
- :disabled="isUpdatingAggregationData"
- label-position="left"
- @change="onUpdateAggregation"
- >
- <template #label>
- {{ $options.i18n.AGGREGATION_TOGGLE_LABEL }}&nbsp;<gl-icon
- v-gl-tooltip.hover
- :title="$options.i18n.AGGREGATION_DESCRIPTION"
- name="information-o"
- />
- </template>
- </gl-toggle>
- </div>
<date-range
v-if="hasDateRangeFilter"
:start-date="startDate"
diff --git a/app/assets/javascripts/invite_members/components/import_a_project_modal.vue b/app/assets/javascripts/invite_members/components/import_a_project_modal.vue
index d71468284ca..fb6c376cfe6 100644
--- a/app/assets/javascripts/invite_members/components/import_a_project_modal.vue
+++ b/app/assets/javascripts/invite_members/components/import_a_project_modal.vue
@@ -145,7 +145,7 @@ export default {
<gl-button
:disabled="importDisabled"
:loading="isLoading"
- variant="success"
+ variant="confirm"
data-testid="import-button"
@click="submitImport"
>{{ $options.i18n.modalPrimaryButton }}</gl-button
diff --git a/app/assets/javascripts/vue_shared/components/date_time_picker/date_time_picker.vue b/app/assets/javascripts/vue_shared/components/date_time_picker/date_time_picker.vue
index e546ca57c5e..181c1b89e31 100644
--- a/app/assets/javascripts/vue_shared/components/date_time_picker/date_time_picker.vue
+++ b/app/assets/javascripts/vue_shared/components/date_time_picker/date_time_picker.vue
@@ -248,7 +248,7 @@ export default {
__('Cancel')
}}</gl-button>
<gl-button
- variant="success"
+ variant="confirm"
category="primary"
:disabled="!isValid"
@click="setFixedRange()"
diff --git a/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_create_view.vue b/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_create_view.vue
index 3ec33a653b8..2cccb8325f4 100644
--- a/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_create_view.vue
+++ b/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_create_view.vue
@@ -104,7 +104,7 @@ export default {
<gl-button
:disabled="disableCreate"
category="primary"
- variant="success"
+ variant="confirm"
class="float-left d-flex align-items-center"
@click="handleCreateClick"
>
diff --git a/app/helpers/invite_members_helper.rb b/app/helpers/invite_members_helper.rb
index 7a4ef9cf2a3..e46270ab819 100644
--- a/app/helpers/invite_members_helper.rb
+++ b/app/helpers/invite_members_helper.rb
@@ -56,7 +56,7 @@ module InviteMembersHelper
private
def group_select_data(source)
- if source.root_ancestor.namespace_settings.prevent_sharing_groups_outside_hierarchy
+ if source.root_ancestor.prevent_sharing_groups_outside_hierarchy
{ groups_filter: 'descendant_groups', parent_id: source.root_ancestor.id }
else
{}
diff --git a/app/models/container_repository.rb b/app/models/container_repository.rb
index 6bd6bac04bc..c965d7cffe1 100644
--- a/app/models/container_repository.rb
+++ b/app/models/container_repository.rb
@@ -217,7 +217,7 @@ class ContainerRepository < ApplicationRecord
before_transition any => %i[import_done import_aborted import_skipped] do |container_repository|
container_repository.run_after_commit do
- ::ContainerRegistry::Migration::EnqueuerWorker.perform_async
+ ::ContainerRegistry::Migration::EnqueuerWorker.enqueue_a_job
end
end
end
diff --git a/app/models/namespace.rb b/app/models/namespace.rb
index de196964d31..f41bd6f5001 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -111,6 +111,8 @@ class Namespace < ApplicationRecord
delegate :name, to: :owner, allow_nil: true, prefix: true
delegate :avatar_url, to: :owner, allow_nil: true
+ delegate :prevent_sharing_groups_outside_hierarchy, :prevent_sharing_groups_outside_hierarchy=,
+ to: :namespace_settings, allow_nil: true
after_save :schedule_sync_event_worker, if: -> { saved_change_to_id? || saved_change_to_parent_id? }
diff --git a/app/services/concerns/group_linkable.rb b/app/services/concerns/group_linkable.rb
index 3e2e9cfd5eb..43d10e01a4a 100644
--- a/app/services/concerns/group_linkable.rb
+++ b/app/services/concerns/group_linkable.rb
@@ -25,7 +25,7 @@ module GroupLinkable
end
def sharing_outside_hierarchy_allowed?
- !root_ancestor.namespace_settings.prevent_sharing_groups_outside_hierarchy
+ !root_ancestor.prevent_sharing_groups_outside_hierarchy
end
def within_hierarchy?
diff --git a/app/views/admin/application_settings/general.html.haml b/app/views/admin/application_settings/general.html.haml
index 66b8b783ac2..7643f8fa7a7 100644
--- a/app/views/admin/application_settings/general.html.haml
+++ b/app/views/admin/application_settings/general.html.haml
@@ -93,7 +93,7 @@
%p
= _('Manage Web IDE features.')
.settings-content
- = gitlab_ui_form_for @application_setting, url: general_admin_application_settings_path(anchor: "#js-web-ide-settings"), html: { class: 'fieldset-form', id: 'web-ide-settings' } do |f|
+ = gitlab_ui_form_for @application_setting, url: general_admin_application_settings_path(anchor: "js-web-ide-settings"), html: { class: 'fieldset-form', id: 'web-ide-settings' } do |f|
= form_errors(@application_setting)
%fieldset
diff --git a/app/workers/container_registry/migration/enqueuer_worker.rb b/app/workers/container_registry/migration/enqueuer_worker.rb
index eb68b4d3b62..a8468c12b8d 100644
--- a/app/workers/container_registry/migration/enqueuer_worker.rb
+++ b/app/workers/container_registry/migration/enqueuer_worker.rb
@@ -30,6 +30,11 @@ module ContainerRegistry
re_enqueue_if_capacity if re_enqueue
end
+ def self.enqueue_a_job
+ perform_async
+ perform_in(7.seconds) if ::ContainerRegistry::Migration.enqueue_twice?
+ end
+
private
def with_a_lease_on_repository
@@ -164,7 +169,7 @@ module ContainerRegistry
def re_enqueue_if_capacity
return unless below_capacity?
- self.class.perform_async
+ self.class.enqueue_a_job
end
def log_repository(repository)
diff --git a/config/feature_flags/development/container_registry_migration_phase2_enqueue_twice.yml b/config/feature_flags/development/container_registry_migration_phase2_enqueue_twice.yml
new file mode 100644
index 00000000000..83ae4e8c761
--- /dev/null
+++ b/config/feature_flags/development/container_registry_migration_phase2_enqueue_twice.yml
@@ -0,0 +1,8 @@
+---
+name: container_registry_migration_phase2_enqueue_twice
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/86596
+rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/350543
+milestone: '15.0'
+type: development
+group: group::package
+default_enabled: false
diff --git a/config/feature_flags/development/updated_diff_expansion_buttons.yml b/config/feature_flags/development/updated_diff_expansion_buttons.yml
index 70efa024168..a566eab6047 100644
--- a/config/feature_flags/development/updated_diff_expansion_buttons.yml
+++ b/config/feature_flags/development/updated_diff_expansion_buttons.yml
@@ -5,4 +5,4 @@ rollout_issue_url:
milestone: '14.10'
type: development
group: group::code review
-default_enabled: false
+default_enabled: true
diff --git a/db/post_migrate/20210413132500_reschedule_artifact_expiry_backfill_again.rb b/db/post_migrate/20210413132500_reschedule_artifact_expiry_backfill_again.rb
index b4570c8398b..0377df7a46b 100644
--- a/db/post_migrate/20210413132500_reschedule_artifact_expiry_backfill_again.rb
+++ b/db/post_migrate/20210413132500_reschedule_artifact_expiry_backfill_again.rb
@@ -1,44 +1,14 @@
# frozen_string_literal: true
class RescheduleArtifactExpiryBackfillAgain < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- MIGRATION = 'BackfillArtifactExpiryDate'
- SWITCH_DATE = Date.new(2020, 06, 22).freeze
-
- disable_ddl_transaction!
-
- class JobArtifact < ActiveRecord::Base
- include EachBatch
-
- self.inheritance_column = :_type_disabled
- self.table_name = 'ci_job_artifacts'
-
- scope :without_expiry_date, -> { where(expire_at: nil) }
- scope :before_switch, -> { where("date(created_at AT TIME ZONE 'UTC') < ?::date", SWITCH_DATE) }
- end
+ # This migration has been disabled as it was causing a regression bug for self instances
+ # preventing artifact deletion, see https://gitlab.com/gitlab-org/gitlab/-/issues/355955
def up
- Gitlab::BackgroundMigration.steal(MIGRATION) do |job|
- job.delete
-
- false
- end
-
- queue_background_migration_jobs_by_range_at_intervals(
- JobArtifact.without_expiry_date.before_switch,
- MIGRATION,
- 2.minutes,
- batch_size: 200_000
- )
+ # no-op
end
def down
- Gitlab::BackgroundMigration.steal(MIGRATION) do |job|
- job.delete
-
- false
- end
+ # no-op
end
end
diff --git a/doc/administration/geo/setup/database.md b/doc/administration/geo/setup/database.md
index 5058fed128b..52f4adc4e03 100644
--- a/doc/administration/geo/setup/database.md
+++ b/doc/administration/geo/setup/database.md
@@ -391,7 +391,7 @@ There is an [issue where support is being discussed](https://gitlab.com/gitlab-o
make sure to replace `verify-ca` to `verify-full` when
running the command.
- When prompted enter the password you set in the first step for the
+ When prompted enter the _plaintext_ password you set in the first step for the
`gitlab_replicator` user. If all worked correctly, you should see
the list of **primary** node's databases.
diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md
index d07b84cbe69..fdb8b06e531 100644
--- a/doc/api/graphql/reference/index.md
+++ b/doc/api/graphql/reference/index.md
@@ -10590,7 +10590,7 @@ Returns [`[DoraMetric!]`](#dorametric).
| Name | Type | Description |
| ---- | ---- | ----------- |
| <a id="dorametricdate"></a>`date` | [`String`](#string) | Date of the data point. |
-| <a id="dorametricvalue"></a>`value` | [`Int`](#int) | Value of the data point. |
+| <a id="dorametricvalue"></a>`value` | [`Float`](#float) | Value of the data point. |
### `Environment`
diff --git a/doc/ci/pipelines/merged_results_pipelines.md b/doc/ci/pipelines/merged_results_pipelines.md
index 7df9ea3f72f..ffe031e2645 100644
--- a/doc/ci/pipelines/merged_results_pipelines.md
+++ b/doc/ci/pipelines/merged_results_pipelines.md
@@ -35,7 +35,7 @@ To use merged results pipelines:
- Your repository must be a GitLab repository, not an
[external repository](../ci_cd_for_external_repos/index.md).
- You must not be using [fast forward merges](../../user/project/merge_requests/fast_forward_merge.md).
- [An issue exits](https://gitlab.com/gitlab-org/gitlab/-/issues/26996) to change this behavior.
+ [An issue exists](https://gitlab.com/gitlab-org/gitlab/-/issues/26996) to change this behavior.
## Enable merged results pipelines
diff --git a/doc/development/gitlab_flavored_markdown/specification_guide/index.md b/doc/development/gitlab_flavored_markdown/specification_guide/index.md
index 5af642a52ce..397d555c54f 100644
--- a/doc/development/gitlab_flavored_markdown/specification_guide/index.md
+++ b/doc/development/gitlab_flavored_markdown/specification_guide/index.md
@@ -476,10 +476,12 @@ code. It contains only shell scripting commands for the relevant
```mermaid
graph LR
-subgraph script:
- A{run-snapshopt-tests.sh} --> B
+subgraph tests:
B[relevant rspec+jest test files]
end
+subgraph script:
+ A{run-snapshopt-tests.sh} -->|invokes| B
+end
subgraph input:<br/>YAML
C[examples_index.yml] --> B
D[markdown.yml] --> B
@@ -487,7 +489,7 @@ subgraph input:<br/>YAML
F[prosemirror_json.yml] --> B
end
subgraph output:<br/>test results/output
- B --> G[rspec/jest output]
+ B --> H[rspec+jest output]
end
```
@@ -534,7 +536,7 @@ is the manually updated canonical Markdown+HTML examples for GLFM extensions.
each of which contain a Markdown example and the corresponding canonical HTML.
- The `update-specification.rb` script inserts it as new sections before the appendix
of generated `spec.txt`.
-- It should consist of `H1` header sections, with a examples nested exactly 2 levels deep within `H2`
+- It should consist of `H1` header sections, with all examples nested exactly 2 levels deep within `H2`
header sections.
`glfm_specification/input/gitlab_flavored_markdown/glfm_canonical_examples.txt` sample entries:
diff --git a/doc/user/admin_area/settings/account_and_limit_settings.md b/doc/user/admin_area/settings/account_and_limit_settings.md
index df2ea82a556..471b48dfec4 100644
--- a/doc/user/admin_area/settings/account_and_limit_settings.md
+++ b/doc/user/admin_area/settings/account_and_limit_settings.md
@@ -57,7 +57,7 @@ You can change the maximum push size for your instance:
1. On the left sidebar, select **Settings > General**, then expand **Account and limit**.
1. Increase or decrease by changing the value in **Maximum push size (MB)**.
-For GitLab.com appliation limits, read [GitLab application limits](../../../administration/instance_limits.md#max-push-size).
+For GitLab.com application limits, read [GitLab application limits](../../../administration/instance_limits.md#max-push-size).
NOTE:
When you [add files to a repository](../../project/repository/web_editor.md#create-a-file)
diff --git a/doc/user/application_security/policies/index.md b/doc/user/application_security/policies/index.md
index 8bd6e761e3d..f790164d9a0 100644
--- a/doc/user/application_security/policies/index.md
+++ b/doc/user/application_security/policies/index.md
@@ -41,8 +41,9 @@ stored there. Examples and schema information are available for the following po
- [Scan execution policy](scan-execution-policies.md#example-security-policies-project)
- [Scan result policy](scan-result-policies.md#example-security-scan-result-policies-project)
-Policies created in this project are applied through a background job that runs once every 10
-minutes. Allow up to 10 minutes for any policy changes committed to this project to take effect.
+Most policy changes take effect as soon as the merge request is merged. Any changes that
+do not go through a merge request and are committed directly to the default branch may require up to 10 minutes
+before the policy changes take effect.
### Managing the linked security policy project
diff --git a/doc/user/application_security/policies/scan-execution-policies.md b/doc/user/application_security/policies/scan-execution-policies.md
index 7e8e60768b9..168c76ab710 100644
--- a/doc/user/application_security/policies/scan-execution-policies.md
+++ b/doc/user/application_security/policies/scan-execution-policies.md
@@ -35,8 +35,9 @@ policy project is automatically created. Existing policies can also be
removed from the editor interface by selecting **Delete policy**
at the bottom of the editor.
-All scan execution policy changes are applied through a background job that runs once every 10
-minutes. Allow up to 10 minutes for any policy changes committed to this project to take effect.
+Most policy changes take effect as soon as the merge request is merged. Any changes that
+do not go through a merge request and are committed directly to the default branch may require up to 10 minutes
+before the policy changes take effect.
![Scan Execution Policy Editor YAML Mode](img/scan_execution_policy_yaml_mode_v14_7.png)
diff --git a/doc/user/application_security/policies/scan-result-policies.md b/doc/user/application_security/policies/scan-result-policies.md
index 6178060a7dc..232a5c9f91c 100644
--- a/doc/user/application_security/policies/scan-result-policies.md
+++ b/doc/user/application_security/policies/scan-result-policies.md
@@ -32,8 +32,9 @@ If a security policy project doesn't link to your project, GitLab creates such a
Existing policies can also be removed from the editor interface by selecting **Delete policy** at
the bottom of the editor.
-All scan result policy changes are applied through a background job that runs once every 10 minutes.
-Allow up to 10 minutes for any policy changes committed to this project to take effect.
+Most policy changes take effect as soon as the merge request is merged. Any changes that
+do not go through a merge request and are committed directly to the default branch may require up to 10 minutes
+before the policy changes take effect.
The [policy editor](index.md#policy-editor) supports YAML mode and rule mode.
diff --git a/doc/user/project/issues/csv_import.md b/doc/user/project/issues/csv_import.md
index e4b8efd27ed..a3f6ee5e61e 100644
--- a/doc/user/project/issues/csv_import.md
+++ b/doc/user/project/issues/csv_import.md
@@ -6,8 +6,6 @@ info: To determine the technical writer assigned to the Stage/Group associated w
# Importing issues from CSV **(FREE)**
-> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/23532) in GitLab 11.7.
-
Issues can be imported to a project by uploading a CSV file with the columns
`title` and `description`. Other columns are **not** imported. If you want to
retain columns such as labels and milestones, consider the [Move Issue feature](managing_issues.md#move-an-issue).
@@ -25,33 +23,29 @@ You must have at least the Developer role for a project to import issues.
To import issues:
-1. Navigate to a project's Issues list page.
-1. If existing issues are present, click the import icon at the top right, next to the **Edit issues** button.
-1. For a project without any issues, click the button labeled **Import CSV** in the middle of the page.
-1. Select the file and click the **Import issues** button.
+1. Go to your project's Issues list page.
+1. Open the import feature, depending if the project has issues:
+ - Existing issues are present: Select the import icon at the top right, next to **Edit issues**.
+ - Project has no issues: Select **Import CSV** in the middle of the page.
+1. Select the file you want to import, and then select **Import issues**.
-The file is processed in the background and a notification email is sent
-to you once the import is complete.
+The file is processed in the background, and a notification email is sent
+to you after the import is complete.
## CSV file format
-When importing issues from a CSV file, it must be formatted in a certain way:
+To import issues, GitLab requires CSV files have a specific format:
-- **header row:** CSV files must include the following headers:
-`title` and `description`. The case of the headers does not matter.
-- **columns:** Data from columns beyond `title` and `description` are not imported.
-- **separators:** The column separator is automatically detected from the header row.
- Supported separator characters are: commas (`,`), semicolons (`;`), and tabs (`\t`).
- The row separator can be either `CRLF` or `LF`.
-- **double-quote character:** The double-quote (`"`) character is used to quote fields,
- enabling the use of the column separator within a field (see the third line in the
- sample CSV data below). To insert a double-quote (`"`) within a quoted
- field, use two double-quote characters in succession (`""`).
-- **data rows:** After the header row, succeeding rows must follow the same column
- order. The issue title is required while the description is optional.
+| Element | Format |
+|------------------------|--------|
+| header row | CSV files must include the following headers: `title` and `description`. The case of the headers does not matter. |
+| columns | Data from columns beyond `title` and `description` are not imported. |
+| separators | The column separator is detected from the header row. Supported separator characters are commas (`,`), semicolons (`;`), and tabs (`\t`). The row separator can be either `CRLF` or `LF`. |
+| double-quote character | The double-quote (`"`) character is used to quote fields, enabling the use of the column separator in a field (see the third line in the sample CSV data below). To insert a double-quote (`"`) in a quoted field use two double-quote characters in succession (`""`). |
+| data rows | After the header row, following rows must use the same column order. The issue title is required, but the description is optional. |
-If you have special characters _within_ a field, (such as `\n` or `,`),
-wrap the characters in double quotes.
+If you have special characters in a field, (such as `\n` or `,`), surround the
+characters with double quotes (`"`).
Sample CSV data:
@@ -64,6 +58,7 @@ Another Title,"A description, with a comma"
### File size
-The limit depends on the configuration value of Max Attachment Size for the GitLab instance.
+The limit depends on how your GitLab instance is hosted:
-For GitLab.com, it is set to 10 MB.
+- Self-managed: Set by the configuration value of `Max Attachment Size` for the GitLab instance.
+- GitLab SaaS: On GitLab.com, it's set to 10 MB.
diff --git a/doc/user/project/protected_branches.md b/doc/user/project/protected_branches.md
index 9db017b4cb7..56f5a2d24ff 100644
--- a/doc/user/project/protected_branches.md
+++ b/doc/user/project/protected_branches.md
@@ -39,7 +39,8 @@ Prerequisite:
To protect a branch:
-1. Go to your project and select **Settings > Repository**.
+1. On the top bar, select **Menu > Projects** and find your project.
+1. On the left sidebar, select **Settings > Repository**.
1. Expand **Protected branches**.
1. From the **Branch** dropdown list, select the branch you want to protect.
1. From the **Allowed to merge** list, select a role, or group that can merge into this branch. In GitLab Premium, you can also add users.
@@ -60,7 +61,8 @@ Prerequisite:
To protect multiple branches at the same time:
-1. Go to your project and select **Settings > Repository**.
+1. On the top bar, select **Menu > Projects** and find your project.
+1. On the left sidebar, select **Settings > Repository**.
1. Expand **Protected branches**.
1. From the **Branch** dropdown list, type the branch name and a wildcard.
For example:
@@ -92,7 +94,8 @@ from the command line or from a Git client application.
To create a new branch through the user interface:
-1. Go to **Repository > Branches**.
+1. On the top bar, select **Menu > Projects** and find your project.
+1. On the left sidebar, select **Repository > Branches**.
1. Select **New branch**.
1. Fill in the branch name and select an existing branch, tag, or commit to
base the new branch on. Only existing protected branches and commits
@@ -104,7 +107,8 @@ You can force everyone to submit a merge request, rather than allowing them to
check in directly to a protected branch. This setting is compatible with workflows
like the [GitLab workflow](../../topics/gitlab_flow.md).
-1. Go to your project and select **Settings > Repository**.
+1. On the top bar, select **Menu > Projects** and find your project.
+1. On the left sidebar, select **Settings > Repository**.
1. Expand **Protected branches**.
1. From the **Branch** dropdown list, select the branch you want to protect.
1. From the **Allowed to merge** list, select **Developers + Maintainers**.
@@ -119,7 +123,8 @@ like the [GitLab workflow](../../topics/gitlab_flow.md).
You can allow everyone with write access to push to the protected branch.
-1. Go to your project and select **Settings > Repository**.
+1. On the top bar, select **Menu > Projects** and find your project.
+1. On the left sidebar, select **Settings > Repository**.
1. Expand **Protected branches**.
1. From the **Branch** dropdown list, select the branch you want to protect.
1. From the **Allowed to push** list, select **Developers + Maintainers**.
@@ -146,7 +151,8 @@ Prerequisites:
To allow a deploy key to push to a protected branch:
-1. Go to your project and select **Settings > Repository**.
+1. On the top bar, select **Menu > Projects** and find your project.
+1. On the left sidebar, select **Settings > Repository**.
1. Expand **Protected branches**.
1. From the **Branch** dropdown list, select the branch you want to protect.
1. From the **Allowed to push** list, select the deploy key.
@@ -164,7 +170,8 @@ protected branches.
To protect a new branch and enable force push:
-1. Go to your project and select **Settings > Repository**.
+1. On the top bar, select **Menu > Projects** and find your project.
+1. On the left sidebar, select **Settings > Repository**.
1. Expand **Protected branches**.
1. From the **Branch** dropdown list, select the branch you want to protect.
1. From the **Allowed to push** and **Allowed to merge** lists, select the settings you want.
@@ -175,7 +182,8 @@ To protect a new branch and enable force push:
To enable force pushes on branches that are already protected:
-1. Go to your project and select **Settings > Repository**.
+1. On the top bar, select **Menu > Projects** and find your project.
+1. On the left sidebar, select **Settings > Repository**.
1. Expand **Protected branches**.
1. In the list of protected branches, next to the branch, turn on the **Allowed to force push** toggle.
@@ -190,7 +198,8 @@ For a protected branch, you can require at least one approval by a [Code Owner](
To protect a new branch and enable Code Owner's approval:
-1. Go to your project and select **Settings > Repository**.
+1. On the top bar, select **Menu > Projects** and find your project.
+1. On the left sidebar, select **Settings > Repository**.
1. Expand **Protected branches**.
1. From the **Branch** dropdown list, select the branch you want to protect.
1. From the **Allowed to push** and **Allowed to merge** lists, select the settings you want.
@@ -199,7 +208,8 @@ To protect a new branch and enable Code Owner's approval:
To enable Code Owner's approval on branches that are already protected:
-1. Go to your project and select **Settings > Repository**.
+1. On the top bar, select **Menu > Projects** and find your project.
+1. On the left sidebar, select **Settings > Repository**.
1. Expand **Protected branches**.
1. In the list of protected branches, next to the branch, turn on the **Code owner approval** toggle.
@@ -230,9 +240,11 @@ for details about the pipelines security model.
Users with at least the Maintainer role can manually delete protected
branches by using the GitLab web interface:
-1. Go to **Repository > Branches**.
+1. On the top bar, select **Menu > Projects** and find your project.
+1. On the left sidebar, select **Repository > Branches**.
1. Next to the branch you want to delete, select **Delete** (**{remove}**).
-1. On the confirmation dialog, type the branch name and select **Delete protected branch**.
+1. On the confirmation dialog, type the branch name.
+1. Select **Yes, delete protected branch**.
Protected branches can only be deleted by using GitLab either from the UI or API.
This prevents accidentally deleting a branch through local Git commands or
diff --git a/lib/api/internal/container_registry/migration.rb b/lib/api/internal/container_registry/migration.rb
index c6c81b6024a..c750db94dab 100644
--- a/lib/api/internal/container_registry/migration.rb
+++ b/lib/api/internal/container_registry/migration.rb
@@ -54,7 +54,7 @@ module API
bad_request!("Couldn't transition from importing to import_done")
end
when STATUS_IMPORT_FAILED, STATUS_PRE_IMPORT_FAILED
- repository.abort_import
+ repository.abort_import!
end
end
diff --git a/lib/container_registry/migration.rb b/lib/container_registry/migration.rb
index 340db4c7330..33d08e1dec8 100644
--- a/lib/container_registry/migration.rb
+++ b/lib/container_registry/migration.rb
@@ -66,5 +66,9 @@ module ContainerRegistry
def self.all_plans?
Feature.enabled?(:container_registry_migration_phase2_all_plans)
end
+
+ def self.enqueue_twice?
+ Feature.enabled?(:container_registry_migration_phase2_enqueue_twice)
+ end
end
end
diff --git a/lib/gitlab/background_migration/backfill_artifact_expiry_date.rb b/lib/gitlab/background_migration/backfill_artifact_expiry_date.rb
deleted file mode 100644
index f6b36571c90..00000000000
--- a/lib/gitlab/background_migration/backfill_artifact_expiry_date.rb
+++ /dev/null
@@ -1,58 +0,0 @@
-# frozen_string_literal: true
-
-module Gitlab
- module BackgroundMigration
- # Backfill expire_at for a range of Ci::JobArtifact
- class BackfillArtifactExpiryDate
- include Gitlab::Utils::StrongMemoize
-
- SWITCH_DATE = Date.new(2020, 06, 22).freeze
- OLD_ARTIFACT_AGE = 15.months
- BATCH_SIZE = 1_000
- OLD_ARTIFACT_EXPIRY_OFFSET = 3.months
- RECENT_ARTIFACT_EXPIRY_OFFSET = 1.year
-
- # Ci::JobArtifact model
- class Ci::JobArtifact < ActiveRecord::Base
- include ::EachBatch
-
- self.table_name = 'ci_job_artifacts'
-
- scope :without_expiry_date, -> { where(expire_at: nil) }
- scope :before_switch, -> { where("date(created_at AT TIME ZONE 'UTC') < ?::date", SWITCH_DATE) }
- scope :between, -> (start_id, end_id) { where(id: start_id..end_id) }
- scope :old, -> { where(self.arel_table[:created_at].lt(OLD_ARTIFACT_AGE.ago)) }
- scope :recent, -> { where(self.arel_table[:created_at].gt(OLD_ARTIFACT_AGE.ago)) }
- end
-
- def perform(start_id, end_id)
- Ci::JobArtifact
- .without_expiry_date.before_switch
- .between(start_id, end_id)
- .each_batch(of: BATCH_SIZE) do |batch|
- batch.old.update_all(expire_at: old_artifact_expiry_date)
- batch.recent.update_all(expire_at: recent_artifact_expiry_date)
- end
- end
-
- private
-
- def offset_date
- strong_memoize(:offset_date) do
- current_date = Time.current
- target_date = Time.zone.local(current_date.year, current_date.month, 22, 0, 0, 0)
-
- current_date.day < 22 ? target_date : target_date.next_month
- end
- end
-
- def old_artifact_expiry_date
- offset_date + OLD_ARTIFACT_EXPIRY_OFFSET
- end
-
- def recent_artifact_expiry_date
- offset_date + RECENT_ARTIFACT_EXPIRY_OFFSET
- end
- end
- end
-end
diff --git a/lib/gitlab/ci/config/entry/job.rb b/lib/gitlab/ci/config/entry/job.rb
index 06c81fd65dd..7513936a18a 100644
--- a/lib/gitlab/ci/config/entry/job.rb
+++ b/lib/gitlab/ci/config/entry/job.rb
@@ -11,7 +11,7 @@ module Gitlab
include ::Gitlab::Ci::Config::Entry::Processable
ALLOWED_WHEN = %w[on_success on_failure always manual delayed].freeze
- ALLOWED_KEYS = %i[tags script type image services start_in artifacts
+ ALLOWED_KEYS = %i[tags script image services start_in artifacts
cache dependencies before_script after_script
environment coverage retry parallel interruptible timeout
release].freeze
@@ -55,11 +55,6 @@ module Gitlab
description: 'Commands that will be executed in this job.',
inherit: false
- entry :type, Entry::Stage,
- description: 'Deprecated: stage this job will be executed into.',
- inherit: false,
- deprecation: { deprecated: '9.0', warning: '14.8', removed: '15.0' }
-
entry :after_script, Entry::Commands,
description: 'Commands that will be executed when finishing job.',
inherit: true
@@ -135,19 +130,6 @@ module Gitlab
true
end
- def compose!(deps = nil)
- super do
- # The type keyword will be removed in 15.0:
- # https://gitlab.com/gitlab-org/gitlab/-/issues/346823
- if type_defined? && !stage_defined?
- @entries[:stage] = @entries[:type]
- log_and_warn_deprecated_entry(@entries[:type])
- end
-
- @entries.delete(:type)
- end
- end
-
def delayed?
self.when == 'delayed'
end
diff --git a/lib/gitlab/ci/config/entry/root.rb b/lib/gitlab/ci/config/entry/root.rb
index 7b58ef0b8ab..ff11c757dfa 100644
--- a/lib/gitlab/ci/config/entry/root.rb
+++ b/lib/gitlab/ci/config/entry/root.rb
@@ -12,7 +12,7 @@ module Gitlab
include ::Gitlab::Config::Entry::Configurable
ALLOWED_KEYS = %i[default include before_script image services
- after_script variables stages types cache workflow].freeze
+ after_script variables stages cache workflow].freeze
validations do
validates :config, allowed_keys: ALLOWED_KEYS
@@ -57,11 +57,6 @@ module Gitlab
description: 'Configuration of stages for this pipeline.',
reserved: true
- entry :types, Entry::Stages,
- description: 'Deprecated: stages for this pipeline.',
- reserved: true,
- deprecation: { deprecated: '9.0', warning: '14.8', removed: '15.0' }
-
entry :cache, Entry::Caches,
description: 'Configure caching between build jobs.',
reserved: true
@@ -100,7 +95,6 @@ module Gitlab
def compose!(_deps = nil)
super(self) do
- compose_deprecated_entries!
compose_jobs!
end
end
@@ -118,21 +112,6 @@ module Gitlab
end
# rubocop: enable CodeReuse/ActiveRecord
- def compose_deprecated_entries!
- ##
- # Deprecated `:types` key workaround - if types are defined and
- # stages are not defined we use types definition as stages.
- # This keyword will be removed in 15.0:
- # https://gitlab.com/gitlab-org/gitlab/-/issues/346823
- #
- if types_defined?
- @entries[:stages] = @entries[:types] unless stages_defined?
- log_and_warn_deprecated_entry(@entries[:types])
- end
-
- @entries.delete(:types)
- end
-
def filter_jobs!
return unless @config.is_a?(Hash)
diff --git a/lib/gitlab/process_supervisor.rb b/lib/gitlab/process_supervisor.rb
index 18fd24aa582..714034f043d 100644
--- a/lib/gitlab/process_supervisor.rb
+++ b/lib/gitlab/process_supervisor.rb
@@ -20,7 +20,7 @@ module Gitlab
health_check_interval_seconds: DEFAULT_HEALTH_CHECK_INTERVAL_SECONDS,
check_terminate_interval_seconds: DEFAULT_TERMINATE_INTERVAL_SECONDS,
terminate_timeout_seconds: DEFAULT_TERMINATE_TIMEOUT_SECONDS,
- term_signals: %i(INT TERM),
+ term_signals: [],
forwarded_signals: [],
**options)
super(**options)
@@ -31,7 +31,7 @@ module Gitlab
@check_terminate_interval_seconds = check_terminate_interval_seconds
@terminate_timeout_seconds = terminate_timeout_seconds
- @pids = []
+ @pids = Set.new
@alive = false
end
@@ -43,7 +43,7 @@ module Gitlab
# If the block returns a non-empty list of IDs, the supervisor will
# start observing those processes instead. Otherwise it will shut down.
def supervise(pid_or_pids, &on_process_death)
- @pids = Array(pid_or_pids)
+ @pids = Array(pid_or_pids).to_set
@on_process_death = on_process_death
trap_signals!
@@ -56,7 +56,6 @@ module Gitlab
return unless @alive
stop_processes(signal)
- stop
end
def supervised_pids
@@ -75,26 +74,25 @@ module Gitlab
def run_thread
while @alive
- sleep(@health_check_interval_seconds)
-
check_process_health
+
+ sleep(@health_check_interval_seconds)
end
end
def check_process_health
unless all_alive?
- existing_pids = live_pids # Capture this value for the duration of the block.
+ existing_pids = live_pids.to_set # Capture this value for the duration of the block.
dead_pids = @pids - existing_pids
- new_pids = Array(@on_process_death.call(dead_pids))
- @pids = existing_pids + new_pids
- @alive = @pids.any?
+ new_pids = Array(@on_process_death.call(dead_pids.to_a))
+ @pids = existing_pids + new_pids.to_set
end
end
def stop_processes(signal)
# Set this prior to shutting down so that shutdown hooks which read `alive`
# know the supervisor is about to shut down.
- @alive = false
+ stop_working
# Shut down supervised processes.
signal_all(signal)
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 95d4a7c67f7..6f83d3c0caa 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -6346,6 +6346,9 @@ msgstr ""
msgid "Branches|Active branches"
msgstr ""
+msgid "Branches|After you confirm and select %{strongStart}%{buttonText},%{strongEnd} you cannot recover this branch."
+msgstr ""
+
msgid "Branches|All"
msgstr ""
@@ -6394,9 +6397,6 @@ msgstr ""
msgid "Branches|No branches to show"
msgstr ""
-msgid "Branches|Once you confirm and press %{strongStart}%{buttonText},%{strongEnd} it cannot be undone or recovered."
-msgstr ""
-
msgid "Branches|Only a project maintainer or owner can delete a protected branch"
msgstr ""
@@ -6436,7 +6436,7 @@ msgstr ""
msgid "Branches|The default branch cannot be deleted"
msgstr ""
-msgid "Branches|This branch hasn’t been merged into %{defaultBranchName}. To avoid data loss, consider merging this branch before deleting it."
+msgid "Branches|This branch hasn't been merged into %{defaultBranchName}. To avoid data loss, consider merging this branch before deleting it."
msgstr ""
msgid "Branches|To discard the local changes and overwrite the branch with the upstream version, delete it here and choose 'Update Now' above."
@@ -6451,10 +6451,10 @@ msgstr ""
msgid "Branches|Yes, delete protected branch"
msgstr ""
-msgid "Branches|You're about to permanently delete the branch %{strongStart}%{branchName}.%{strongEnd}"
+msgid "Branches|You're about to permanently delete the branch %{branchName}."
msgstr ""
-msgid "Branches|You're about to permanently delete the protected branch %{strongStart}%{branchName}.%{strongEnd}"
+msgid "Branches|You're about to permanently delete the protected branch %{branchName}."
msgstr ""
msgid "Branches|diverged from upstream"
@@ -10963,12 +10963,6 @@ msgstr ""
msgid "CycleAnalytics|'%{name}' is collecting the data. This can take a few minutes."
msgstr ""
-msgid "CycleAnalytics|Aggregation disabled"
-msgstr ""
-
-msgid "CycleAnalytics|Aggregation enabled"
-msgstr ""
-
msgid "CycleAnalytics|Average time to completion"
msgstr ""
@@ -10990,9 +10984,6 @@ msgstr ""
msgid "CycleAnalytics|Display chart filters"
msgstr ""
-msgid "CycleAnalytics|Filter by stop date"
-msgstr ""
-
msgid "CycleAnalytics|If you have recently upgraded to GitLab Premium, it can take up to 30 minutes for data to collect and display."
msgstr ""
@@ -11048,18 +11039,12 @@ msgstr ""
msgid "CycleAnalytics|There is no data for 'Total time' available. Adjust the current filters."
msgstr ""
-msgid "CycleAnalytics|There was an error updating the aggregation status, please try again."
-msgstr ""
-
msgid "CycleAnalytics|Total time"
msgstr ""
msgid "CycleAnalytics|Type of work"
msgstr ""
-msgid "CycleAnalytics|When enabled, the results show items with a stop event within the date range. When disabled, the results show items with a start event within the date range."
-msgstr ""
-
msgid "CycleAnalytics|group dropdown filter"
msgstr ""
@@ -33425,9 +33410,6 @@ msgstr ""
msgid "SecurityOrchestration|All policies"
msgstr ""
-msgid "SecurityOrchestration|Allow up to 10 minutes for any policy changes to take effect."
-msgstr ""
-
msgid "SecurityOrchestration|An error occurred assigning your security policy project"
msgstr ""
@@ -33527,9 +33509,6 @@ msgstr ""
msgid "SecurityOrchestration|Policies"
msgstr ""
-msgid "SecurityOrchestration|Policies created in this project are applied through a background job that runs once every 10 minutes."
-msgstr ""
-
msgid "SecurityOrchestration|Policy Type"
msgstr ""
diff --git a/metrics_server/metrics_server.rb b/metrics_server/metrics_server.rb
index 7bc48ed1ff8..309334cd899 100644
--- a/metrics_server/metrics_server.rb
+++ b/metrics_server/metrics_server.rb
@@ -22,8 +22,6 @@ class MetricsServer # rubocop:disable Gitlab/NamespacedClass
supervisor = PumaProcessSupervisor.instance
supervisor.supervise(start_server.call) do
- next unless supervisor.alive
-
Gitlab::AppLogger.info('Puma metrics server terminated, restarting...')
start_server.call
end
diff --git a/sidekiq_cluster/cli.rb b/sidekiq_cluster/cli.rb
index 408b3864d5e..52dc14130fb 100644
--- a/sidekiq_cluster/cli.rb
+++ b/sidekiq_cluster/cli.rb
@@ -20,7 +20,7 @@ require_relative 'sidekiq_cluster'
module Gitlab
module SidekiqCluster
class CLI
- THREAD_NAME = 'supervisor'
+ THREAD_NAME = 'sidekiq-cluster'
# The signals that should terminate both the master and workers.
TERMINATE_SIGNALS = %i(INT TERM).freeze
@@ -134,23 +134,17 @@ module Gitlab
)
metrics_server_pid = start_metrics_server
-
- all_pids = worker_pids + Array(metrics_server_pid)
-
- supervisor.supervise(all_pids) do |dead_pids|
+ supervisor.supervise(worker_pids + Array(metrics_server_pid)) do |dead_pids|
# If we're not in the process of shutting down the cluster,
# and the metrics server died, restart it.
- if supervisor.alive && dead_pids.include?(metrics_server_pid)
+ if dead_pids == Array(metrics_server_pid)
@logger.info('Sidekiq metrics server terminated, restarting...')
metrics_server_pid = restart_metrics_server
- all_pids = worker_pids + Array(metrics_server_pid)
else
# If a worker process died we'll just terminate the whole cluster.
# We let an external system (runit, kubernetes) handle the restart.
@logger.info('A worker terminated, shutting down the cluster')
-
- ProcessManagement.signal_processes(all_pids - dead_pids, :TERM)
- # Signal supervisor not to respawn workers and shut down.
+ supervisor.shutdown
[]
end
end
diff --git a/spec/commands/sidekiq_cluster/cli_spec.rb b/spec/commands/sidekiq_cluster/cli_spec.rb
index ecad3f6b0bf..223d0c3b0ec 100644
--- a/spec/commands/sidekiq_cluster/cli_spec.rb
+++ b/spec/commands/sidekiq_cluster/cli_spec.rb
@@ -402,32 +402,18 @@ RSpec.describe Gitlab::SidekiqCluster::CLI, stub_settings_source: true do # rubo
end
it 'stops the entire process cluster if one of the workers has been terminated' do
- expect(supervisor).to receive(:alive).and_return(true)
- expect(supervisor).to receive(:supervise).and_yield([2])
expect(MetricsServer).to receive(:start_for_sidekiq).once.and_return(metrics_server_pid)
- expect(Gitlab::ProcessManagement).to receive(:signal_processes).with([42, 99], :TERM)
+ expect(supervisor).to receive(:supervise).and_yield([2, 99])
+ expect(supervisor).to receive(:shutdown)
cli.run(%w(foo))
end
- context 'when the supervisor is alive' do
- it 'restarts the metrics server when it is down' do
- expect(supervisor).to receive(:alive).and_return(true)
- expect(supervisor).to receive(:supervise).and_yield([metrics_server_pid])
- expect(MetricsServer).to receive(:start_for_sidekiq).twice.and_return(metrics_server_pid)
+ it 'restarts the metrics server when it is down' do
+ expect(supervisor).to receive(:supervise).and_yield([metrics_server_pid])
+ expect(MetricsServer).to receive(:start_for_sidekiq).twice.and_return(metrics_server_pid)
- cli.run(%w(foo))
- end
- end
-
- context 'when the supervisor is shutting down' do
- it 'does not restart the metrics server' do
- expect(supervisor).to receive(:alive).and_return(false)
- expect(supervisor).to receive(:supervise).and_yield([metrics_server_pid])
- expect(MetricsServer).to receive(:start_for_sidekiq).once.and_return(metrics_server_pid)
-
- cli.run(%w(foo))
- end
+ cli.run(%w(foo))
end
end
end
diff --git a/spec/controllers/groups_controller_spec.rb b/spec/controllers/groups_controller_spec.rb
index 1a2c2b646a4..d61541ffe90 100644
--- a/spec/controllers/groups_controller_spec.rb
+++ b/spec/controllers/groups_controller_spec.rb
@@ -787,7 +787,7 @@ RSpec.describe GroupsController, factory_default: :keep do
end
it 'does not update the attribute' do
- expect { subject }.not_to change { group.namespace_settings.reload.prevent_sharing_groups_outside_hierarchy }
+ expect { subject }.not_to change { group.reload.prevent_sharing_groups_outside_hierarchy }
expect(response).to have_gitlab_http_status(:not_found)
end
diff --git a/spec/features/groups/group_settings_spec.rb b/spec/features/groups/group_settings_spec.rb
index 50982cb1452..019b094ccb5 100644
--- a/spec/features/groups/group_settings_spec.rb
+++ b/spec/features/groups/group_settings_spec.rb
@@ -223,7 +223,7 @@ RSpec.describe 'Edit group settings' do
check 'group_prevent_sharing_groups_outside_hierarchy'
expect { save_permissions_group }.to change {
- group.reload.namespace_settings.prevent_sharing_groups_outside_hierarchy
+ group.reload.prevent_sharing_groups_outside_hierarchy
}.to(true)
end
diff --git a/spec/frontend/branches/components/delete_branch_modal_spec.js b/spec/frontend/branches/components/delete_branch_modal_spec.js
index 0c6111bda9e..2b8c8d408c4 100644
--- a/spec/frontend/branches/components/delete_branch_modal_spec.js
+++ b/spec/frontend/branches/components/delete_branch_modal_spec.js
@@ -49,7 +49,7 @@ const findForm = () => wrapper.find('form');
describe('Delete branch modal', () => {
const expectedUnmergedWarning =
- 'This branch hasn’t been merged into default. To avoid data loss, consider merging this branch before deleting it.';
+ "This branch hasn't been merged into default. To avoid data loss, consider merging this branch before deleting it.";
afterEach(() => {
wrapper.destroy();
@@ -110,7 +110,7 @@ describe('Delete branch modal', () => {
"You're about to permanently delete the protected branch test_modal.";
const expectedMessageProtected = `${expectedWarningProtected} ${expectedUnmergedWarning}`;
const expectedConfirmationText =
- 'Once you confirm and press Yes, delete protected branch, it cannot be undone or recovered. Please type the following to confirm: test_modal';
+ 'After you confirm and select Yes, delete protected branch, you cannot recover this branch. Please type the following to confirm: test_modal';
beforeEach(() => {
createComponent({ isProtectedBranch: true });
diff --git a/spec/frontend/cycle_analytics/base_spec.js b/spec/frontend/cycle_analytics/base_spec.js
index bdf35f904ed..7b1ef71da63 100644
--- a/spec/frontend/cycle_analytics/base_spec.js
+++ b/spec/frontend/cycle_analytics/base_spec.js
@@ -143,12 +143,9 @@ describe('Value stream analytics component', () => {
expect(findFilters().props()).toEqual({
groupId,
groupPath,
- canToggleAggregation: false,
endDate: createdBefore,
hasDateRangeFilter: true,
hasProjectFilter: false,
- isAggregationEnabled: false,
- isUpdatingAggregationData: false,
selectedProjects: [],
startDate: createdAfter,
});
diff --git a/spec/frontend/cycle_analytics/value_stream_filters_spec.js b/spec/frontend/cycle_analytics/value_stream_filters_spec.js
index f3ae6e6cf76..6e96a6d756a 100644
--- a/spec/frontend/cycle_analytics/value_stream_filters_spec.js
+++ b/spec/frontend/cycle_analytics/value_stream_filters_spec.js
@@ -1,5 +1,4 @@
import { shallowMount } from '@vue/test-utils';
-import { GlToggle } from '@gitlab/ui';
import Daterange from '~/analytics/shared/components/daterange.vue';
import ProjectsDropdownFilter from '~/analytics/shared/components/projects_dropdown_filter.vue';
import FilterBar from '~/cycle_analytics/components/filter_bar.vue';
@@ -30,7 +29,6 @@ describe('ValueStreamFilters', () => {
const findProjectsDropdown = () => wrapper.findComponent(ProjectsDropdownFilter);
const findDateRangePicker = () => wrapper.findComponent(Daterange);
const findFilterBar = () => wrapper.findComponent(FilterBar);
- const findAggregationToggle = () => wrapper.findComponent(GlToggle);
beforeEach(() => {
wrapper = createComponent();
@@ -59,10 +57,6 @@ describe('ValueStreamFilters', () => {
expect(findDateRangePicker().exists()).toBe(true);
});
- it('will not render the aggregation toggle', () => {
- expect(findAggregationToggle().exists()).toBe(false);
- });
-
it('will emit `selectProject` when a project is selected', () => {
findProjectsDropdown().vm.$emit('selected');
@@ -94,52 +88,4 @@ describe('ValueStreamFilters', () => {
expect(findProjectsDropdown().exists()).toBe(false);
});
});
-
- describe('canToggleAggregation = true', () => {
- beforeEach(() => {
- wrapper = createComponent({ isAggregationEnabled: false, canToggleAggregation: true });
- });
-
- it('will render the aggregation toggle', () => {
- expect(findAggregationToggle().exists()).toBe(true);
- });
-
- it('will set the aggregation toggle to the `isAggregationEnabled` value', () => {
- expect(findAggregationToggle().props('value')).toBe(false);
-
- wrapper = createComponent({
- isAggregationEnabled: true,
- canToggleAggregation: true,
- });
-
- expect(findAggregationToggle().props('value')).toBe(true);
- });
-
- it('will emit `toggleAggregation` when the toggle is changed', () => {
- expect(wrapper.emitted('toggleAggregation')).toBeUndefined();
-
- findAggregationToggle().vm.$emit('change', true);
-
- expect(wrapper.emitted('toggleAggregation')).toHaveLength(1);
- expect(wrapper.emitted('toggleAggregation')).toEqual([[true]]);
- });
- });
-
- describe('isUpdatingAggregationData = true', () => {
- beforeEach(() => {
- wrapper = createComponent({ canToggleAggregation: true, isUpdatingAggregationData: true });
- });
-
- it('will disable the aggregation toggle', () => {
- expect(findAggregationToggle().props('disabled')).toBe(true);
- });
-
- it('will not emit `toggleAggregation` when the toggle is changed', () => {
- expect(wrapper.emitted('toggleAggregation')).toBeUndefined();
-
- findAggregationToggle().vm.$emit('change', true);
-
- expect(wrapper.emitted('toggleAggregation')).toBeUndefined();
- });
- });
});
diff --git a/spec/frontend/vue_shared/components/date_time_picker/date_time_picker_spec.js b/spec/frontend/vue_shared/components/date_time_picker/date_time_picker_spec.js
index d4b6b987c69..aa41df438d2 100644
--- a/spec/frontend/vue_shared/components/date_time_picker/date_time_picker_spec.js
+++ b/spec/frontend/vue_shared/components/date_time_picker/date_time_picker_spec.js
@@ -15,7 +15,7 @@ describe('DateTimePicker', () => {
const dropdownToggle = () => wrapper.find('.dropdown-toggle');
const dropdownMenu = () => wrapper.find('.dropdown-menu');
const cancelButton = () => wrapper.find('[data-testid="cancelButton"]');
- const applyButtonElement = () => wrapper.find('button.btn-success').element;
+ const applyButtonElement = () => wrapper.find('button.btn-confirm').element;
const findQuickRangeItems = () => wrapper.findAll('.dropdown-item');
const createComponent = (props) => {
diff --git a/spec/helpers/invite_members_helper_spec.rb b/spec/helpers/invite_members_helper_spec.rb
index 1e439bfbdbb..4d47732e008 100644
--- a/spec/helpers/invite_members_helper_spec.rb
+++ b/spec/helpers/invite_members_helper_spec.rb
@@ -35,7 +35,7 @@ RSpec.describe InviteMembersHelper do
let_it_be(:group) { create(:group) }
before do
- group.namespace_settings.update!(prevent_sharing_groups_outside_hierarchy: true)
+ group.update!(prevent_sharing_groups_outside_hierarchy: true)
end
it 'provides the correct attributes' do
@@ -45,7 +45,7 @@ RSpec.describe InviteMembersHelper do
context 'when sharing with groups outside the hierarchy is enabled' do
before do
- group.namespace_settings.update!(prevent_sharing_groups_outside_hierarchy: false)
+ group.update!(prevent_sharing_groups_outside_hierarchy: false)
end
it 'does not return filter attributes' do
diff --git a/spec/lib/container_registry/migration_spec.rb b/spec/lib/container_registry/migration_spec.rb
index 416e39b3aa6..654991fd61a 100644
--- a/spec/lib/container_registry/migration_spec.rb
+++ b/spec/lib/container_registry/migration_spec.rb
@@ -189,4 +189,18 @@ RSpec.describe ContainerRegistry::Migration do
it { is_expected.to eq(false) }
end
end
+
+ describe '.enqueue_twice?' do
+ subject { described_class.enqueue_twice? }
+
+ it { is_expected.to eq(true) }
+
+ context 'feature flag disabled' do
+ before do
+ stub_feature_flags(container_registry_migration_phase2_enqueue_twice: false)
+ end
+
+ it { is_expected.to eq(false) }
+ end
+ end
end
diff --git a/spec/lib/gitlab/background_migration/backfill_artifact_expiry_date_spec.rb b/spec/lib/gitlab/background_migration/backfill_artifact_expiry_date_spec.rb
deleted file mode 100644
index f5d2224747a..00000000000
--- a/spec/lib/gitlab/background_migration/backfill_artifact_expiry_date_spec.rb
+++ /dev/null
@@ -1,82 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe Gitlab::BackgroundMigration::BackfillArtifactExpiryDate, :migration, schema: 20210301200959 do
- subject(:perform) { migration.perform(1, 99) }
-
- let(:migration) { described_class.new }
- let(:artifact_outside_id_range) { create_artifact!(id: 100, created_at: 1.year.ago, expire_at: nil) }
- let(:artifact_outside_date_range) { create_artifact!(id: 40, created_at: Time.current, expire_at: nil) }
- let(:old_artifact) { create_artifact!(id: 10, created_at: 16.months.ago, expire_at: nil) }
- let(:recent_artifact) { create_artifact!(id: 20, created_at: 1.year.ago, expire_at: nil) }
- let(:artifact_with_expiry) { create_artifact!(id: 30, created_at: 1.year.ago, expire_at: Time.current + 1.day) }
-
- before do
- table(:namespaces).create!(id: 1, name: 'the-namespace', path: 'the-path')
- table(:projects).create!(id: 1, name: 'the-project', namespace_id: 1)
- table(:ci_builds).create!(id: 1, allow_failure: false)
- end
-
- context 'when current date is before the 22nd' do
- before do
- travel_to(Time.zone.local(2020, 1, 1, 0, 0, 0))
- end
-
- it 'backfills the expiry date for old artifacts' do
- expect(old_artifact.reload.expire_at).to eq(nil)
-
- perform
-
- expect(old_artifact.reload.expire_at).to be_within(1.minute).of(Time.zone.local(2020, 4, 22, 0, 0, 0))
- end
-
- it 'backfills the expiry date for recent artifacts' do
- expect(recent_artifact.reload.expire_at).to eq(nil)
-
- perform
-
- expect(recent_artifact.reload.expire_at).to be_within(1.minute).of(Time.zone.local(2021, 1, 22, 0, 0, 0))
- end
- end
-
- context 'when current date is after the 22nd' do
- before do
- travel_to(Time.zone.local(2020, 1, 23, 0, 0, 0))
- end
-
- it 'backfills the expiry date for old artifacts' do
- expect(old_artifact.reload.expire_at).to eq(nil)
-
- perform
-
- expect(old_artifact.reload.expire_at).to be_within(1.minute).of(Time.zone.local(2020, 5, 22, 0, 0, 0))
- end
-
- it 'backfills the expiry date for recent artifacts' do
- expect(recent_artifact.reload.expire_at).to eq(nil)
-
- perform
-
- expect(recent_artifact.reload.expire_at).to be_within(1.minute).of(Time.zone.local(2021, 2, 22, 0, 0, 0))
- end
- end
-
- it 'does not touch artifacts with expiry date' do
- expect { perform }.not_to change { artifact_with_expiry.reload.expire_at }
- end
-
- it 'does not touch artifacts outside id range' do
- expect { perform }.not_to change { artifact_outside_id_range.reload.expire_at }
- end
-
- it 'does not touch artifacts outside date range' do
- expect { perform }.not_to change { artifact_outside_date_range.reload.expire_at }
- end
-
- private
-
- def create_artifact!(**args)
- table(:ci_job_artifacts).create!(**args, project_id: 1, job_id: 1, file_type: 1)
- end
-end
diff --git a/spec/lib/gitlab/ci/config/entry/job_spec.rb b/spec/lib/gitlab/ci/config/entry/job_spec.rb
index 97691504abd..ca336c3ecaa 100644
--- a/spec/lib/gitlab/ci/config/entry/job_spec.rb
+++ b/spec/lib/gitlab/ci/config/entry/job_spec.rb
@@ -27,7 +27,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Job do
subject { described_class.nodes.keys }
let(:result) do
- %i[before_script script stage type after_script cache
+ %i[before_script script stage after_script cache
image services only except rules needs variables artifacts
environment coverage retry interruptible timeout release tags
inherit parallel]
diff --git a/spec/lib/gitlab/ci/config/entry/root_spec.rb b/spec/lib/gitlab/ci/config/entry/root_spec.rb
index b9c32bc51be..55ad119ea21 100644
--- a/spec/lib/gitlab/ci/config/entry/root_spec.rb
+++ b/spec/lib/gitlab/ci/config/entry/root_spec.rb
@@ -21,7 +21,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Root do
# The purpose of `Root` is have only globally defined configuration.
expect(described_class.nodes.keys)
.to match_array(%i[before_script image services after_script
- variables cache stages types include default workflow])
+ variables cache stages include default workflow])
end
end
end
@@ -55,41 +55,6 @@ RSpec.describe Gitlab::Ci::Config::Entry::Root do
}
end
- context 'when deprecated types/type keywords are defined' do
- let(:project) { create(:project, :repository) }
- let(:user) { create(:user) }
-
- let(:hash) do
- { types: %w(test deploy),
- rspec: { script: 'rspec', type: 'test' } }
- end
-
- before do
- root.compose!
- end
-
- it 'returns array of types as stages with a warning' do
- expect(root.jobs_value[:rspec][:stage]).to eq 'test'
- expect(root.stages_value).to eq %w[test deploy]
- expect(root.warnings).to match_array([
- "root `types` is deprecated in 9.0 and will be removed in 15.0.",
- "jobs:rspec `type` is deprecated in 9.0 and will be removed in 15.0."
- ])
- end
-
- it 'logs usage of keywords' do
- expect(Gitlab::AppJsonLogger).to(
- receive(:info)
- .with(event: 'ci_used_deprecated_keyword',
- entry: root[:stages].key.to_s,
- user_id: user.id,
- project_id: project.id)
- )
-
- root.compose!
- end
- end
-
describe '#compose!' do
before do
root.compose!
diff --git a/spec/lib/gitlab/ci/yaml_processor_spec.rb b/spec/lib/gitlab/ci/yaml_processor_spec.rb
index 9b68ee2d6a2..1910057622b 100644
--- a/spec/lib/gitlab/ci/yaml_processor_spec.rb
+++ b/spec/lib/gitlab/ci/yaml_processor_spec.rb
@@ -630,7 +630,7 @@ module Gitlab
describe 'only / except policies validations' do
context 'when `only` has an invalid value' do
- let(:config) { { rspec: { script: "rspec", type: "test", only: only } } }
+ let(:config) { { rspec: { script: "rspec", stage: "test", only: only } } }
subject { Gitlab::Ci::YamlProcessor.new(YAML.dump(config)).execute }
@@ -2606,19 +2606,19 @@ module Gitlab
end
context 'returns errors if job stage is not a string' do
- let(:config) { YAML.dump({ rspec: { script: "test", type: 1 } }) }
+ let(:config) { YAML.dump({ rspec: { script: "test", stage: 1 } }) }
- it_behaves_like 'returns errors', 'jobs:rspec:type config should be a string'
+ it_behaves_like 'returns errors', 'jobs:rspec:stage config should be a string'
end
context 'returns errors if job stage is not a pre-defined stage' do
- let(:config) { YAML.dump({ rspec: { script: "test", type: "acceptance" } }) }
+ let(:config) { YAML.dump({ rspec: { script: "test", stage: "acceptance" } }) }
it_behaves_like 'returns errors', 'rspec job: chosen stage does not exist; available stages are .pre, build, test, deploy, .post'
end
context 'returns errors if job stage is not a defined stage' do
- let(:config) { YAML.dump({ stages: %w(build test), rspec: { script: "test", type: "acceptance" } }) }
+ let(:config) { YAML.dump({ stages: %w(build test), rspec: { script: "test", stage: "acceptance" } }) }
it_behaves_like 'returns errors', 'rspec job: chosen stage does not exist; available stages are .pre, build, test, .post'
end
diff --git a/spec/lib/gitlab/process_supervisor_spec.rb b/spec/lib/gitlab/process_supervisor_spec.rb
index 60b127dadda..8356197805c 100644
--- a/spec/lib/gitlab/process_supervisor_spec.rb
+++ b/spec/lib/gitlab/process_supervisor_spec.rb
@@ -6,6 +6,7 @@ RSpec.describe Gitlab::ProcessSupervisor do
let(:health_check_interval_seconds) { 0.1 }
let(:check_terminate_interval_seconds) { 1 }
let(:forwarded_signals) { [] }
+ let(:term_signals) { [] }
let(:process_ids) { [spawn_process, spawn_process] }
def spawn_process
@@ -19,7 +20,8 @@ RSpec.describe Gitlab::ProcessSupervisor do
health_check_interval_seconds: health_check_interval_seconds,
check_terminate_interval_seconds: check_terminate_interval_seconds,
terminate_timeout_seconds: 1 + check_terminate_interval_seconds,
- forwarded_signals: forwarded_signals
+ forwarded_signals: forwarded_signals,
+ term_signals: term_signals
)
end
@@ -29,6 +31,8 @@ RSpec.describe Gitlab::ProcessSupervisor do
rescue Errno::ESRCH
# Ignore if a process wasn't actually alive.
end
+
+ supervisor.stop
end
describe '#supervise' do
@@ -60,7 +64,7 @@ RSpec.describe Gitlab::ProcessSupervisor do
[42] # Fake starting a new process in place of the terminated one.
end
- # Terminate the supervised process.
+ # Terminate a supervised process.
Process.kill('TERM', process_ids.first)
await_condition(sleep_sec: health_check_interval_seconds) do
@@ -71,6 +75,72 @@ RSpec.describe Gitlab::ProcessSupervisor do
expect(Gitlab::ProcessManagement.process_alive?(process_ids.last)).to be(true)
expect(supervisor.supervised_pids).to match_array([process_ids.last, 42])
end
+
+ it 'deduplicates PIDs returned from callback' do
+ expect(Gitlab::ProcessManagement.all_alive?(process_ids)).to be(true)
+ pids_killed = []
+
+ supervisor.supervise(process_ids) do |dead_pids|
+ pids_killed = dead_pids
+ # Fake a new process having the same pid as one that was just terminated.
+ [process_ids.last]
+ end
+
+ # Terminate a supervised process.
+ Process.kill('TERM', process_ids.first)
+
+ await_condition(sleep_sec: health_check_interval_seconds) do
+ pids_killed == [process_ids.first]
+ end
+
+ expect(supervisor.supervised_pids).to contain_exactly(process_ids.last)
+ end
+
+ it 'accepts single PID returned from callback' do
+ expect(Gitlab::ProcessManagement.all_alive?(process_ids)).to be(true)
+ pids_killed = []
+
+ supervisor.supervise(process_ids) do |dead_pids|
+ pids_killed = dead_pids
+ 42
+ end
+
+ # Terminate a supervised process.
+ Process.kill('TERM', process_ids.first)
+
+ await_condition(sleep_sec: health_check_interval_seconds) do
+ pids_killed == [process_ids.first]
+ end
+
+ expect(supervisor.supervised_pids).to contain_exactly(42, process_ids.last)
+ end
+
+ context 'but supervisor has entered shutdown' do
+ it 'does not trigger callback again' do
+ expect(Gitlab::ProcessManagement.all_alive?(process_ids)).to be(true)
+ callback_count = 0
+
+ supervisor.supervise(process_ids) do |dead_pids|
+ callback_count += 1
+
+ Thread.new { supervisor.shutdown }
+
+ [42]
+ end
+
+ # Terminate the supervised processes to trigger more than 1 callback.
+ Process.kill('TERM', process_ids.first)
+ Process.kill('TERM', process_ids.last)
+
+ await_condition(sleep_sec: health_check_interval_seconds * 3) do
+ supervisor.alive == false
+ end
+
+ # Since we shut down the supervisor during the first callback, it should not
+ # be called anymore.
+ expect(callback_count).to eq(1)
+ end
+ end
end
context 'signal handling' do
@@ -82,6 +152,8 @@ RSpec.describe Gitlab::ProcessSupervisor do
end
context 'termination signals' do
+ let(:term_signals) { %i(INT TERM) }
+
context 'when TERM results in timely shutdown of processes' do
it 'forwards them to observed processes without waiting for grace period to expire' do
allow(Gitlab::ProcessManagement).to receive(:any_alive?).and_return(false)
diff --git a/spec/metrics_server/metrics_server_spec.rb b/spec/metrics_server/metrics_server_spec.rb
index 4a3580ed4b1..7cc4f6724c4 100644
--- a/spec/metrics_server/metrics_server_spec.rb
+++ b/spec/metrics_server/metrics_server_spec.rb
@@ -267,28 +267,13 @@ RSpec.describe MetricsServer do # rubocop:disable RSpec/FilePath
end
context 'when the supervisor callback is invoked' do
- context 'and the supervisor is alive' do
- it 'restarts the metrics server' do
- expect(supervisor).to receive(:alive).and_return(true)
- expect(supervisor).to receive(:supervise).and_yield
- expect(Process).to receive(:spawn).with(
- include('METRICS_SERVER_TARGET' => 'puma'), end_with('bin/metrics-server'), anything
- ).twice.and_return(42)
-
- described_class.start_for_puma
- end
- end
+ it 'restarts the metrics server' do
+ expect(supervisor).to receive(:supervise).and_yield
+ expect(Process).to receive(:spawn).with(
+ include('METRICS_SERVER_TARGET' => 'puma'), end_with('bin/metrics-server'), anything
+ ).twice.and_return(42)
- context 'and the supervisor is not alive' do
- it 'does not restart the server' do
- expect(supervisor).to receive(:alive).and_return(false)
- expect(supervisor).to receive(:supervise).and_yield
- expect(Process).to receive(:spawn).with(
- include('METRICS_SERVER_TARGET' => 'puma'), end_with('bin/metrics-server'), anything
- ).once.and_return(42)
-
- described_class.start_for_puma
- end
+ described_class.start_for_puma
end
end
end
diff --git a/spec/migrations/20210413132500_reschedule_artifact_expiry_backfill_again_spec.rb b/spec/migrations/20210413132500_reschedule_artifact_expiry_backfill_again_spec.rb
deleted file mode 100644
index e1dc7487222..00000000000
--- a/spec/migrations/20210413132500_reschedule_artifact_expiry_backfill_again_spec.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-require_migration!
-
-RSpec.describe RescheduleArtifactExpiryBackfillAgain, :migration do
- let(:migration_class) { Gitlab::BackgroundMigration::BackfillArtifactExpiryDate }
- let(:migration_name) { migration_class.to_s.demodulize }
-
- before do
- table(:namespaces).create!(id: 123, name: 'test_namespace', path: 'test_namespace')
- table(:projects).create!(id: 123, name: 'sample_project', path: 'sample_project', namespace_id: 123)
- end
-
- it 'correctly schedules background migrations' do
- first_artifact = create_artifact(job_id: 0, expire_at: nil, created_at: Date.new(2020, 06, 21))
- second_artifact = create_artifact(job_id: 1, expire_at: nil, created_at: Date.new(2020, 06, 21))
- create_artifact(job_id: 2, expire_at: Date.yesterday, created_at: Date.new(2020, 06, 21))
- create_artifact(job_id: 3, expire_at: nil, created_at: Date.new(2020, 06, 23))
-
- Sidekiq::Testing.fake! do
- freeze_time do
- migrate!
-
- expect(BackgroundMigrationWorker.jobs.size).to eq(1)
- expect(migration_name).to be_scheduled_migration_with_multiple_args(first_artifact.id, second_artifact.id)
- end
- end
- end
-
- private
-
- def create_artifact(params)
- table(:ci_builds).create!(id: params[:job_id], project_id: 123)
- table(:ci_job_artifacts).create!(project_id: 123, file_type: 1, **params)
- end
-end
diff --git a/spec/models/container_repository_spec.rb b/spec/models/container_repository_spec.rb
index 7d0dfad91b2..af4e40cecb7 100644
--- a/spec/models/container_repository_spec.rb
+++ b/spec/models/container_repository_spec.rb
@@ -208,9 +208,23 @@ RSpec.describe ContainerRepository, :aggregate_failures do
shared_examples 'queueing the next import' do
it 'starts the worker' do
expect(::ContainerRegistry::Migration::EnqueuerWorker).to receive(:perform_async)
+ expect(::ContainerRegistry::Migration::EnqueuerWorker).to receive(:perform_in)
subject
end
+
+ context 'enqueue_twice feature flag disabled' do
+ before do
+ stub_feature_flags(container_registry_migration_phase2_enqueue_twice: false)
+ end
+
+ it 'starts the worker only once' do
+ expect(::ContainerRegistry::Migration::EnqueuerWorker).to receive(:perform_async)
+ expect(::ContainerRegistry::Migration::EnqueuerWorker).not_to receive(:perform_in)
+
+ subject
+ end
+ end
end
describe '#start_pre_import' do
diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb
index abfde1291cf..4373d9a0b24 100644
--- a/spec/models/namespace_spec.rb
+++ b/spec/models/namespace_spec.rb
@@ -338,6 +338,15 @@ RSpec.describe Namespace do
describe 'delegate' do
it { is_expected.to delegate_method(:name).to(:owner).with_prefix.with_arguments(allow_nil: true) }
it { is_expected.to delegate_method(:avatar_url).to(:owner).with_arguments(allow_nil: true) }
+ it do
+ is_expected.to delegate_method(:prevent_sharing_groups_outside_hierarchy)
+ .to(:namespace_settings).with_arguments(allow_nil: true)
+ end
+
+ it do
+ is_expected.to delegate_method(:prevent_sharing_groups_outside_hierarchy=)
+ .to(:namespace_settings).with_arguments(allow_nil: true)
+ end
end
describe "Respond to" do
diff --git a/spec/requests/api/graphql/ci/config_spec.rb b/spec/requests/api/graphql/ci/config_spec.rb
index d5ef9fdd783..5f4cc50ad10 100644
--- a/spec/requests/api/graphql/ci/config_spec.rb
+++ b/spec/requests/api/graphql/ci/config_spec.rb
@@ -234,24 +234,6 @@ RSpec.describe 'Query.ciConfig' do
)
end
- context 'when using deprecated keywords' do
- let_it_be(:content) do
- YAML.dump(
- rspec: { script: 'ls', type: 'test' },
- types: ['test']
- )
- end
-
- it 'returns a warning' do
- post_graphql_query
-
- expect(graphql_data['ciConfig']['warnings']).to include(
- 'root `types` is deprecated in 9.0 and will be removed in 15.0.',
- 'jobs:rspec `type` is deprecated in 9.0 and will be removed in 15.0.'
- )
- end
- end
-
context 'when the config file includes other files' do
let_it_be(:content) do
YAML.dump(
diff --git a/spec/requests/api/internal/container_registry/migration_spec.rb b/spec/requests/api/internal/container_registry/migration_spec.rb
index 017ea22a748..db2918e65f1 100644
--- a/spec/requests/api/internal/container_registry/migration_spec.rb
+++ b/spec/requests/api/internal/container_registry/migration_spec.rb
@@ -127,6 +127,12 @@ RSpec.describe API::Internal::ContainerRegistry::Migration, :aggregate_failures
it_behaves_like 'updating the repository migration status', from: 'pre_importing', to: 'import_aborted'
end
+
+ context 'with repository in unabortable migration state' do
+ let(:repository) { create(:container_repository, :import_skipped) }
+
+ it_behaves_like 'returning an error', with_message: 'Wrong migration state (import_skipped)'
+ end
end
end
diff --git a/spec/requests/api/lint_spec.rb b/spec/requests/api/lint_spec.rb
index 148410ecaa8..5d8ed3dd0f5 100644
--- a/spec/requests/api/lint_spec.rb
+++ b/spec/requests/api/lint_spec.rb
@@ -154,19 +154,6 @@ RSpec.describe API::Lint do
end
end
- context 'with valid .gitlab-ci.yml using deprecated keywords' do
- let(:yaml_content) { { job: { script: 'ls', type: 'test' }, types: ['test'] }.to_yaml }
-
- it 'passes validation but returns warnings' do
- post api('/ci/lint', api_user), params: { content: yaml_content }
-
- expect(response).to have_gitlab_http_status(:ok)
- expect(json_response['status']).to eq('valid')
- expect(json_response['warnings']).not_to be_empty
- expect(json_response['errors']).to match_array([])
- end
- end
-
context 'with an invalid .gitlab-ci.yml' do
context 'with invalid syntax' do
let(:yaml_content) { 'invalid content' }
diff --git a/spec/support/shared_examples/features/inviting_groups_shared_examples.rb b/spec/support/shared_examples/features/inviting_groups_shared_examples.rb
index f7b0410a0da..4921676a065 100644
--- a/spec/support/shared_examples/features/inviting_groups_shared_examples.rb
+++ b/spec/support/shared_examples/features/inviting_groups_shared_examples.rb
@@ -125,7 +125,7 @@ RSpec.shared_examples 'inviting groups search results' do
context 'when sharing with groups outside the hierarchy is disabled' do
before do
- group.namespace_settings.update!(prevent_sharing_groups_outside_hierarchy: true)
+ group.update!(prevent_sharing_groups_outside_hierarchy: true)
end
it 'shows only groups within the hierarchy in search results' do
diff --git a/spec/workers/container_registry/migration/enqueuer_worker_spec.rb b/spec/workers/container_registry/migration/enqueuer_worker_spec.rb
index a24b46501e9..0ae31422d12 100644
--- a/spec/workers/container_registry/migration/enqueuer_worker_spec.rb
+++ b/spec/workers/container_registry/migration/enqueuer_worker_spec.rb
@@ -37,9 +37,23 @@ RSpec.describe ContainerRegistry::Migration::EnqueuerWorker, :aggregate_failures
it 're-enqueues the worker' do
expect(described_class).to receive(:perform_async)
+ expect(described_class).to receive(:perform_in).with(7.seconds)
subject
end
+
+ context 'enqueue_twice feature flag disabled' do
+ before do
+ stub_feature_flags(container_registry_migration_phase2_enqueue_twice: false)
+ end
+
+ it 'only enqueues the worker once' do
+ expect(described_class).to receive(:perform_async)
+ expect(described_class).not_to receive(:perform_in)
+
+ subject
+ end
+ end
end
context 'above capacity' do
@@ -49,6 +63,7 @@ RSpec.describe ContainerRegistry::Migration::EnqueuerWorker, :aggregate_failures
it 'does not re-enqueue the worker' do
expect(described_class).not_to receive(:perform_async)
+ expect(described_class).not_to receive(:perform_in).with(7.seconds)
subject
end
@@ -95,6 +110,7 @@ RSpec.describe ContainerRegistry::Migration::EnqueuerWorker, :aggregate_failures
it 'does not re-enqueue the worker' do
expect(described_class).not_to receive(:perform_async)
+ expect(described_class).not_to receive(:perform_in)
subject
end
@@ -142,6 +158,7 @@ RSpec.describe ContainerRegistry::Migration::EnqueuerWorker, :aggregate_failures
it 'does not re-enqueue the worker' do
expect(ContainerRegistry::Migration::EnqueuerWorker).not_to receive(:perform_async)
+ expect(ContainerRegistry::Migration::EnqueuerWorker).not_to receive(:perform_in)
subject
end