diff options
17 files changed, 147 insertions, 35 deletions
diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION index cd169869e27..d5e752b92d5 100644 --- a/GITALY_SERVER_VERSION +++ b/GITALY_SERVER_VERSION @@ -1 +1 @@ -28e6eebf54f40a2ff820c996698c720b1a898266 +d554b758056dd291fec6fbe6083e941ccf316fdb diff --git a/app/assets/javascripts/cycle_analytics/components/formatted_stage_count.vue b/app/assets/javascripts/cycle_analytics/components/formatted_stage_count.vue index 0fcfeb93e34..b622b0441e2 100644 --- a/app/assets/javascripts/cycle_analytics/components/formatted_stage_count.vue +++ b/app/assets/javascripts/cycle_analytics/components/formatted_stage_count.vue @@ -1,5 +1,5 @@ <script> -import { s__, n__, sprintf } from '~/locale'; +import { s__, n__, sprintf, formatNumber } from '~/locale'; export default { props: { @@ -14,10 +14,14 @@ export default { if (!this.stageCount) { return '-'; } else if (this.stageCount > 1000) { - return sprintf(s__('ValueStreamAnalytics|%{stageCount} items'), { stageCount: '1000+' }); + return sprintf(s__('ValueStreamAnalytics|%{stageCount}+ items'), { + stageCount: formatNumber(1000), + }); } - return n__('%d item', '%d items', this.stageCount); + return sprintf(n__('%{count} item', '%{count} items', this.stageCount), { + count: formatNumber(this.stageCount), + }); }, }, }; diff --git a/app/assets/javascripts/cycle_analytics/components/path_navigation.vue b/app/assets/javascripts/cycle_analytics/components/path_navigation.vue index aa929e076a5..47fafc3b90c 100644 --- a/app/assets/javascripts/cycle_analytics/components/path_navigation.vue +++ b/app/assets/javascripts/cycle_analytics/components/path_navigation.vue @@ -46,9 +46,6 @@ export default { showPopover({ id }) { return id && id !== OVERVIEW_STAGE_ID; }, - hasStageCount({ stageCount = null }) { - return stageCount !== null; - }, onSelectStage($event) { this.$emit('selected', $event); this.track('click_path_navigation', { diff --git a/app/models/ci/application_record.rb b/app/models/ci/base_model.rb index f338770a938..8fb752ead1d 100644 --- a/app/models/ci/application_record.rb +++ b/app/models/ci/base_model.rb @@ -7,7 +7,7 @@ module Ci # This class is part of a migration to move all CI classes to a new separate database. # Initially we are only going to be moving the `Ci::InstanceVariable` model and it will be duplicated in the main and CI tables # Do not extend this class in any other models. - class ApplicationRecord < ::ApplicationRecord + class BaseModel < ::ApplicationRecord self.abstract_class = true if Gitlab::Database.has_config?(:ci) diff --git a/app/models/ci/instance_variable.rb b/app/models/ci/instance_variable.rb index 67b98a0b8b6..5aee4c924af 100644 --- a/app/models/ci/instance_variable.rb +++ b/app/models/ci/instance_variable.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Ci - class InstanceVariable < ::Ci::ApplicationRecord + class InstanceVariable < ::Ci::BaseModel extend Gitlab::Ci::Model extend Gitlab::ProcessMemoryCache::Helper include Ci::NewHasVariable diff --git a/db/migrate/20201224144948_migrate_coverage_report_worker.rb b/db/migrate/20201224144948_migrate_coverage_report_worker.rb index a13e5e859e0..8580a15c256 100644 --- a/db/migrate/20201224144948_migrate_coverage_report_worker.rb +++ b/db/migrate/20201224144948_migrate_coverage_report_worker.rb @@ -6,10 +6,10 @@ class MigrateCoverageReportWorker < ActiveRecord::Migration[6.0] DOWNTIME = false def up - sidekiq_queue_migrate 'ci_pipelines_create_artifact', to: 'ci_pipeline_artifacts_coverage_report' + sidekiq_queue_migrate 'ci_pipelines_create_artifact', to: 'ci_pipeline_artifacts_coverage_report' # rubocop:disable Migration/SidekiqQueueMigrate end def down - sidekiq_queue_migrate 'ci_pipeline_artifacts_coverage_report', to: 'ci_pipelines_create_artifact' + sidekiq_queue_migrate 'ci_pipeline_artifacts_coverage_report', to: 'ci_pipelines_create_artifact' # rubocop:disable Migration/SidekiqQueueMigrate end end diff --git a/db/migrate/20210526155257_rename_sync_security_report_approval_rules_sidekiq_queue.rb b/db/migrate/20210526155257_rename_sync_security_report_approval_rules_sidekiq_queue.rb index b9cefe456b8..51f234166de 100644 --- a/db/migrate/20210526155257_rename_sync_security_report_approval_rules_sidekiq_queue.rb +++ b/db/migrate/20210526155257_rename_sync_security_report_approval_rules_sidekiq_queue.rb @@ -6,10 +6,10 @@ class RenameSyncSecurityReportApprovalRulesSidekiqQueue < ActiveRecord::Migratio DOWNTIME = false def up - sidekiq_queue_migrate 'sync_security_reports_to_report_approval_rules', to: 'ci_sync_reports_to_report_approval_rules' + sidekiq_queue_migrate 'sync_security_reports_to_report_approval_rules', to: 'ci_sync_reports_to_report_approval_rules' # rubocop:disable Migration/SidekiqQueueMigrate end def down - sidekiq_queue_migrate 'ci_sync_reports_to_report_approval_rules', to: 'sync_security_reports_to_report_approval_rules' + sidekiq_queue_migrate 'ci_sync_reports_to_report_approval_rules', to: 'sync_security_reports_to_report_approval_rules' # rubocop:disable Migration/SidekiqQueueMigrate end end diff --git a/doc/administration/geo/replication/version_specific_updates.md b/doc/administration/geo/replication/version_specific_updates.md index 301be931b29..557f93c3712 100644 --- a/doc/administration/geo/replication/version_specific_updates.md +++ b/doc/administration/geo/replication/version_specific_updates.md @@ -18,9 +18,8 @@ We found an [issue with Git clone/pull through HTTP(s)](https://gitlab.com/gitla ## Updating to GitLab 13.9 We've detected an issue [with a column rename](https://gitlab.com/gitlab-org/gitlab/-/issues/324160) -that may prevent upgrades to GitLab 13.9.0, 13.9.1, 13.9.2 and 13.9.3. -We are working on a patch, but until a fixed version is released, you can manually complete -the zero-downtime upgrade: +that will prevent upgrades to GitLab 13.9.0, 13.9.1, 13.9.2 and 13.9.3 when following the zero-downtime steps. It is necessary +to perform the following additional steps for the zero-downtime upgrade: 1. Before running the final `sudo gitlab-rake db:migrate` command on the deploy node, execute the following queries using the PostgreSQL console (or `sudo gitlab-psql`) @@ -40,9 +39,18 @@ the zero-downtime upgrade: ``` If you have already run the final `sudo gitlab-rake db:migrate` command on the deploy node and have -encountered the [column rename issue](https://gitlab.com/gitlab-org/gitlab/-/issues/324160), you can still -follow the previous steps to complete the update. +encountered the [column rename issue](https://gitlab.com/gitlab-org/gitlab/-/issues/324160), you will +see the following error: +```shell +-- remove_column(:application_settings, :asset_proxy_whitelist) +rake aborted! +StandardError: An error has occurred, all later migrations canceled: +PG::DependentObjectsStillExist: ERROR: cannot drop column asset_proxy_whitelist of table application_settings because other objects depend on it +DETAIL: trigger trigger_0d588df444c8 on table application_settings depends on column asset_proxy_whitelist of table application_settings +``` + +To work around this bug, follow the previous steps to complete the update. More details are available [in this issue](https://gitlab.com/gitlab-org/gitlab/-/issues/324160). ## Updating to GitLab 13.7 diff --git a/doc/development/database/multiple_databases.md b/doc/development/database/multiple_databases.md index dbc8ab0f215..d8ff7ef1167 100644 --- a/doc/development/database/multiple_databases.md +++ b/doc/development/database/multiple_databases.md @@ -95,7 +95,7 @@ database. This is to match the default name Rails has. ### Migrations -Any migrations that affect `Ci::ApplicationRecord` models +Any migrations that affect `Ci::BaseModel` models and their tables must be placed in two directories for now: - `db/migrate` diff --git a/doc/development/foreign_keys.md b/doc/development/foreign_keys.md index abe191ace5e..0c68e8a5b34 100644 --- a/doc/development/foreign_keys.md +++ b/doc/development/foreign_keys.md @@ -28,7 +28,8 @@ Guide](migration_style_guide.md) for more information. Keep in mind that you can only safely add foreign keys to existing tables after you have removed any orphaned rows. The method `add_concurrent_foreign_key` -does not take care of this so you'll need to do so manually. +does not take care of this so you'll need to do so manually. See +[adding foreign key constraint to an existing column](database/add_foreign_key_to_existing_column.md). ## Cascading Deletes diff --git a/doc/development/sidekiq_style_guide.md b/doc/development/sidekiq_style_guide.md index 70c1752a0f0..4e8228f9ad0 100644 --- a/doc/development/sidekiq_style_guide.md +++ b/doc/development/sidekiq_style_guide.md @@ -968,8 +968,8 @@ Sidekiq jobs, please consider removing the worker in a major release only. For the same reasons that removing workers is dangerous, care should be taken when renaming queues. -When renaming queues, use the `sidekiq_queue_migrate` helper migration method, -as shown in this example: +When renaming queues, use the `sidekiq_queue_migrate` helper migration method +in a **post-deployment migration**: ```ruby class MigrateTheRenamedSidekiqQueue < ActiveRecord::Migration[5.0] @@ -985,3 +985,7 @@ class MigrateTheRenamedSidekiqQueue < ActiveRecord::Migration[5.0] end ``` + +You must rename the queue in a post-deployment migration not in a normal +migration. Otherwise, it runs too early, before all the workers that +schedule these jobs have stopped running. See also [other examples](post_deployment_migrations.md#use-cases). diff --git a/doc/development/usage_ping/index.md b/doc/development/usage_ping/index.md index 30d85fe0df9..eae22b10a97 100644 --- a/doc/development/usage_ping/index.md +++ b/doc/development/usage_ping/index.md @@ -60,6 +60,20 @@ We use the following terminology to describe the Usage Ping components: - You get insight and advice into how to get the most value out of your investment in GitLab. Wouldn't you want to know that a number of features or values are not being adopted in your organization? - You get a report that illustrates how you compare against other similar organizations (anonymized), with specific advice and recommendations on how to improve your DevOps processes. - Usage Ping is enabled by default. To disable it, see [Disable Usage Ping](#disable-usage-ping). +- When Usage Ping is enabled, you have the option to participate in our [Registration Features Program](#registration-features-program) and receive free paid features. + +#### Registration Features Program + +> Introduced in GitLab 14.1. + +Starting with GitLab version 14.1, free self-managed users running [GitLab EE](../ee_features.md) can receive paid features by registering with GitLab and sending us activity data via [Usage Ping](#what-is-usage-ping). + +The paid feature available in this offering is [Email from GitLab](../../tools/email.md). +Administrators can use this [Premium](https://about.gitlab.com/pricing/premium/) feature to streamline +their workflow by emailing all or some instance users directly from the Admin Area. + +NOTE: +Registration is not yet required for participation, but will be added in a future milestone. ### Limitations diff --git a/doc/update/index.md b/doc/update/index.md index 928e1c154f6..789b2c22087 100644 --- a/doc/update/index.md +++ b/doc/update/index.md @@ -387,9 +387,8 @@ Git 2.31.x and later is required. We recommend you use the ### 13.9.0 We've detected an issue [with a column rename](https://gitlab.com/gitlab-org/gitlab/-/issues/324160) -that may prevent upgrades to GitLab 13.9.0, 13.9.1, 13.9.2 and 13.9.3. -We are working on a patch, but until a fixed version is released, you can manually complete -the zero-downtime upgrade: +that will prevent upgrades to GitLab 13.9.0, 13.9.1, 13.9.2 and 13.9.3 when following the zero-downtime steps. It is necessary +to perform the following additional steps for the zero-downtime upgrade: 1. Before running the final `sudo gitlab-rake db:migrate` command on the deploy node, execute the following queries using the PostgreSQL console (or `sudo gitlab-psql`) @@ -409,9 +408,18 @@ the zero-downtime upgrade: ``` If you have already run the final `sudo gitlab-rake db:migrate` command on the deploy node and have -encountered the [column rename issue](https://gitlab.com/gitlab-org/gitlab/-/issues/324160), you can still -follow the previous steps to complete the update. +encountered the [column rename issue](https://gitlab.com/gitlab-org/gitlab/-/issues/324160), you will +see the following error: +```shell +-- remove_column(:application_settings, :asset_proxy_whitelist) +rake aborted! +StandardError: An error has occurred, all later migrations canceled: +PG::DependentObjectsStillExist: ERROR: cannot drop column asset_proxy_whitelist of table application_settings because other objects depend on it +DETAIL: trigger trigger_0d588df444c8 on table application_settings depends on column asset_proxy_whitelist of table application_settings +``` + +To work around this bug, follow the previous steps to complete the update. More details are available [in this issue](https://gitlab.com/gitlab-org/gitlab/-/issues/324160). ### 13.6.0 diff --git a/locale/gitlab.pot b/locale/gitlab.pot index ec5e21c2739..05a511f3a2c 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -267,11 +267,6 @@ msgid_plural "%d issues successfully imported with the label" msgstr[0] "" msgstr[1] "" -msgid "%d item" -msgid_plural "%d items" -msgstr[0] "" -msgstr[1] "" - msgid "%d layer" msgid_plural "%d layers" msgstr[0] "" @@ -482,6 +477,11 @@ msgstr "" msgid "%{count} files touched" msgstr "" +msgid "%{count} item" +msgid_plural "%{count} items" +msgstr[0] "" +msgstr[1] "" + msgid "%{count} items per page" msgstr "" @@ -35658,7 +35658,7 @@ msgstr "" msgid "ValueStreamAnalyticsStage|We don't have enough data to show this stage." msgstr "" -msgid "ValueStreamAnalytics|%{stageCount} items" +msgid "ValueStreamAnalytics|%{stageCount}+ items" msgstr "" msgid "ValueStreamAnalytics|%{value}M" diff --git a/rubocop/cop/migration/sidekiq_queue_migrate.rb b/rubocop/cop/migration/sidekiq_queue_migrate.rb new file mode 100644 index 00000000000..134bda590da --- /dev/null +++ b/rubocop/cop/migration/sidekiq_queue_migrate.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +require_relative '../../migration_helpers' + +module RuboCop + module Cop + module Migration + # Cop that checks if sidekiq_queue_migrate is used in a regular + # (not post-deployment) migration. + class SidekiqQueueMigrate < RuboCop::Cop::Cop + include MigrationHelpers + + MSG = '`sidekiq_queue_migrate` must only be used in post-deployment migrations' + + def on_def(node) + return unless in_migration?(node) && !in_post_deployment_migration?(node) + + node.each_descendant(:send) do |send_node| + send_method = send_node.children[1] + + if send_method == :sidekiq_queue_migrate + add_offense(send_node, location: :selector) + end + end + end + end + end + end +end diff --git a/spec/frontend/cycle_analytics/formatted_stage_count_spec.js b/spec/frontend/cycle_analytics/formatted_stage_count_spec.js index 19f1a7187b3..1228b8511ea 100644 --- a/spec/frontend/cycle_analytics/formatted_stage_count_spec.js +++ b/spec/frontend/cycle_analytics/formatted_stage_count_spec.js @@ -25,8 +25,8 @@ describe('Formatted Stage Count', () => { ${null} | ${'-'} ${1} | ${'1 item'} ${10} | ${'10 items'} - ${1000} | ${'1000 items'} - ${1001} | ${'1000+ items'} + ${1000} | ${'1,000 items'} + ${1001} | ${'1,000+ items'} `('returns "$expectedOutput" for stageCount=$stageCount', ({ stageCount, expectedOutput }) => { createComponent(stageCount); expect(wrapper.text()).toContain(expectedOutput); diff --git a/spec/rubocop/cop/migration/sidekiq_queue_migrate_spec.rb b/spec/rubocop/cop/migration/sidekiq_queue_migrate_spec.rb new file mode 100644 index 00000000000..499351b3585 --- /dev/null +++ b/spec/rubocop/cop/migration/sidekiq_queue_migrate_spec.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +require 'fast_spec_helper' +require_relative '../../../../rubocop/cop/migration/sidekiq_queue_migrate' + +RSpec.describe RuboCop::Cop::Migration::SidekiqQueueMigrate do + subject(:cop) { described_class.new } + + def source(meth = 'change') + "def #{meth}; sidekiq_queue_migrate 'queue', to: 'new_queue'; end" + end + + context 'when in a regular migration' do + before do + allow(cop).to receive(:in_migration?).and_return(true) + allow(cop).to receive(:in_post_deployment_migration?).and_return(false) + end + + %w(up down change any_other_method).each do |method_name| + it "registers an offense when sidekiq_queue_migrate is used in ##{method_name}" do + expect_offense(<<~RUBY) + def #{method_name} + sidekiq_queue_migrate 'queue', to: 'new_queue' + ^^^^^^^^^^^^^^^^^^^^^ `sidekiq_queue_migrate` must only be used in post-deployment migrations + end + RUBY + end + end + end + + context 'when in a post-deployment migration' do + before do + allow(cop).to receive(:in_migration?).and_return(true) + allow(cop).to receive(:in_post_deployment_migration?).and_return(true) + end + + it 'registers no offense' do + expect_no_offenses(source) + end + end + + context 'when outside of a migration' do + it 'registers no offense' do + expect_no_offenses(source) + end + end +end |