From 0250f48d9fc064b902d37e58f09715df0e1dd4e5 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Fri, 4 Nov 2022 06:09:23 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- db/structure.sql | 4 +-- doc/update/index.md | 2 ++ jest.config.base.js | 2 +- lib/api/ci/pipelines.rb | 6 ++++- .../Load-Performance-Testing.gitlab-ci.yml | 2 +- .../Load-Performance-Testing.gitlab-ci.yml | 2 +- lib/gitlab/database.rb | 2 +- locale/gitlab.pot | 19 +++++++++----- qa/qa/specs/helpers/context_selector.rb | 1 + qa/qa/specs/runner.rb | 2 ++ qa/qa/support/formatters/context_formatter.rb | 1 + qa/spec/specs/runner_spec.rb | 2 +- scripts/glfm/run-snapshot-tests.sh | 3 +++ .../content_editor/markdown_snapshot_spec.js | 9 ++++--- .../markdown_snapshot_spec_helper.js | 26 +++++++------------ 15 files changed, 48 insertions(+), 35 deletions(-) diff --git a/db/structure.sql b/db/structure.sql index b62dc137e71..9dc33fab3fa 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -23053,8 +23053,8 @@ CREATE TABLE vulnerability_state_transitions ( author_id bigint, comment text, dismissal_reason smallint, - CONSTRAINT check_fca4a7ca39 CHECK ((char_length(comment) <= 255)), - CONSTRAINT state_not_equal CHECK ((from_state <> to_state)) + CONSTRAINT check_d1ca8ec043 CHECK ((from_state <> to_state)), + CONSTRAINT check_fca4a7ca39 CHECK ((char_length(comment) <= 255)) ); CREATE SEQUENCE vulnerability_state_transitions_id_seq diff --git a/doc/update/index.md b/doc/update/index.md index ed4ee5d3454..a1d70eff0c8 100644 --- a/doc/update/index.md +++ b/doc/update/index.md @@ -143,6 +143,8 @@ GitLab 14.0 introduced [batched background migrations](../user/admin_area/monito Some installations [may need to run GitLab 14.0 for at least a day](#1400) to complete the database changes introduced by that upgrade. +Batched background migrations are handled by Sidekiq and [run in isolation](../development/database/batched_background_migrations.md#isolation), so an instance can remain operational while the migrations are processed. However, there may be performance degradation on larger instances that are heavily used while batched background migrations are run, so it's a good idea to [actively monitor the Sidekiq status](../user/admin_area/index.md#background-jobs) until all migrations are completed. + #### Check the status of batched background migrations To check the status of batched background migrations: diff --git a/jest.config.base.js b/jest.config.base.js index a4e41ab2eca..30e11122f81 100644 --- a/jest.config.base.js +++ b/jest.config.base.js @@ -159,7 +159,7 @@ module.exports = (path, options = {}) => { return { clearMocks: true, testMatch, - moduleFileExtensions: ['js', 'json', 'vue', 'gql', 'graphql', 'yaml'], + moduleFileExtensions: ['js', 'json', 'vue', 'gql', 'graphql', 'yaml', 'yml'], moduleNameMapper, collectCoverageFrom, coverageDirectory: coverageDirectory(), diff --git a/lib/api/ci/pipelines.rb b/lib/api/ci/pipelines.rb index 72a81330e71..e7c54b9cc61 100644 --- a/lib/api/ci/pipelines.rb +++ b/lib/api/ci/pipelines.rb @@ -67,7 +67,11 @@ module API end params do requires :ref, type: String, desc: 'Reference' - optional :variables, Array, desc: 'Array of variables available in the pipeline' + optional :variables, type: Array, desc: 'Array of variables available in the pipeline' do + optional :key, type: String, desc: 'The key of the variable' + optional :value, type: String, desc: 'The value of the variable' + optional :variable_type, type: String, values: ::Ci::PipelineVariable.variable_types.keys, default: 'env_var', desc: 'The type of variable, must be one of env_var or file. Defaults to env_var' + end end post ':id/pipeline', urgency: :low, feature_category: :continuous_integration do Gitlab::QueryLimiting.disable!('https://gitlab.com/gitlab-org/gitlab/-/issues/20711') diff --git a/lib/gitlab/ci/templates/Jobs/Load-Performance-Testing.gitlab-ci.yml b/lib/gitlab/ci/templates/Jobs/Load-Performance-Testing.gitlab-ci.yml index eea1c397108..936d8751fe1 100644 --- a/lib/gitlab/ci/templates/Jobs/Load-Performance-Testing.gitlab-ci.yml +++ b/lib/gitlab/ci/templates/Jobs/Load-Performance-Testing.gitlab-ci.yml @@ -6,7 +6,7 @@ load_performance: DOCKER_TLS_CERTDIR: "" K6_IMAGE: loadimpact/k6 K6_VERSION: 0.27.0 - K6_TEST_FILE: github.com/loadimpact/k6/samples/http_get.js + K6_TEST_FILE: raw.githubusercontent.com/grafana/k6/master/samples/http_get.js K6_OPTIONS: '' K6_DOCKER_OPTIONS: '' services: diff --git a/lib/gitlab/ci/templates/Verify/Load-Performance-Testing.gitlab-ci.yml b/lib/gitlab/ci/templates/Verify/Load-Performance-Testing.gitlab-ci.yml index cee8e3345c8..bf5cfbb519d 100644 --- a/lib/gitlab/ci/templates/Verify/Load-Performance-Testing.gitlab-ci.yml +++ b/lib/gitlab/ci/templates/Verify/Load-Performance-Testing.gitlab-ci.yml @@ -17,7 +17,7 @@ load_performance: variables: K6_IMAGE: loadimpact/k6 K6_VERSION: 0.27.0 - K6_TEST_FILE: github.com/loadimpact/k6/samples/http_get.js + K6_TEST_FILE: raw.githubusercontent.com/grafana/k6/master/samples/http_get.js K6_OPTIONS: '' K6_DOCKER_OPTIONS: '' services: diff --git a/lib/gitlab/database.rb b/lib/gitlab/database.rb index dd84127459d..2456a5dd68e 100644 --- a/lib/gitlab/database.rb +++ b/lib/gitlab/database.rb @@ -56,7 +56,7 @@ module Gitlab # Note that we use ActiveRecord::Base here and not ApplicationRecord. # This is deliberate, as we also use these classes to apply load # balancing to, and the load balancer must be enabled for _all_ models - # that inher from ActiveRecord::Base; not just our own models that + # that inherit from ActiveRecord::Base; not just our own models that # inherit from ApplicationRecord. main: ::ActiveRecord::Base, ci: ::Ci::ApplicationRecord.connection_class? ? ::Ci::ApplicationRecord : nil diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 1fbf2f14875..9d1d1f3e49d 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -6091,6 +6091,12 @@ msgstr "" msgid "Be careful. Renaming a project's repository can have unintended side effects." msgstr "" +msgid "Because you enabled auto-banning, we have also automatically banned this user from %{scope}. If this is a mistake, you can %{link_start}unban them%{link_end}." +msgstr "" + +msgid "Because you enabled auto-banning, we have also automatically banned this user from %{scope}. If this is a mistake, you can unban them: %{url}." +msgstr "" + msgid "Before enabling this integration, create a webhook for the room in Google Chat where you want to receive notifications from this project. %{docs_link}" msgstr "" @@ -20371,12 +20377,6 @@ msgstr "" msgid "If this email was added in error, you can remove it here: %{profile_emails_url}" msgstr "" -msgid "If this is a mistake, you can %{link_start}unban them%{link_end}." -msgstr "" - -msgid "If this is a mistake, you can unban them: %{url}." -msgstr "" - msgid "If this was a mistake you can %{leave_link_start}leave the %{source_type}%{link_end}." msgstr "" @@ -45283,7 +45283,7 @@ msgstr "" msgid "We want to be sure it is you, please confirm you are not a robot." msgstr "" -msgid "We want to let you know %{username} has been banned from %{scope} due to them downloading more than %{max_project_downloads} project repositories within %{within_minutes} minutes." +msgid "We want to let you know %{username} has exceeded the Git rate limit due to them downloading more than %{max_project_downloads} project %{repositories_text} within %{within_text}." msgstr "" msgid "We will notify %{inviter} that you declined their invitation to join GitLab. You will stop receiving reminders." @@ -49076,6 +49076,11 @@ msgstr "" msgid "repositories" msgstr "" +msgid "repository" +msgid_plural "repositories" +msgstr[0] "" +msgstr[1] "" + msgid "repository:" msgstr "" diff --git a/qa/qa/specs/helpers/context_selector.rb b/qa/qa/specs/helpers/context_selector.rb index 3608fa7c581..caa5ace430f 100644 --- a/qa/qa/specs/helpers/context_selector.rb +++ b/qa/qa/specs/helpers/context_selector.rb @@ -18,6 +18,7 @@ module QA def context_matches?(*options) return false unless Runtime::Scenario.attributes[:gitlab_address] + return false if Runtime::Scenario.attributes[:test_metadata_only] opts = {} opts[:domain] = '.+' diff --git a/qa/qa/specs/runner.rb b/qa/qa/specs/runner.rb index c46b6300200..4eb799f34c1 100644 --- a/qa/qa/specs/runner.rb +++ b/qa/qa/specs/runner.rb @@ -23,6 +23,8 @@ module QA def rspec_tags tags_for_rspec = [] + return tags_for_rspec if Runtime::Scenario.attributes[:test_metadata_only] + if tags.any? tags.each { |tag| tags_for_rspec.push(['--tag', tag.to_s]) } else diff --git a/qa/qa/support/formatters/context_formatter.rb b/qa/qa/support/formatters/context_formatter.rb index c8991561f45..11f6a182ebb 100644 --- a/qa/qa/support/formatters/context_formatter.rb +++ b/qa/qa/support/formatters/context_formatter.rb @@ -36,6 +36,7 @@ module QA # @param [] example # @return [void] def set_skip_metadata(example) + return if Runtime::Scenario.attributes[:test_metadata_only] return skip_only(example.metadata) if example.metadata.key?(:only) return skip_except(example.metadata) if example.metadata.key?(:except) end diff --git a/qa/spec/specs/runner_spec.rb b/qa/spec/specs/runner_spec.rb index dd013497367..cbe5699a306 100644 --- a/qa/spec/specs/runner_spec.rb +++ b/qa/spec/specs/runner_spec.rb @@ -111,7 +111,7 @@ RSpec.describe QA::Specs::Runner do it 'sets the `--dry-run` flag' do expect_rspec_runner_arguments( - ['--dry-run'] + DEFAULT_SKIPPED_TAGS + ['--tag', '~geo', *described_class::DEFAULT_TEST_PATH_ARGS], + ['--dry-run', *described_class::DEFAULT_TEST_PATH_ARGS], [$stderr, anything] ) diff --git a/scripts/glfm/run-snapshot-tests.sh b/scripts/glfm/run-snapshot-tests.sh index 6a66d8fbd9a..0a3891e243a 100755 --- a/scripts/glfm/run-snapshot-tests.sh +++ b/scripts/glfm/run-snapshot-tests.sh @@ -24,6 +24,9 @@ printf "\nStarting GLFM snapshot example tests. See https://docs.gitlab.com/ee/d printf "Set 'FOCUSED_MARKDOWN_EXAMPLES=example_name_1[,...]' for focused examples, with example name(s) from https://docs.gitlab.com/ee/development/gitlab_flavored_markdown/specification_guide/#glfm_specificationexample_snapshotsexamples_indexyml.\n" printf "${Color_Off}" +# NOTE: Unlike the backend markdown_snapshot_spec.rb which has a CE and EE version, there is only +# one version of this spec. This is because the frontend markdown rendering does not require EE-only +# backend features. printf "\n${BBlue}Running frontend 'yarn jest spec/frontend/content_editor/markdown_snapshot_spec.js'...${Color_Off}\n\n" yarn jest spec/frontend/content_editor/markdown_snapshot_spec.js printf "\n${BBlue}'yarn jest spec/frontend/content_editor/markdown_snapshot_spec.js' passed!${Color_Off}\n\n" diff --git a/spec/frontend/content_editor/markdown_snapshot_spec.js b/spec/frontend/content_editor/markdown_snapshot_spec.js index 63ca66172e6..146208bf8c7 100644 --- a/spec/frontend/content_editor/markdown_snapshot_spec.js +++ b/spec/frontend/content_editor/markdown_snapshot_spec.js @@ -1,10 +1,11 @@ -import path from 'path'; import { describeMarkdownSnapshots } from 'jest/content_editor/markdown_snapshot_spec_helper'; jest.mock('~/emoji'); -const glfmSpecificationDir = path.join(__dirname, '..', '..', '..', 'glfm_specification'); - // See https://docs.gitlab.com/ee/development/gitlab_flavored_markdown/specification_guide/#markdown-snapshot-testing // for documentation on this spec. -describeMarkdownSnapshots('CE markdown snapshots in ContentEditor', glfmSpecificationDir); +// +// NOTE: Unlike the backend markdown_snapshot_spec.rb which has a CE and EE version, there is only +// one version of this spec. This is because the frontend markdown rendering does not require EE-only +// backend features. +describeMarkdownSnapshots('markdown example snapshots in ContentEditor'); diff --git a/spec/frontend/content_editor/markdown_snapshot_spec_helper.js b/spec/frontend/content_editor/markdown_snapshot_spec_helper.js index b85e64e71a5..64988c5b717 100644 --- a/spec/frontend/content_editor/markdown_snapshot_spec_helper.js +++ b/spec/frontend/content_editor/markdown_snapshot_spec_helper.js @@ -1,10 +1,12 @@ // See https://docs.gitlab.com/ee/development/gitlab_flavored_markdown/specification_guide/#markdown-snapshot-testing // for documentation on this spec. -import fs from 'fs'; -import path from 'path'; import jsYaml from 'js-yaml'; import { pick } from 'lodash'; +import glfmExampleStatusYml from '../../../glfm_specification/input/gitlab_flavored_markdown/glfm_example_status.yml'; +import markdownYml from '../../../glfm_specification/output_example_snapshots/markdown.yml'; +import htmlYml from '../../../glfm_specification/output_example_snapshots/html.yml'; +import prosemirrorJsonYml from '../../../glfm_specification/output_example_snapshots/prosemirror_json.yml'; import { IMPLEMENTATION_ERROR_MSG, renderHtmlAndJsonForAllExamples, @@ -18,29 +20,21 @@ const filterExamples = (examples) => { return pick(examples, focusedMarkdownExamples); }; -const loadExamples = (dir, fileName) => { - const yaml = fs.readFileSync(path.join(dir, fileName)); +const loadExamples = (yaml) => { const examples = jsYaml.safeLoad(yaml, {}); return filterExamples(examples); }; // eslint-disable-next-line jest/no-export -export const describeMarkdownSnapshots = (description, glfmSpecificationDir) => { +export const describeMarkdownSnapshots = (description) => { let actualHtmlAndJsonExamples; let skipRunningSnapshotWysiwygHtmlTests; let skipRunningSnapshotProsemirrorJsonTests; - const exampleStatuses = loadExamples( - path.join(glfmSpecificationDir, 'input', 'gitlab_flavored_markdown'), - 'glfm_example_status.yml', - ); - const outputExampleSnapshotsDir = path.join(glfmSpecificationDir, 'output_example_snapshots'); - const markdownExamples = loadExamples(outputExampleSnapshotsDir, 'markdown.yml'); - const expectedHtmlExamples = loadExamples(outputExampleSnapshotsDir, 'html.yml'); - const expectedProseMirrorJsonExamples = loadExamples( - outputExampleSnapshotsDir, - 'prosemirror_json.yml', - ); + const exampleStatuses = loadExamples(glfmExampleStatusYml); + const markdownExamples = loadExamples(markdownYml); + const expectedHtmlExamples = loadExamples(htmlYml); + const expectedProseMirrorJsonExamples = loadExamples(prosemirrorJsonYml); beforeAll(async () => { return renderHtmlAndJsonForAllExamples(markdownExamples).then((examples) => {