diff --git a/.gitlab/ci/yaml.gitlab-ci.yml b/.gitlab/ci/yaml.gitlab-ci.yml index 606bb385325..ac32e4226e2 100644 --- a/.gitlab/ci/yaml.gitlab-ci.yml +++ b/.gitlab/ci/yaml.gitlab-ci.yml @@ -11,3 +11,15 @@ lint-yaml: LINT_PATHS: .gitlab-ci.yml .gitlab/ci lib/gitlab/ci/templates data/deprecations data/removals data/whats_new script: - yamllint --strict -f colored $LINT_PATHS + +lint-metrics-yaml: + extends: + - .default-retry + - .yaml-lint:rules + image: pipelinecomponents/yamllint:latest + stage: lint + needs: [] + variables: + LINT_PATHS: config/metrics + script: + - 'yamllint --strict -f colored -d "{extends: default, rules: {line-length: disable, document-start: disable, indentation: {spaces: 2, indent-sequences: whatever}}}" $LINT_PATHS' diff --git a/app/views/groups/show.html.haml b/app/views/groups/show.html.haml index bb409190dd8..0f91ecae3c9 100644 --- a/app/views/groups/show.html.haml +++ b/app/views/groups/show.html.haml @@ -37,16 +37,15 @@ .scrolling-tabs-container.inner-page-scroll-tabs .fade-left= sprite_icon('chevron-lg-left', size: 12) .fade-right= sprite_icon('chevron-lg-right', size: 12) - %ul.nav-links.scrolling-tabs.mobile-separator.nav.nav-tabs - %li.js-subgroups_and_projects-tab - = link_to group_path, data: { target: 'div#subgroups_and_projects', action: 'subgroups_and_projects', toggle: 'tab'} do - = _("Subgroups and projects") - %li.js-shared-tab - = link_to group_shared_path, data: { target: 'div#shared', action: 'shared', toggle: 'tab'} do - = _("Shared projects") - %li.js-archived-tab - = link_to group_archived_path, data: { target: 'div#archived', action: 'archived', toggle: 'tab'} do - = _("Archived projects") + -# `item_active` is set to `false` as the active state is set by `app/assets/javascripts/pages/groups/shared/group_details.js` + -# TODO: Replace this approach in https://gitlab.com/gitlab-org/gitlab/-/issues/23466 + = gl_tabs_nav({ class: 'nav-links scrolling-tabs gl-display-flex gl-flex-grow-1 gl-flex-nowrap gl-border-0' }) do + = gl_tab_link_to group_path, item_active: false, tab_class: 'js-subgroups_and_projects-tab', data: { target: 'div#subgroups_and_projects', action: 'subgroups_and_projects', toggle: 'tab' } do + = _("Subgroups and projects") + = gl_tab_link_to group_shared_path, item_active: false, tab_class: 'js-shared-tab', data: { target: 'div#shared', action: 'shared', toggle: 'tab' } do + = _("Shared projects") + = gl_tab_link_to group_archived_path, item_active: false, tab_class: 'js-archived-tab', data: { target: 'div#archived', action: 'archived', toggle: 'tab' } do + = _("Archived projects") .nav-controls.d-block.d-md-flex .group-search diff --git a/app/views/shared/empty_states/_milestones.html.haml b/app/views/shared/empty_states/_milestones.html.haml index 90697795d62..fb69e75370e 100644 --- a/app/views/shared/empty_states/_milestones.html.haml +++ b/app/views/shared/empty_states/_milestones.html.haml @@ -9,5 +9,5 @@ .text-content %h4= s_('Milestones|Use milestones to track issues and merge requests over a fixed period of time') %p.state-description - = s_('Milestones|Organize issues and merge requests into a cohesive group, and set an optional start and due dates. %{learn_more_link}').html_safe % { learn_more_link: learn_more_link } + = s_('Milestones|Organize issues and merge requests into a cohesive group, and set optional start and due dates. %{learn_more_link}').html_safe % { learn_more_link: learn_more_link } = yield diff --git a/db/post_migrate/20220322071127_finalize_project_namespaces_backfill.rb b/db/post_migrate/20220322071127_finalize_project_namespaces_backfill.rb new file mode 100644 index 00000000000..5a4d14dcfb7 --- /dev/null +++ b/db/post_migrate/20220322071127_finalize_project_namespaces_backfill.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +# This migration acts as a gate-keeper for other migrations related to project namespace back-filling +# so that other migrations that depend on project namespace back-filling cannot be run unless project namespace +# back-filling has finalized successfully. +class FinalizeProjectNamespacesBackfill < Gitlab::Database::Migration[1.0] + MIGRATION = 'ProjectNamespaces::BackfillProjectNamespaces' + + def up + ensure_batched_background_migration_is_finished( + job_class_name: MIGRATION, + table_name: :projects, + column_name: :id, + job_arguments: [nil, 'up'] + ) + end + + def down + # noop + end +end diff --git a/db/schema_migrations/20220322071127 b/db/schema_migrations/20220322071127 new file mode 100644 index 00000000000..0f7ddb48545 --- /dev/null +++ b/db/schema_migrations/20220322071127 @@ -0,0 +1 @@ +c7d84b6d92566d66f69732071fe7fc6c4e5ce32475e0d2c42413c9f005aed5b0 \ No newline at end of file diff --git a/doc/development/contributing/issue_workflow.md b/doc/development/contributing/issue_workflow.md index 4db686b9b1e..fe1549e7f34 100644 --- a/doc/development/contributing/issue_workflow.md +++ b/doc/development/contributing/issue_workflow.md @@ -31,11 +31,7 @@ on those issues. Please select someone with relevant experience from the If there is nobody mentioned with that expertise, look in the commit history for the affected files to find someone. -We also use [GitLab Triage](https://gitlab.com/gitlab-org/gitlab-triage) to automate -some triaging policies. This is currently set up as a scheduled pipeline -(`https://gitlab.com/gitlab-org/quality/triage-ops/-/pipeline_schedules/10512/edit`, -must have at least the Developer role in the project) running on [quality/triage-ops](https://gitlab.com/gitlab-org/quality/triage-ops) -project. +We also have triage automation in place, described [in our handbook](https://about.gitlab.com/handbook/engineering/quality/triage-operations/). ## Labels diff --git a/lib/gitlab/background_migration/backfill_work_item_type_id_for_issues.rb b/lib/gitlab/background_migration/backfill_work_item_type_id_for_issues.rb index 96f9eacc54b..a16efa4222b 100644 --- a/lib/gitlab/background_migration/backfill_work_item_type_id_for_issues.rb +++ b/lib/gitlab/background_migration/backfill_work_item_type_id_for_issues.rb @@ -48,7 +48,7 @@ module Gitlab begin update_batch(sub_batch, base_type_id) - rescue ActiveRecord::StatementTimeout => e + rescue ActiveRecord::StatementTimeout, ActiveRecord::QueryCanceled => e update_attempt += 1 if update_attempt <= MAX_UPDATE_RETRIES diff --git a/lib/gitlab/ci/templates/Jobs/SAST.gitlab-ci.yml b/lib/gitlab/ci/templates/Jobs/SAST.gitlab-ci.yml index 8cc9ea0200c..241eae89dd3 100644 --- a/lib/gitlab/ci/templates/Jobs/SAST.gitlab-ci.yml +++ b/lib/gitlab/ci/templates/Jobs/SAST.gitlab-ci.yml @@ -101,7 +101,11 @@ flawfinder-sast: - if: $CI_COMMIT_BRANCH exists: - '**/*.c' + - '**/*.cc' - '**/*.cpp' + - '**/*.c++' + - '**/*.cp' + - '**/*.cxx' kubesec-sast: extends: .sast-analyzer diff --git a/locale/gitlab.pot b/locale/gitlab.pot index e087afb6790..b93d9ede7ef 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -24166,7 +24166,7 @@ msgstr "" msgid "Milestones|Ongoing Issues (open and assigned)" msgstr "" -msgid "Milestones|Organize issues and merge requests into a cohesive group, and set an optional start and due dates. %{learn_more_link}" +msgid "Milestones|Organize issues and merge requests into a cohesive group, and set optional start and due dates. %{learn_more_link}" msgstr "" msgid "Milestones|Project Milestone" diff --git a/spec/lib/gitlab/background_migration/backfill_work_item_type_id_for_issues_spec.rb b/spec/lib/gitlab/background_migration/backfill_work_item_type_id_for_issues_spec.rb index 195ccd80dd1..4ff7c6d2f07 100644 --- a/spec/lib/gitlab/background_migration/backfill_work_item_type_id_for_issues_spec.rb +++ b/spec/lib/gitlab/background_migration/backfill_work_item_type_id_for_issues_spec.rb @@ -48,12 +48,20 @@ RSpec.describe Gitlab::BackgroundMigration::BackfillWorkItemTypeIdForIssues do expect { migrate }.to change { migration.batch_metrics.timings } end - it 'retries on ActiveRecord::StatementTimeout' do - expect(migration).to receive(:update_batch).exactly(3).times.and_raise(ActiveRecord::StatementTimeout) - expect(migration).to receive(:sleep).with(30).twice + context 'when database timeouts' do + using RSpec::Parameterized::TableSyntax - expect do - migrate - end.to raise_error(ActiveRecord::StatementTimeout) + where(error_class: [ActiveRecord::StatementTimeout, ActiveRecord::QueryCanceled]) + + with_them do + it 'retries on timeout error' do + expect(migration).to receive(:update_batch).exactly(3).times.and_raise(error_class) + expect(migration).to receive(:sleep).with(30).twice + + expect do + migrate + end.to raise_error(error_class) + end + end end end diff --git a/spec/migrations/finalize_project_namespaces_backfill_spec.rb b/spec/migrations/finalize_project_namespaces_backfill_spec.rb new file mode 100644 index 00000000000..3d0b0ec13fe --- /dev/null +++ b/spec/migrations/finalize_project_namespaces_backfill_spec.rb @@ -0,0 +1,69 @@ +# frozen_string_literal: true + +require 'spec_helper' +require_migration! + +RSpec.describe FinalizeProjectNamespacesBackfill, :migration do + let(:batched_migrations) { table(:batched_background_migrations) } + + let_it_be(:migration) { described_class::MIGRATION } + + describe '#up' do + shared_examples 'raises migration not finished exception' do + it 'raises exception' do + expect { migrate! }.to raise_error(/Expected batched background migration for the given configuration to be marked as 'finished'/) + end + end + + context 'when project namespace backfilling migration is missing' do + it 'warns migration not found' do + expect(Gitlab::AppLogger) + .to receive(:warn).with(/Could not find batched background migration for the given configuration:/) + + migrate! + end + end + + context 'with backfilling migration present' do + let!(:project_namespace_backfill) do + batched_migrations.create!( + job_class_name: 'ProjectNamespaces::BackfillProjectNamespaces', + table_name: :projects, + column_name: :id, + job_arguments: [nil, 'up'], + interval: 2.minutes, + min_value: 1, + max_value: 2, + batch_size: 1000, + sub_batch_size: 200, + status: 3 # finished + ) + end + + context 'when project namespace backfilling migration finished successfully' do + it 'does not raise exception' do + expect { migrate! }.not_to raise_error(/Expected batched background migration for the given configuration to be marked as 'finished'/) + end + end + + context 'when project namespace backfilling migration is paused' do + using RSpec::Parameterized::TableSyntax + + where(:status, :description) do + 0 | 'paused' + 1 | 'active' + 4 | 'failed' + 5 | 'finalizing' + end + + with_them do + before do + project_namespace_backfill.update!(status: status) + end + + it_behaves_like 'raises migration not finished exception' + end + end + end + end +end