From 915a5b6e89195aab5d7eb0deb16e4825cfce509e Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 30 Nov 2021 09:09:53 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- app/assets/javascripts/ide/constants.js | 6 +++--- .../pages/shared/wikis/components/wiki_form.vue | 9 ++++----- ...20211027043206_track_ci_pipeline_deletions.rb | 15 +++++++++++++++ .../20211027043229_track_ci_build_deletions.rb | 15 +++++++++++++++ db/schema_migrations/20211027043206 | 1 + db/schema_migrations/20211027043229 | 1 + db/structure.sql | 4 ++++ doc/ci/variables/index.md | 5 +++++ doc/development/snowplow/schemas.md | 1 + doc/integration/jira/issues.md | 2 +- .../database/gitlab_loose_foreign_keys.yml | 11 +++++++++++ lib/gitlab/usage_data.rb | 6 ++++++ locale/gitlab.pot | 16 ++++++++++++++-- .../shared/wikis/components/wiki_form_spec.js | 2 +- spec/models/ci/build_spec.rb | 4 ++++ spec/models/ci/pipeline_spec.rb | 4 ++++ .../shared_contexts/navbar_structure_context.rb | 4 ++-- .../loose_foreign_keys/have_loose_foreign_key.rb | 6 ++++-- 18 files changed, 96 insertions(+), 16 deletions(-) create mode 100644 db/post_migrate/20211027043206_track_ci_pipeline_deletions.rb create mode 100644 db/post_migrate/20211027043229_track_ci_build_deletions.rb create mode 100644 db/schema_migrations/20211027043206 create mode 100644 db/schema_migrations/20211027043229 diff --git a/app/assets/javascripts/ide/constants.js b/app/assets/javascripts/ide/constants.js index 706d98fdb90..775b6906498 100644 --- a/app/assets/javascripts/ide/constants.js +++ b/app/assets/javascripts/ide/constants.js @@ -76,15 +76,15 @@ export const stageKeys = { export const commitItemIconMap = { addition: { icon: 'file-addition', - class: 'ide-file-addition', + class: 'file-addition ide-file-addition', }, modified: { icon: 'file-modified', - class: 'ide-file-modified', + class: 'file-modified ide-file-modified', }, deleted: { icon: 'file-deletion', - class: 'ide-file-deletion', + class: 'file-deletion ide-file-deletion', }, }; diff --git a/app/assets/javascripts/pages/shared/wikis/components/wiki_form.vue b/app/assets/javascripts/pages/shared/wikis/components/wiki_form.vue index 11819200d7b..bf8b180da82 100644 --- a/app/assets/javascripts/pages/shared/wikis/components/wiki_form.vue +++ b/app/assets/javascripts/pages/shared/wikis/components/wiki_form.vue @@ -47,7 +47,7 @@ export default { newPage: s__( 'WikiPage|Tip: You can specify the full path for the new file. We will automatically create any missing directories.', ), - moreInformation: s__('WikiPage|More Information.'), + learnMore: s__('WikiPage|Learn more.'), }, }, format: { @@ -402,10 +402,9 @@ export default { {{ titleHelpText }} - - {{ $options.i18n.title.helpText.moreInformation }} + + {{ $options.i18n.title.helpText.learnMore }} + diff --git a/db/post_migrate/20211027043206_track_ci_pipeline_deletions.rb b/db/post_migrate/20211027043206_track_ci_pipeline_deletions.rb new file mode 100644 index 00000000000..3836159c2cd --- /dev/null +++ b/db/post_migrate/20211027043206_track_ci_pipeline_deletions.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class TrackCiPipelineDeletions < Gitlab::Database::Migration[1.0] + include Gitlab::Database::MigrationHelpers::LooseForeignKeyHelpers + + enable_lock_retries! + + def up + track_record_deletions(:ci_pipelines) + end + + def down + untrack_record_deletions(:ci_pipelines) + end +end diff --git a/db/post_migrate/20211027043229_track_ci_build_deletions.rb b/db/post_migrate/20211027043229_track_ci_build_deletions.rb new file mode 100644 index 00000000000..b76d5f3261c --- /dev/null +++ b/db/post_migrate/20211027043229_track_ci_build_deletions.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class TrackCiBuildDeletions < Gitlab::Database::Migration[1.0] + include Gitlab::Database::MigrationHelpers::LooseForeignKeyHelpers + + enable_lock_retries! + + def up + track_record_deletions(:ci_builds) + end + + def down + untrack_record_deletions(:ci_builds) + end +end diff --git a/db/schema_migrations/20211027043206 b/db/schema_migrations/20211027043206 new file mode 100644 index 00000000000..7387484a118 --- /dev/null +++ b/db/schema_migrations/20211027043206 @@ -0,0 +1 @@ +543feeedace6596d63207738829dcd62249a9f048a08928fbe4131ec69058322 \ No newline at end of file diff --git a/db/schema_migrations/20211027043229 b/db/schema_migrations/20211027043229 new file mode 100644 index 00000000000..75c99cb5491 --- /dev/null +++ b/db/schema_migrations/20211027043229 @@ -0,0 +1 @@ +2bceb12bdb90052cc8c1aedbd52c11cb8125471e1b59de3d75ef476fc64851c9 \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 70a7ddc674d..ab7f7d1c984 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -28723,6 +28723,10 @@ ALTER INDEX product_analytics_events_experimental_pkey ATTACH PARTITION gitlab_p CREATE TRIGGER chat_names_loose_fk_trigger AFTER DELETE ON chat_names REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records(); +CREATE TRIGGER ci_builds_loose_fk_trigger AFTER DELETE ON ci_builds REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records(); + +CREATE TRIGGER ci_pipelines_loose_fk_trigger AFTER DELETE ON ci_pipelines REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records(); + CREATE TRIGGER ci_runners_loose_fk_trigger AFTER DELETE ON ci_runners REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records(); CREATE TRIGGER trigger_delete_project_namespace_on_project_delete AFTER DELETE ON projects FOR EACH ROW WHEN ((old.project_namespace_id IS NOT NULL)) EXECUTE FUNCTION delete_associated_project_namespace(); diff --git a/doc/ci/variables/index.md b/doc/ci/variables/index.md index 309d631ce07..e9182410958 100644 --- a/doc/ci/variables/index.md +++ b/doc/ci/variables/index.md @@ -293,6 +293,11 @@ Use the variables in a job script like this: kubectl config set-cluster e2e --server="$KUBE_URL" --certificate-authority="$KUBE_CA_PEM" ``` +WARNING: +Be careful when assigning the value of a file variable to another variable. The other +variable takes the content of the file as its value, **not** the path to the file. +See [issue 29407](https://gitlab.com/gitlab-org/gitlab/-/issues/29407) for more details. + An alternative to `File` type variables is to: - Read the value of a CI/CD variable (`variable` type). diff --git a/doc/development/snowplow/schemas.md b/doc/development/snowplow/schemas.md index 5b9e4f5256e..f66e0566a9c 100644 --- a/doc/development/snowplow/schemas.md +++ b/doc/development/snowplow/schemas.md @@ -18,6 +18,7 @@ The [`StandardContext`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/g |----------------|---------------------|-----------------------|---------------------------------------------------------------------------------------------| | `project_id` | **{dotted-circle}** | integer | | | `namespace_id` | **{dotted-circle}** | integer | | +| `user_id` | **{dotted-circle}** | integer | User database record ID attribute. This file undergoes a pseudonymization process at the collector level. | | `environment` | **{check-circle}** | string (max 32 chars) | Name of the source environment, such as `production` or `staging` | | `source` | **{check-circle}** | string (max 32 chars) | Name of the source application, such as `gitlab-rails` or `gitlab-javascript` | | `plan` | **{dotted-circle}** | string (max 32 chars) | Name of the plan for the namespace, such as `free`, `premium`, or `ultimate`. Automatically picked from the `namespace`. | diff --git a/doc/integration/jira/issues.md b/doc/integration/jira/issues.md index b8955c7b332..e24862242e1 100644 --- a/doc/integration/jira/issues.md +++ b/doc/integration/jira/issues.md @@ -140,7 +140,7 @@ Enhancements to use these filters through the user interface ## Automatic issue transitions -> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/...) in GitLab 13.10. +> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/55773) in GitLab 13.11. When you configure automatic issue transitions, you can transition a referenced Jira issue to the next available status with a category of **Done**. To configure diff --git a/lib/gitlab/database/gitlab_loose_foreign_keys.yml b/lib/gitlab/database/gitlab_loose_foreign_keys.yml index 27b8f3bbe0f..dbea7c9f690 100644 --- a/lib/gitlab/database/gitlab_loose_foreign_keys.yml +++ b/lib/gitlab/database/gitlab_loose_foreign_keys.yml @@ -2,6 +2,17 @@ chat_names: - to_table: ci_pipeline_chat_data column: chat_name_id on_delete: async_delete +ci_builds: + - to_table: dast_site_profiles_builds + column: ci_build_id + on_delete: async_delete + - to_table: dast_scanner_profiles_builds + column: ci_build_id + on_delete: async_delete +ci_pipelines: + - to_table: dast_profiles_pipelines + column: ci_pipeline_id + on_delete: async_delete ci_runners: - to_table: clusters_applications_runners column: runner_id diff --git a/lib/gitlab/usage_data.rb b/lib/gitlab/usage_data.rb index 61d0f5735ee..341275fc15e 100644 --- a/lib/gitlab/usage_data.rb +++ b/lib/gitlab/usage_data.rb @@ -10,6 +10,12 @@ # alt_usage_data { Gitlab::VERSION } # redis_usage_data(Gitlab::UsageDataCounters::WikiPageCounter) # redis_usage_data { ::Gitlab::UsageCounters::PodLogs.usage_totals[:total] } + +# NOTE: +# Implementing metrics direct in `usage_data.rb` is deprecated, +# please add new instrumentation class and use add_metric method. +# For more information, see https://docs.gitlab.com/ee/development/service_ping/metrics_instrumentation.html + module Gitlab class UsageData DEPRECATED_VALUE = -1000 diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 74049e27dac..5e0b39c88b9 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -4818,6 +4818,9 @@ msgstr "" msgid "Audit Events" msgstr "" +msgid "Audit events" +msgstr "" + msgid "AuditLogs|(removed)" msgstr "" @@ -11429,6 +11432,9 @@ msgstr "" msgid "Dependency Scanning" msgstr "" +msgid "Dependency list" +msgstr "" + msgid "DependencyProxy|Cached %{time}" msgstr "" @@ -20702,6 +20708,9 @@ msgstr "" msgid "License Compliance" msgstr "" +msgid "License compliance" +msgstr "" + msgid "License file" msgstr "" @@ -35855,7 +35864,7 @@ msgstr "" msgid "Thread to reply to cannot be found" msgstr "" -msgid "Threat Monitoring" +msgid "Threat monitoring" msgstr "" msgid "ThreatMonitoring|Alert Details" @@ -38552,6 +38561,9 @@ msgstr "" msgid "Vulnerability remediated. Review before resolving." msgstr "" +msgid "Vulnerability report" +msgstr "" + msgid "Vulnerability resolved in %{branch}" msgstr "" @@ -39337,7 +39349,7 @@ msgstr "" msgid "WikiPage|Keep editing" msgstr "" -msgid "WikiPage|More Information." +msgid "WikiPage|Learn more." msgstr "" msgid "WikiPage|Page title" diff --git a/spec/frontend/pages/shared/wikis/components/wiki_form_spec.js b/spec/frontend/pages/shared/wikis/components/wiki_form_spec.js index b06e8d31643..bd56e3949a9 100644 --- a/spec/frontend/pages/shared/wikis/components/wiki_form_spec.js +++ b/spec/frontend/pages/shared/wikis/components/wiki_form_spec.js @@ -38,7 +38,7 @@ describe('WikiForm', () => { wrapper.findByRole('button', { name: 'Try this later' }); const findSwitchToOldEditorButton = () => wrapper.findByRole('button', { name: 'Switch me back to the classic editor.' }); - const findTitleHelpLink = () => wrapper.findByRole('link', { name: 'More Information.' }); + const findTitleHelpLink = () => wrapper.findByRole('link', { name: 'Learn more.' }); const findMarkdownHelpLink = () => wrapper.findByTestId('wiki-markdown-help-link'); const findContentEditor = () => wrapper.findComponent(ContentEditor); const findClassicEditor = () => wrapper.findComponent(MarkdownField); diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index e18fa08a6ee..dcecaa3243e 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -5403,4 +5403,8 @@ RSpec.describe Ci::Build do expect(subject).to be true end end + + it_behaves_like 'it has loose foreign keys' do + let(:factory_name) { :ci_build } + end end diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index e573a6ef780..0b323cc69ed 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -4611,4 +4611,8 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do expect(pipeline.authorized_cluster_agents).to contain_exactly(agent) # cached end end + + it_behaves_like 'it has loose foreign keys' do + let(:factory_name) { :ci_pipeline } + end end diff --git a/spec/support/shared_contexts/navbar_structure_context.rb b/spec/support/shared_contexts/navbar_structure_context.rb index e3877222a72..085f1f13c2c 100644 --- a/spec/support/shared_contexts/navbar_structure_context.rb +++ b/spec/support/shared_contexts/navbar_structure_context.rb @@ -5,7 +5,7 @@ RSpec.shared_context 'project navbar structure' do { nav_item: _('Security & Compliance'), nav_sub_items: [ - (_('Audit Events') if Gitlab.ee?), + (_('Audit events') if Gitlab.ee?), _('Configuration') ] } @@ -165,7 +165,7 @@ RSpec.shared_context 'group navbar structure' do { nav_item: _('Security & Compliance'), nav_sub_items: [ - _('Audit Events') + _('Audit events') ] } end diff --git a/spec/support/shared_examples/loose_foreign_keys/have_loose_foreign_key.rb b/spec/support/shared_examples/loose_foreign_keys/have_loose_foreign_key.rb index 47c6e5bec1e..1f2b2937dc5 100644 --- a/spec/support/shared_examples/loose_foreign_keys/have_loose_foreign_key.rb +++ b/spec/support/shared_examples/loose_foreign_keys/have_loose_foreign_key.rb @@ -25,7 +25,9 @@ RSpec.shared_examples 'it has loose foreign keys' do it 'records record deletions' do model = create(factory_name) # rubocop: disable Rails/SaveBang - model.destroy! + + # using delete to avoid cross-database modification errors when associations with dependent option are present + model.delete deleted_record = LooseForeignKeys::DeletedRecord.find_by(fully_qualified_table_name: "#{connection.current_schema}.#{table_name}", primary_key_value: model.id) @@ -35,7 +37,7 @@ RSpec.shared_examples 'it has loose foreign keys' do it 'cleans up record deletions' do model = create(factory_name) # rubocop: disable Rails/SaveBang - expect { model.destroy! }.to change { LooseForeignKeys::DeletedRecord.count }.by(1) + expect { model.delete }.to change { LooseForeignKeys::DeletedRecord.count }.by(1) LooseForeignKeys::ProcessDeletedRecordsService.new(connection: connection).execute