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>2021-05-18 03:10:37 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-05-18 03:10:37 +0300
commit5ee9033e9db11ce04f5cc6d7bda32f8059a1f405 (patch)
tree37a34a5ecc9c5c4cb3338e2f8eb12409891bd1f4
parentcd8520845d9205622b5acf301b68c0ac7d81aaec (diff)
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--app/controllers/concerns/wiki_actions.rb3
-rw-r--r--app/services/wiki_pages/update_service.rb14
-rw-r--r--app/workers/database/batched_background_migration_worker.rb2
-rw-r--r--changelogs/unreleased/200002-changes-will-be-lost-if-multiple-people-edit-a-wiki-page.yml5
-rw-r--r--changelogs/unreleased/329511-enable-by-default-execute-batched-migrations-on-schedule.yml5
-rw-r--r--config/feature_flags/ops/execute_batched_migrations_on_schedule.yml2
-rw-r--r--doc/administration/compliance.md1
-rw-r--r--doc/update/index.md4
-rw-r--r--doc/user/admin_area/monitoring/background_migrations.md48
-rw-r--r--doc/user/project/repository/index.md48
-rw-r--r--lib/gitlab/analytics/cycle_analytics/base_query_builder.rb1
-rw-r--r--package.json4
-rw-r--r--spec/lib/gitlab/analytics/cycle_analytics/base_query_builder_spec.rb25
-rw-r--r--spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb20
-rw-r--r--yarn.lock16
15 files changed, 162 insertions, 36 deletions
diff --git a/app/controllers/concerns/wiki_actions.rb b/app/controllers/concerns/wiki_actions.rb
index 4f0351f2003..fc4f9aa3409 100644
--- a/app/controllers/concerns/wiki_actions.rb
+++ b/app/controllers/concerns/wiki_actions.rb
@@ -115,9 +115,6 @@ module WikiActions
@error = response.message
render 'shared/wikis/edit'
end
- rescue WikiPage::PageChangedError, WikiPage::PageRenameError => e
- @error = e.message
- render 'shared/wikis/edit'
end
# rubocop:enable Gitlab/ModuleWithInstanceVariables
diff --git a/app/services/wiki_pages/update_service.rb b/app/services/wiki_pages/update_service.rb
index f2fc6b37c34..88275f8c417 100644
--- a/app/services/wiki_pages/update_service.rb
+++ b/app/services/wiki_pages/update_service.rb
@@ -2,6 +2,8 @@
module WikiPages
class UpdateService < WikiPages::BaseService
+ UpdateError = Class.new(StandardError)
+
def execute(page)
# this class is not thread safe!
@old_slug = page.slug
@@ -10,11 +12,15 @@ module WikiPages
execute_hooks(page)
ServiceResponse.success(payload: { page: page })
else
- ServiceResponse.error(
- message: _('Could not update wiki page'),
- payload: { page: page }
- )
+ raise UpdateError, s_('Could not update wiki page')
end
+ rescue UpdateError, WikiPage::PageChangedError, WikiPage::PageRenameError => e
+ page.update_attributes(@params) # rubocop:disable Rails/ActiveRecordAliases
+
+ ServiceResponse.error(
+ message: e.message,
+ payload: { page: page }
+ )
end
def usage_counter_action
diff --git a/app/workers/database/batched_background_migration_worker.rb b/app/workers/database/batched_background_migration_worker.rb
index ba5b8f4f947..5a326a351e8 100644
--- a/app/workers/database/batched_background_migration_worker.rb
+++ b/app/workers/database/batched_background_migration_worker.rb
@@ -16,7 +16,7 @@ module Database
INTERVAL_VARIANCE = 5.seconds.freeze
def perform
- return unless Feature.enabled?(:execute_batched_migrations_on_schedule, type: :ops) && active_migration
+ return unless Feature.enabled?(:execute_batched_migrations_on_schedule, type: :ops, default_enabled: :yaml) && active_migration
with_exclusive_lease(active_migration.interval) do
# Now that we have the exclusive lease, reload migration in case another process has changed it.
diff --git a/changelogs/unreleased/200002-changes-will-be-lost-if-multiple-people-edit-a-wiki-page.yml b/changelogs/unreleased/200002-changes-will-be-lost-if-multiple-people-edit-a-wiki-page.yml
new file mode 100644
index 00000000000..e1c5815c77b
--- /dev/null
+++ b/changelogs/unreleased/200002-changes-will-be-lost-if-multiple-people-edit-a-wiki-page.yml
@@ -0,0 +1,5 @@
+---
+title: Preserve user changes in the wiki editor if multiple people edit the page
+merge_request: 61120
+author:
+type: fixed
diff --git a/changelogs/unreleased/329511-enable-by-default-execute-batched-migrations-on-schedule.yml b/changelogs/unreleased/329511-enable-by-default-execute-batched-migrations-on-schedule.yml
new file mode 100644
index 00000000000..3dd6051c628
--- /dev/null
+++ b/changelogs/unreleased/329511-enable-by-default-execute-batched-migrations-on-schedule.yml
@@ -0,0 +1,5 @@
+---
+title: Enable by default scheduled execution of batched background migrations
+merge_request: 61316
+author:
+type: added
diff --git a/config/feature_flags/ops/execute_batched_migrations_on_schedule.yml b/config/feature_flags/ops/execute_batched_migrations_on_schedule.yml
index f518849b57f..b739099fcd5 100644
--- a/config/feature_flags/ops/execute_batched_migrations_on_schedule.yml
+++ b/config/feature_flags/ops/execute_batched_migrations_on_schedule.yml
@@ -5,4 +5,4 @@ rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/326241
milestone: '13.11'
type: ops
group: group::database
-default_enabled: false
+default_enabled: true
diff --git a/doc/administration/compliance.md b/doc/administration/compliance.md
index 77174bf327f..470dc1b4f9e 100644
--- a/doc/administration/compliance.md
+++ b/doc/administration/compliance.md
@@ -29,3 +29,4 @@ relevant compliance standards.
|**Separation of Duties using [Protected branches](../user/project/protected_branches.md#protected-branches-approval-by-code-owners) and [custom CI Configuration Paths](../ci/pipelines/settings.md#custom-cicd-configuration-path)**<br> GitLab Premium users can leverage the GitLab cross-project YAML configurations to define deployers of code and developers of code. View the [Separation of Duties Deploy Project](https://gitlab.com/guided-explorations/separation-of-duties-deploy/blob/master/README.md) and [Separation of Duties Project](https://gitlab.com/guided-explorations/separation-of-duties/blob/master/README.md) to see how to use this set up to define these roles.|Premium+|✓|Project|
|**[Compliance frameworks](../user/project/settings/index.md#compliance-frameworks)**<br>Create a custom compliance framework at the group level to describe the type of compliance requirements any child project needs to follow. |Premium+|✓|Group|
|**[Compliance pipelines](../user/project/settings/index.md#compliance-pipeline-configuration)**<br>Define a pipeline configuration to run for any projects with a given compliance framework.|Ultimate|✓|Group|
+|**[Compliance dashboard](../user/compliance/compliance_dashboard/index.md)**<br>Quickly get visibility into the compliance posture of your organization.|Ultimate|✓|Group|
diff --git a/doc/update/index.md b/doc/update/index.md
index 4ae7a3b4854..3c2ea8e0d92 100644
--- a/doc/update/index.md
+++ b/doc/update/index.md
@@ -107,6 +107,10 @@ Sidekiq::Queue.new("background_migration").size
Sidekiq::ScheduledSet.new.select { |r| r.klass == 'BackgroundMigrationWorker' }.size
```
+### Batched background migrations
+
+See the documentation on [batched background migrations](../user/admin_area/monitoring/background_migrations.md).
+
### What do I do if my background migrations are stuck?
WARNING:
diff --git a/doc/user/admin_area/monitoring/background_migrations.md b/doc/user/admin_area/monitoring/background_migrations.md
new file mode 100644
index 00000000000..a68d7109429
--- /dev/null
+++ b/doc/user/admin_area/monitoring/background_migrations.md
@@ -0,0 +1,48 @@
+---
+stage: Enablement
+group: Database
+info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
+---
+
+# Batched Background Migrations **(FREE SELF)**
+
+> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/51332) in GitLab 13.11.
+> - [Deployed behind a feature flag](../../../user/feature_flags.md), disabled by default.
+> - [Enabled by default](https://gitlab.com/gitlab-org/gitlab/-/issues/329511) in GitLab 13.12.
+> - Enabled on GitLab.com.
+> - Recommended for production use.
+> - For GitLab self-managed instances, GitLab administrators can opt to [disable it](#enable-or-disable-batched-background-migrations). **(FREE SELF)**
+
+There can be [risks when disabling released features](../../../user/feature_flags.md#risks-when-disabling-released-features).
+Refer to this feature's version history for more details.
+
+To update database tables in batches, GitLab can use batched background migrations. These migrations
+are created by GitLab developers and run automatically on upgrade. However, such migrations are
+limited in scope to help with migrating some `integer` database columns to `bigint`. This is needed to
+prevent integer overflow for some tables.
+
+All migrations must be finished before upgrading GitLab. To check the status of the existing
+migrations, execute this command:
+
+```ruby
+Gitlab::Database::BackgroundMigration::BatchedMigration.pluck(:id, :table_name, :status)
+```
+
+## Enable or disable Batched Background Migrations **(FREE SELF)**
+
+Batched Background Migrations is under development but ready for production use.
+It is deployed behind a feature flag that is **enabled by default**.
+[GitLab administrators with access to the GitLab Rails console](../../../administration/feature_flags.md)
+can opt to disable it.
+
+To enable it:
+
+```ruby
+Feature.enable(:execute_batched_migrations_on_schedule)
+```
+
+To disable it:
+
+```ruby
+Feature.disable(:execute_batched_migrations_on_schedule)
+```
diff --git a/doc/user/project/repository/index.md b/doc/user/project/repository/index.md
index 33f439836b5..ed5bcc1f85a 100644
--- a/doc/user/project/repository/index.md
+++ b/doc/user/project/repository/index.md
@@ -226,6 +226,10 @@ detected, add the following to `.gitattributes` in the root of your repository.
*.proto linguist-detectable=true
```
+Sometimes this feature can use excessive CPU.
+[Read about troubleshooting this](#repository-languages-excessive-cpu-use)
+and also more about customizing this feature using `.gitattributes`.
+
## Locked files **(PREMIUM)**
Use [File Locking](../file_lock.md) to
@@ -310,14 +314,40 @@ When [renaming a user](../../profile/index.md#change-your-username),
- The redirects are available as long as the original path is not claimed by
another group, user or project.
-<!-- ## Troubleshooting
+## Troubleshooting
+
+### Repository Languages: excessive CPU use
+
+GitLab uses a Ruby gem to scan all the files in the repository to determine what languages are used.
+[Sometimes this can use excessive CPU](https://gitlab.com/gitlab-org/gitaly/-/issues/1565) if
+a file type needs to be parsed by the gem to determine what sort of file it is.
+The gem contains a [heuristics configuration file](https://github.com/github/linguist/blob/master/lib/linguist/heuristics.yml)
+that defines what file extensions need to be parsed.
+
+Excessive CPU use has been reported for files with the extension `.txt` and XML files with
+a file extension that is not defined by the gem.
+
+The workaround is to specify what language to assign to specific file extensions.
+The same approach should also allow misidentified file types to be fixed.
+
+1. Identify which language to specify. The gem contains a [configuration file for known data types](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml).
+ The entry for `Text` files, for example:
+
+ ```yaml
+ Text:
+ type: prose
+ wrap: true
+ aliases:
+ - fundamental
+ - plain text
+ extensions:
+ - ".txt"
+ ```
+
+1. Add or modify `.gitattributes` in the root of your repository:
-Include any troubleshooting steps that you can foresee. If you know beforehand what issues
-one might have when setting this up, or when something is changed, or on upgrading, it's
-important to describe those, too. Think of things that may go wrong and include them here.
-This is important to minimize requests for support, and to avoid doc comments with
-questions that you know someone might ask.
+ ```plaintext
+ *.txt linguist-language=Text
+ ```
-Each scenario can be a third-level heading, e.g. `### Getting error message X`.
-If you have none to add when creating a doc, leave this section in place
-but commented out to help encourage others to add to it in the future. -->
+ `*.txt` files have an entry in the heuristics file. The example above prevents parsing of these files.
diff --git a/lib/gitlab/analytics/cycle_analytics/base_query_builder.rb b/lib/gitlab/analytics/cycle_analytics/base_query_builder.rb
index 2607723ec60..c7987d63153 100644
--- a/lib/gitlab/analytics/cycle_analytics/base_query_builder.rb
+++ b/lib/gitlab/analytics/cycle_analytics/base_query_builder.rb
@@ -19,6 +19,7 @@ module Gitlab
def initialize(stage:, params: {})
@stage = stage
@params = build_finder_params(params)
+ @params[:state] = :opened if in_progress?
end
# rubocop: disable CodeReuse/ActiveRecord
diff --git a/package.json b/package.json
index 3ad9abca212..c64270f5bba 100644
--- a/package.json
+++ b/package.json
@@ -51,9 +51,9 @@
"@babel/preset-env": "^7.10.1",
"@gitlab/at.js": "1.5.7",
"@gitlab/favicon-overlay": "2.0.0",
- "@gitlab/svgs": "1.196.0",
+ "@gitlab/svgs": "1.197.0",
"@gitlab/tributejs": "1.0.0",
- "@gitlab/ui": "29.25.0",
+ "@gitlab/ui": "29.27.0",
"@gitlab/visual-review-tools": "1.6.1",
"@rails/actioncable": "^6.0.3-4",
"@rails/ujs": "^6.0.3-4",
diff --git a/spec/lib/gitlab/analytics/cycle_analytics/base_query_builder_spec.rb b/spec/lib/gitlab/analytics/cycle_analytics/base_query_builder_spec.rb
index 0a333965f68..24f8fb40445 100644
--- a/spec/lib/gitlab/analytics/cycle_analytics/base_query_builder_spec.rb
+++ b/spec/lib/gitlab/analytics/cycle_analytics/base_query_builder_spec.rb
@@ -62,4 +62,29 @@ RSpec.describe Gitlab::Analytics::CycleAnalytics::BaseQueryBuilder do
expect(records.size).to eq(2)
end
+
+ describe 'in progress filter' do
+ let_it_be(:mr3) { create(:merge_request, :opened, target_project: project, source_project: project, allow_broken: true, created_at: 3.months.ago) }
+ let_it_be(:mr4) { create(:merge_request, :closed, target_project: project, source_project: project, allow_broken: true, created_at: 1.month.ago) }
+
+ before do
+ params[:from] = 5.months.ago
+ end
+
+ context 'when the filter is present' do
+ before do
+ params[:end_event_filter] = :in_progress
+ end
+
+ it 'returns only open items' do
+ expect(records).to eq([mr3])
+ end
+ end
+
+ context 'when the filter is absent' do
+ it 'returns finished items' do
+ expect(records).to match_array([mr1, mr2])
+ end
+ end
+ end
end
diff --git a/spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb b/spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb
index e5f05217ff0..db2a96d9649 100644
--- a/spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb
+++ b/spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb
@@ -117,14 +117,6 @@ RSpec.shared_examples 'User updates wiki page' do
expect(page).to have_selector('.atwho-view')
end
- it 'shows the error message', :js do
- wiki_page.update(content: 'Update') # rubocop:disable Rails/SaveBang
-
- click_button('Save changes')
-
- expect(page).to have_content('Someone edited the page the same time you did.')
- end
-
it 'updates a page', :js do
fill_in('Content', with: 'Updated Wiki Content')
click_on('Save changes')
@@ -145,6 +137,18 @@ RSpec.shared_examples 'User updates wiki page' do
end
it_behaves_like 'wiki file attachments'
+
+ context 'when multiple people edit the page at the same time' do
+ it 'preserves user changes in the wiki editor', :js do
+ wiki_page.update(content: 'Some Other Updates') # rubocop:disable Rails/SaveBang
+
+ fill_in('Content', with: 'Updated Wiki Content')
+ click_on('Save changes')
+
+ expect(page).to have_content('Someone edited the page the same time you did.')
+ expect(find('textarea#wiki_content').value).to eq('Updated Wiki Content')
+ end
+ end
end
context 'when the page is in a subdir', :js do
diff --git a/yarn.lock b/yarn.lock
index 147b10a8526..9baa4b10661 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -898,20 +898,20 @@
stylelint-declaration-strict-value "1.7.7"
stylelint-scss "3.18.0"
-"@gitlab/svgs@1.196.0":
- version "1.196.0"
- resolved "https://registry.yarnpkg.com/@gitlab/svgs/-/svgs-1.196.0.tgz#7905bc66ef9c69ba7b5225326c0eaf4e55d11386"
- integrity sha512-X/UGCBXIZXBcPqfRy8qaxQG/SYyrZajAazORZjmnVF+cyM9lQTuCiZFi7dHtMQ1XLew+m1NREVngCmBLuuK98g==
+"@gitlab/svgs@1.197.0":
+ version "1.197.0"
+ resolved "https://registry.yarnpkg.com/@gitlab/svgs/-/svgs-1.197.0.tgz#70be3217b4c0c84b494615d0672734f40e3695d4"
+ integrity sha512-fW9EY3D1adWu4bGqo+74uElQ+U7qIxUM/I2np3133AZBeWK8bvW+92/SHpGQeINxcS/DBVOoepUSSUVvQEqroQ==
"@gitlab/tributejs@1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@gitlab/tributejs/-/tributejs-1.0.0.tgz#672befa222aeffc83e7d799b0500a7a4418e59b8"
integrity sha512-nmKw1+hB6MHvlmPz63yPwVs1qQkycHwsKgxpEbzmky16Y6mL4EJMk3w1b8QlOAF/AIAzjCERPhe/R4MJiohbZw==
-"@gitlab/ui@29.25.0":
- version "29.25.0"
- resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-29.25.0.tgz#535f1e358176fb73d0e7df0315a8f50f7c8fc20b"
- integrity sha512-Bt9wBj954Ev6UGbAJ0+ViT7ggOBXocyxru8NPDq060G7OAchtm6IQK0bwa4DugF5LxiP9IWXy34Oz55zjymwqw==
+"@gitlab/ui@29.27.0":
+ version "29.27.0"
+ resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-29.27.0.tgz#c5cbe1fee2164705ea6a431c85f6fdaa2ff7e166"
+ integrity sha512-VoiYrozWyE9l/ddX308vsu+wQqaJJN3csngIlrJit3DzVZV9Z/OVWU/X9CWV8m/ubyr5ysEMqnrtnsQClR9FiA==
dependencies:
"@babel/standalone" "^7.0.0"
"@gitlab/vue-toasted" "^1.3.0"