diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-23 09:10:23 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-23 09:10:23 +0000 |
commit | 946a41d182e40dd37f73c44721edc9bc9c1a0f7c (patch) | |
tree | 28f1f399faebd1bd7084522919bd8b6354c3debd | |
parent | 8b4276f873461953ee5a1fc46f084779f5847e3a (diff) | |
download | gitlab-ce-946a41d182e40dd37f73c44721edc9bc9c1a0f7c.tar.gz |
Add latest changes from gitlab-org/gitlab@master
-rw-r--r-- | Gemfile | 2 | ||||
-rw-r--r-- | Gemfile.checksum | 2 | ||||
-rw-r--r-- | Gemfile.lock | 6 | ||||
-rw-r--r-- | app/assets/javascripts/diffs/components/file_row_stats.vue | 2 | ||||
-rw-r--r-- | app/assets/javascripts/ref/components/ref_selector.vue | 1 | ||||
-rw-r--r-- | app/assets/javascripts/work_items/components/work_item_actions.vue | 1 | ||||
-rw-r--r-- | app/assets/stylesheets/framework/modal.scss | 2 | ||||
-rw-r--r-- | app/graphql/resolvers/project_merge_requests_resolver.rb | 8 | ||||
-rw-r--r-- | config/feature_flags/development/vue_issues_dashboard.yml | 2 | ||||
-rw-r--r-- | doc/api/users.md | 2 | ||||
-rw-r--r-- | doc/development/database/add_foreign_key_to_existing_column.md | 19 | ||||
-rw-r--r-- | doc/development/deprecation_guidelines/index.md | 2 | ||||
-rw-r--r-- | doc/development/fe_guide/source_editor.md | 2 | ||||
-rw-r--r-- | lib/tasks/gitlab/db.rake | 30 | ||||
-rw-r--r-- | spec/requests/api/graphql/project/merge_requests_spec.rb | 3 | ||||
-rw-r--r-- | spec/tasks/gitlab/db_rake_spec.rb | 74 |
16 files changed, 137 insertions, 21 deletions
@@ -373,7 +373,7 @@ gem 'prometheus-client-mmap', '~> 0.17', require: 'prometheus/client' gem 'warning', '~> 1.3.0' group :development do - gem 'lefthook', '~> 1.3.0', require: false + gem 'lefthook', '~> 1.2.9', require: false gem 'rubocop' gem 'solargraph', '~> 0.47.2', require: false diff --git a/Gemfile.checksum b/Gemfile.checksum index 24ae815ae2e..2dbcae42f0f 100644 --- a/Gemfile.checksum +++ b/Gemfile.checksum @@ -314,7 +314,7 @@ {"name":"kramdown","version":"2.3.2","platform":"ruby","checksum":"cb4530c2e9d16481591df2c9336723683c354e5416a5dd3e447fa48215a6a71c"}, {"name":"kramdown-parser-gfm","version":"1.1.0","platform":"ruby","checksum":"fb39745516427d2988543bf01fc4cf0ab1149476382393e0e9c48592f6581729"}, {"name":"launchy","version":"2.5.0","platform":"ruby","checksum":"954243c4255920982ce682f89a42e76372dba94770bf09c23a523e204bdebef5"}, -{"name":"lefthook","version":"1.3.0","platform":"ruby","checksum":"46460ceb0084d1a60c7aa2872c90fd9a97d92c32063b41ac88303e1d1a382b43"}, +{"name":"lefthook","version":"1.2.9","platform":"ruby","checksum":"1fd4a768e08fc624e756597fc628b3c7991267325974a7a5cc169595b425701d"}, {"name":"letter_opener","version":"1.7.0","platform":"ruby","checksum":"095bc0d58e006e5b43ea7d219e64ecf2de8d1f7d9dafc432040a845cf59b4725"}, {"name":"letter_opener_web","version":"2.0.0","platform":"ruby","checksum":"33860ad41e1785d75456500e8ca8bba8ed71ee6eaf08a98d06bbab67c5577b6f"}, {"name":"libyajl2","version":"1.2.0","platform":"ruby","checksum":"1117cd1e48db013b626e36269bbf1cef210538ca6d2e62d3fa3db9ded005b258"}, diff --git a/Gemfile.lock b/Gemfile.lock index 3b0ee82c3c3..a3d6dc31fb6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -845,7 +845,7 @@ GEM kramdown (~> 2.0) launchy (2.5.0) addressable (~> 2.7) - lefthook (1.3.0) + lefthook (1.2.9) letter_opener (1.7.0) launchy (~> 2.2) letter_opener_web (2.0.0) @@ -1738,7 +1738,7 @@ DEPENDENCIES knapsack (~> 1.21.1) kramdown (~> 2.3.1) kubeclient (~> 4.9.3)! - lefthook (~> 1.3.0) + lefthook (~> 1.2.9) letter_opener_web (~> 2.0.0) license_finder (~> 7.0) licensee (~> 9.15) @@ -1893,4 +1893,4 @@ DEPENDENCIES yajl-ruby (~> 1.4.3) BUNDLED WITH - 2.4.7 + 2.4.6 diff --git a/app/assets/javascripts/diffs/components/file_row_stats.vue b/app/assets/javascripts/diffs/components/file_row_stats.vue index 784f74e498f..f99f363a6be 100644 --- a/app/assets/javascripts/diffs/components/file_row_stats.vue +++ b/app/assets/javascripts/diffs/components/file_row_stats.vue @@ -10,7 +10,7 @@ export default { </script> <template> - <span v-once class="file-row-stats"> + <span class="file-row-stats"> <span class="cgreen"> +{{ file.addedLines }} </span> <span class="cred"> -{{ file.removedLines }} </span> </span> diff --git a/app/assets/javascripts/ref/components/ref_selector.vue b/app/assets/javascripts/ref/components/ref_selector.vue index 359909b8f3b..9826124912b 100644 --- a/app/assets/javascripts/ref/components/ref_selector.vue +++ b/app/assets/javascripts/ref/components/ref_selector.vue @@ -119,6 +119,7 @@ export default { 'gl-inset-border-1-red-500!': !this.state, 'gl-font-monospace': Boolean(this.selectedRef), }, + 'gl-mb-0', ]; if (Array.isArray(this.toggleButtonClass)) { diff --git a/app/assets/javascripts/work_items/components/work_item_actions.vue b/app/assets/javascripts/work_items/components/work_item_actions.vue index 9f9d94ec3c2..3c56b627673 100644 --- a/app/assets/javascripts/work_items/components/work_item_actions.vue +++ b/app/assets/javascripts/work_items/components/work_item_actions.vue @@ -115,6 +115,7 @@ export default { v-if="canDelete" v-gl-modal="'work-item-confirm-delete'" data-testid="delete-action" + variant="danger" >{{ i18n.deleteWorkItem }}</gl-dropdown-item > </gl-dropdown> diff --git a/app/assets/stylesheets/framework/modal.scss b/app/assets/stylesheets/framework/modal.scss index c9b17f5d5c4..f76a9cf0373 100644 --- a/app/assets/stylesheets/framework/modal.scss +++ b/app/assets/stylesheets/framework/modal.scss @@ -45,7 +45,7 @@ margin: #{2 * $grid-size} #{-2 * $grid-size} #{-2 * $grid-size}; } - .text-danger { + .text-danger:not(.dropdown-item) { font-weight: $gl-font-weight-bold; } } diff --git a/app/graphql/resolvers/project_merge_requests_resolver.rb b/app/graphql/resolvers/project_merge_requests_resolver.rb index 66c020a0c14..6a240541341 100644 --- a/app/graphql/resolvers/project_merge_requests_resolver.rb +++ b/app/graphql/resolvers/project_merge_requests_resolver.rb @@ -22,7 +22,13 @@ module Resolvers def only_count_is_selected_with_merged_at_filter?(args) return unless lookahead - argument_names = args.compact.except(:lookahead, :sort, :merged_before, :merged_after).keys + # Filter out all elements with blank values. If any of the values are not + # scalars, e.g. hashes or array, filter blank values from them and remove + # them if the resulting collection is empty. + argument_names = args.except(:lookahead, :sort, :merged_before, :merged_after).filter_map do |key, value| + value = value.to_hash.compact if value.respond_to?(:to_hash) + key if value.present? + end # no extra filtering arguments are provided return unless argument_names.empty? diff --git a/config/feature_flags/development/vue_issues_dashboard.yml b/config/feature_flags/development/vue_issues_dashboard.yml index 133343b3a3c..3091cf8b8b4 100644 --- a/config/feature_flags/development/vue_issues_dashboard.yml +++ b/config/feature_flags/development/vue_issues_dashboard.yml @@ -5,4 +5,4 @@ rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/379025 milestone: '15.6' type: development group: group::project management -default_enabled: false +default_enabled: true diff --git a/doc/api/users.md b/doc/api/users.md index 4ecb3d48c0f..f877aa29b9c 100644 --- a/doc/api/users.md +++ b/doc/api/users.md @@ -41,7 +41,7 @@ GET /users You can also use `?search=` to search for users by name, username, or public email. For example, `/users?search=John`. When you search for a: -- Public email, you must use the full email address to get an exact match. +- Public email, you must use the full email address to get an exact match. A search might return a partial match. For example, if you search for the email `on@example.com`, the search can return both `on@example.com` and `jon@example.com`. - Name or username, you do not have to get an exact match because this is a fuzzy search. In addition, you can lookup users by username: diff --git a/doc/development/database/add_foreign_key_to_existing_column.md b/doc/development/database/add_foreign_key_to_existing_column.md index 2c2999e69d6..a64fc047a57 100644 --- a/doc/development/database/add_foreign_key_to_existing_column.md +++ b/doc/development/database/add_foreign_key_to_existing_column.md @@ -155,13 +155,13 @@ To limit impact on GitLab.com, a process exists to validate them asynchronously during weekend hours. Due to generally lower traffic and fewer deployments, FK validation can proceed at a lower level of risk. -### Schedule foreign key validation for a low-impact time +#### Schedule foreign key validation for a low-impact time 1. [Schedule the FK to be validated](#schedule-the-fk-to-be-validated). 1. [Verify the MR was deployed and the FK is valid in production](#verify-the-mr-was-deployed-and-the-fk-is-valid-in-production). 1. [Add a migration to validate the FK synchronously](#add-a-migration-to-validate-the-fk-synchronously). -### Schedule the FK to be validated +#### Schedule the FK to be validated 1. Create a merge request containing a post-deployment migration, which prepares the foreign key for asynchronous validation. @@ -198,7 +198,7 @@ def down end ``` -### Verify the MR was deployed and the FK is valid in production +#### Verify the MR was deployed and the FK is valid in production 1. Verify that the post-deploy migration was executed on GitLab.com using ChatOps with `/chatops run auto_deploy status <merge_sha>`. If the output returns `db/gprd`, @@ -208,7 +208,7 @@ end 1. Use [Database Lab](database_lab.md) to check if validation was successful. Ensure the output does not indicate the foreign key is `NOT VALID`. -### Add a migration to validate the FK synchronously +#### Add a migration to validate the FK synchronously After the foreign key is valid on the production database, create a second merge request that validates the foreign key synchronously. The schema changes @@ -240,19 +240,20 @@ end ``` -## Test database FK changes locally +### Test database FK changes locally You must test the database foreign key changes locally before creating a merge request. -### Verify the foreign keys validated asynchronously +#### Verify the foreign keys validated asynchronously Use the asynchronous helpers on your local environment to test changes for validating a foreign key: -1. Enable the feature flags by running `Feature.enable(:database_async_foreign_key_validation)` - and `Feature.enable(:database_reindexing)` in the Rails console. +1. Enable the feature flag by running `Feature.enable(:database_async_foreign_key_validation)` + in the Rails console. 1. Run `bundle exec rails db:migrate` so that it creates an entry in the async validation table. -1. Run `bundle exec rails gitlab:db:reindex` so that the FK is validated asynchronously. +1. Run `bundle exec rails gitlab:db:execute_async_fk_validations:all` so that the FK is validated + asynchronously on all databases. 1. To verify the foreign key, open the PostgreSQL console using the [GDK](https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/howto/postgresql.md) command `gdk psql` and run the command `\d+ table_name` to check that your diff --git a/doc/development/deprecation_guidelines/index.md b/doc/development/deprecation_guidelines/index.md index e532fa82011..703228ab05e 100644 --- a/doc/development/deprecation_guidelines/index.md +++ b/doc/development/deprecation_guidelines/index.md @@ -62,6 +62,8 @@ A breaking change can be considered major if it affects many users, or represent Deprecations should be announced on the [Deprecated feature removal schedule](../../update/deprecations.md). +Deprecations should be announced [no later than the third milestone preceding intended removal](https://about.gitlab.com/handbook/product/gitlab-the-product/#process-for-deprecating-and-removing-a-feature). + Do not include the deprecation announcement in the merge request that introduces a code change for the deprecation. Use a separate MR to create a deprecation entry. For steps to create a deprecation entry, see [Deprecations](https://about.gitlab.com/handbook/marketing/blog/release-posts/#deprecations). diff --git a/doc/development/fe_guide/source_editor.md b/doc/development/fe_guide/source_editor.md index 1cea8ccb1ab..9f52850041d 100644 --- a/doc/development/fe_guide/source_editor.md +++ b/doc/development/fe_guide/source_editor.md @@ -1,6 +1,6 @@ --- stage: Create -group: Editor +group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments --- diff --git a/lib/tasks/gitlab/db.rake b/lib/tasks/gitlab/db.rake index c4dc7b938cc..3ff512fd686 100644 --- a/lib/tasks/gitlab/db.rake +++ b/lib/tasks/gitlab/db.rake @@ -313,6 +313,36 @@ namespace :gitlab do end end + namespace :execute_async_fk_validations do + each_database(databases) do |database_name| + task database_name, [:pick] => :environment do |_, args| + args.with_defaults(pick: 2) + + if Feature.disabled?(:database_async_foreign_key_validation, type: :ops) + puts <<~NOTE.color(:yellow) + Note: database async foreign key validation feature is currently disabled. + + Enable with: Feature.enable(:database_async_foreign_key_validation) + NOTE + exit + end + + Gitlab::Database::EachDatabase.each_database_connection(only: database_name) do + Gitlab::Database::AsyncForeignKeys.validate_pending_entries!(how_many: args[:pick].to_i) + end + end + end + + task :all, [:pick] => :environment do |_, args| + default_pick = Gitlab.dev_or_test_env? ? 1000 : 2 + args.with_defaults(pick: default_pick) + + each_database(databases) do |database_name| + Rake::Task["gitlab:db:execute_async_fk_validations:#{database_name}"].invoke(args[:pick]) + end + end + end + desc 'Check if there have been user additions to the database' task active: :environment do if ActiveRecord::Base.connection.migration_context.needs_migration? diff --git a/spec/requests/api/graphql/project/merge_requests_spec.rb b/spec/requests/api/graphql/project/merge_requests_spec.rb index 8407faa967e..156886ca211 100644 --- a/spec/requests/api/graphql/project/merge_requests_spec.rb +++ b/spec/requests/api/graphql/project/merge_requests_spec.rb @@ -588,8 +588,9 @@ RSpec.describe 'getting merge request listings nested in a project', feature_cat end let(:query) do + # Adding a no-op `not` filter to mimic the same query as the frontend does graphql_query_for(:project, { full_path: project.full_path }, <<~QUERY) - mergeRequests(mergedAfter: "2020-01-01", mergedBefore: "2020-01-05", first: 0) { + mergeRequests(mergedAfter: "2020-01-01", mergedBefore: "2020-01-05", first: 0, not: { labels: null }) { totalTimeToMerge count } diff --git a/spec/tasks/gitlab/db_rake_spec.rb b/spec/tasks/gitlab/db_rake_spec.rb index 933eba40719..a9977e07feb 100644 --- a/spec/tasks/gitlab/db_rake_spec.rb +++ b/spec/tasks/gitlab/db_rake_spec.rb @@ -805,6 +805,80 @@ RSpec.describe 'gitlab:db namespace rake task', :silence_stdout, feature_categor end end + describe 'execute_async_fk_validations' do + before do + skip_if_multiple_databases_not_setup + end + + it 'delegates ci task to Gitlab::Database::AsyncForeignKeys' do + expect(Gitlab::Database::AsyncForeignKeys).to receive(:validate_pending_entries!).with(how_many: 2) + + run_rake_task('gitlab:db:execute_async_fk_validations:ci') + end + + it 'delegates ci task to Gitlab::Database::AsyncForeignKeys with specified argument' do + expect(Gitlab::Database::AsyncForeignKeys).to receive(:validate_pending_entries!).with(how_many: 5) + + run_rake_task('gitlab:db:execute_async_fk_validations:ci', '[5]') + end + + it 'delegates main task to Gitlab::Database::AsyncForeignKeys' do + expect(Gitlab::Database::AsyncForeignKeys).to receive(:validate_pending_entries!).with(how_many: 2) + + run_rake_task('gitlab:db:execute_async_fk_validations:main') + end + + it 'delegates main task to Gitlab::Database::AsyncForeignKeys with specified argument' do + expect(Gitlab::Database::AsyncForeignKeys).to receive(:validate_pending_entries!).with(how_many: 7) + + run_rake_task('gitlab:db:execute_async_fk_validations:main', '[7]') + end + + it 'delegates all task to every database with higher default for dev' do + expect(Rake::Task['gitlab:db:execute_async_fk_validations:ci']).to receive(:invoke).with(1000) + expect(Rake::Task['gitlab:db:execute_async_fk_validations:main']).to receive(:invoke).with(1000) + + run_rake_task('gitlab:db:execute_async_fk_validations:all') + end + + it 'delegates all task to every database with lower default for prod' do + allow(Gitlab).to receive(:dev_or_test_env?).and_return(false) + + expect(Rake::Task['gitlab:db:execute_async_fk_validations:ci']).to receive(:invoke).with(2) + expect(Rake::Task['gitlab:db:execute_async_fk_validations:main']).to receive(:invoke).with(2) + + run_rake_task('gitlab:db:execute_async_fk_validations:all') + end + + it 'delegates all task to every database with specified argument' do + expect(Rake::Task['gitlab:db:execute_async_fk_validations:ci']).to receive(:invoke).with('50') + expect(Rake::Task['gitlab:db:execute_async_fk_validations:main']).to receive(:invoke).with('50') + + run_rake_task('gitlab:db:execute_async_fk_validations:all', '[50]') + end + + context 'when feature is not enabled' do + it 'is a no-op' do + stub_feature_flags(database_async_foreign_key_validation: false) + + expect(Gitlab::Database::AsyncForeignKeys).not_to receive(:validate_pending_entries!) + + expect { run_rake_task('gitlab:db:execute_async_fk_validations:main') }.to raise_error(SystemExit) + end + end + + context 'with geo configured' do + before do + skip_unless_geo_configured + end + + it 'does not create a task for the geo database' do + expect { run_rake_task('gitlab:db:execute_async_fk_validations:geo') } + .to raise_error(/Don't know how to build task 'gitlab:db:execute_async_fk_validations:geo'/) + end + end + end + describe 'active' do using RSpec::Parameterized::TableSyntax |