diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-20 12:12:59 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-20 12:12:59 +0300 |
commit | 6c4f8ad2d99cf2716e62bd5a0c2ecea9e15505b2 (patch) | |
tree | 3614ad9d01d3c6b4e167848e4ed8fc33834fde8c | |
parent | 13ad005a25f163520ff94b90cdd53495c5a0b5c4 (diff) |
Add latest changes from gitlab-org/gitlab@master
44 files changed, 203 insertions, 526 deletions
diff --git a/.rubocop_todo/style/percent_literal_delimiters.yml b/.rubocop_todo/style/percent_literal_delimiters.yml index 59acd655d4b..09f590ae11a 100644 --- a/.rubocop_todo/style/percent_literal_delimiters.yml +++ b/.rubocop_todo/style/percent_literal_delimiters.yml @@ -2,30 +2,6 @@ # Cop supports --autocorrect. Style/PercentLiteralDelimiters: Exclude: - - 'ee/lib/api/status_checks.rb' - - 'ee/lib/api/visual_review_discussions.rb' - - 'ee/lib/ee/api/helpers/members_helpers.rb' - - 'ee/lib/ee/api/helpers/projects_helpers.rb' - - 'ee/lib/ee/api/members.rb' - - 'ee/lib/ee/api/search.rb' - - 'ee/lib/ee/gitlab/alert_management/payload/generic.rb' - - 'ee/lib/ee/gitlab/auth/ldap/adapter.rb' - - 'ee/lib/ee/gitlab/background_migration/migrate_approver_to_approval_rules.rb' - - 'ee/lib/ee/gitlab/checks/push_rules/file_size_check.rb' - - 'ee/lib/ee/gitlab/ci/parsers/security/validators/schema_validator.rb' - - 'ee/lib/ee/gitlab/etag_caching/router/rails.rb' - - 'ee/lib/ee/gitlab/middleware/read_only/controller.rb' - - 'ee/lib/ee/gitlab/path_regex.rb' - - 'ee/lib/ee/gitlab/usage_data.rb' - - 'ee/lib/elastic/class_proxy_util.rb' - - 'ee/lib/elastic/latest/config.rb' - - 'ee/lib/elastic/latest/custom_language_analyzers.rb' - - 'ee/lib/elastic/latest/project_instance_proxy.rb' - - 'ee/lib/elastic/latest/snippet_class_proxy.rb' - - 'ee/lib/gitlab/auth/group_saml/auth_hash.rb' - - 'ee/lib/gitlab/geo/replicator.rb' - - 'ee/lib/gitlab/usage/metrics/instrumentations/license_metric.rb' - - 'ee/lib/tasks/gitlab/elastic/test.rake' - 'ee/spec/controllers/ee/sessions_controller_spec.rb' - 'ee/spec/controllers/groups/saml_providers_controller_spec.rb' - 'ee/spec/controllers/groups/scim_oauth_controller_spec.rb' @@ -199,14 +175,6 @@ Style/PercentLiteralDelimiters: - 'qa/qa/specs/features/ee/browser_ui/3_create/repository/push_rules_spec.rb' - 'qa/spec/git/repository_spec.rb' - 'qa/spec/page/view_spec.rb' - - 'rubocop/cop/migration/background_migrations.rb' - - 'rubocop/cop/rspec/httparty_basic_auth.rb' - - 'rubocop/migration_helpers.rb' - - 'scripts/qa/quarantine-types-check' - - 'scripts/qa/testcases-check' - - 'scripts/regenerate-schema' - - 'scripts/undercoverage' - - 'sidekiq_cluster/cli.rb' - 'spec/benchmarks/banzai_benchmark.rb' - 'spec/commands/sidekiq_cluster/cli_spec.rb' - 'spec/components/pajamas/component_spec.rb' @@ -732,4 +700,3 @@ Style/PercentLiteralDelimiters: - 'spec/workers/projects/record_target_platforms_worker_spec.rb' - 'spec/workers/stuck_merge_jobs_worker_spec.rb' - 'spec/workers/update_project_statistics_worker_spec.rb' - - 'tooling/danger/datateam.rb' diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION index f811ca23f9d..f24ca0f4db6 100644 --- a/GITALY_SERVER_VERSION +++ b/GITALY_SERVER_VERSION @@ -1 +1 @@ -fe0a04858c9a5172379077343b16e1fd2e017903 +0a7e89fde7ab1745eebf9c7fd2299047e293d9ef @@ -186,7 +186,7 @@ gem 'seed-fu', '~> 2.3.7' gem 'elasticsearch-model', '~> 7.2' gem 'elasticsearch-rails', '~> 7.2', require: 'elasticsearch/rails/instrumentation' gem 'elasticsearch-api', '7.13.3' -gem 'aws-sdk-core', '~> 3.181.1' +gem 'aws-sdk-core', '~> 3.182.0' gem 'aws-sdk-cloudformation', '~> 1' gem 'aws-sdk-s3', '~> 1.134.0' gem 'faraday_middleware-aws-sigv4', '~>0.3.0' diff --git a/Gemfile.checksum b/Gemfile.checksum index 3efef6fcc9f..d3e7a889acc 100644 --- a/Gemfile.checksum +++ b/Gemfile.checksum @@ -37,7 +37,7 @@ {"name":"aws-eventstream","version":"1.2.0","platform":"ruby","checksum":"ffa53482c92880b001ff2fb06919b9bb82fd847cbb0fa244985d2ebb6dd0d1df"}, {"name":"aws-partitions","version":"1.761.0","platform":"ruby","checksum":"291e444e1edfc92c5521a6dbdd1236ccc3f122b3520163b2be6ec5b6ef350ef2"}, {"name":"aws-sdk-cloudformation","version":"1.41.0","platform":"ruby","checksum":"31e47539719734413671edf9b1a31f8673fbf9688549f50c41affabbcb1c6b26"}, -{"name":"aws-sdk-core","version":"3.181.1","platform":"ruby","checksum":"eb2e42271eecc80e2dd2496c78e45ab29745db0f707bd5cea9f816d20081dce2"}, +{"name":"aws-sdk-core","version":"3.182.0","platform":"ruby","checksum":"1a08b53c380223cee2a159fd3b4b8e19db27cd1f98ac789fb6dd8c11bcee0d7c"}, {"name":"aws-sdk-kms","version":"1.64.0","platform":"ruby","checksum":"40de596c95047bfc6e1aacea24f3df6241aa716b6f7ce08ac4c5f7e3120395ad"}, {"name":"aws-sdk-s3","version":"1.134.0","platform":"ruby","checksum":"25135ec8af8b44c5221f50241810d3ae60bad0f52bfd618ab31d18ad52117fb9"}, {"name":"aws-sigv4","version":"1.6.0","platform":"ruby","checksum":"ca9e6a15cd424f1f32b524b9760995331459bc22e67d3daad4fcf0c0084b087d"}, diff --git a/Gemfile.lock b/Gemfile.lock index 2a8f80bf393..61ea479b3c4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -265,7 +265,7 @@ GEM aws-sdk-cloudformation (1.41.0) aws-sdk-core (~> 3, >= 3.99.0) aws-sigv4 (~> 1.1) - aws-sdk-core (3.181.1) + aws-sdk-core (3.182.0) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.651.0) aws-sigv4 (~> 1.5) @@ -1745,7 +1745,7 @@ DEPENDENCIES autoprefixer-rails (= 10.2.5.1) awesome_print aws-sdk-cloudformation (~> 1) - aws-sdk-core (~> 3.181.1) + aws-sdk-core (~> 3.182.0) aws-sdk-s3 (~> 1.134.0) axe-core-rspec babosa (~> 2.0) diff --git a/app/assets/javascripts/boards/components/board_app.vue b/app/assets/javascripts/boards/components/board_app.vue index 1cfa35ffd91..4d915ff341a 100644 --- a/app/assets/javascripts/boards/components/board_app.vue +++ b/app/assets/javascripts/boards/components/board_app.vue @@ -1,6 +1,7 @@ <script> // eslint-disable-next-line no-restricted-imports import { mapGetters } from 'vuex'; +import { omit } from 'lodash'; import { refreshCurrentPage, queryToObject } from '~/lib/utils/url_utility'; import { s__ } from '~/locale'; import BoardContent from '~/boards/components/board_content.vue'; @@ -115,9 +116,8 @@ export default { return this.activeListId ? this.boardListsApollo[this.activeListId] : undefined; }, formattedFilterParams() { - if (this.filterParams.groupBy) delete this.filterParams.groupBy; return filterVariables({ - filters: this.filterParams, + filters: omit(this.filterParams, 'groupBy'), issuableType: this.issuableType, filterInfo: FiltersInfo, filterFields: FilterFields, diff --git a/app/assets/javascripts/ci/job_details/components/sidebar/artifacts_block.vue b/app/assets/javascripts/ci/job_details/components/sidebar/artifacts_block.vue index 4c81a9bd033..f6d39e8e4ac 100644 --- a/app/assets/javascripts/ci/job_details/components/sidebar/artifacts_block.vue +++ b/app/assets/javascripts/ci/job_details/components/sidebar/artifacts_block.vue @@ -78,7 +78,7 @@ export default { <span v-if="willExpire" data-testid="artifacts-unlocked-message-content"> {{ $options.i18n.willExpireText }} </span> - <timeago-tooltip v-if="artifact.expire_at" :time="artifact.expire_at" /> + <timeago-tooltip v-if="artifact.expireAt" :time="artifact.expireAt" /> <gl-link :href="helpUrl" target="_blank" @@ -95,23 +95,23 @@ export default { </p> <gl-button-group class="gl-display-flex gl-mt-3"> <gl-button - v-if="artifact.keep_path" - :href="artifact.keep_path" + v-if="artifact.keepPath" + :href="artifact.keepPath" data-method="post" data-testid="keep-artifacts" >{{ $options.i18n.keepText }}</gl-button > <gl-button - v-if="artifact.download_path" - :href="artifact.download_path" + v-if="artifact.downloadPath" + :href="artifact.downloadPath" rel="nofollow" data-testid="download-artifacts" download >{{ $options.i18n.downloadText }}</gl-button > <gl-button - v-if="artifact.browse_path" - :href="artifact.browse_path" + v-if="artifact.browsePath" + :href="artifact.browsePath" data-testid="browse-artifacts-button" >{{ $options.i18n.browseText }}</gl-button > diff --git a/app/assets/javascripts/ci/job_details/components/sidebar/sidebar.vue b/app/assets/javascripts/ci/job_details/components/sidebar/sidebar.vue index 7f2f4fc0331..0ff3ed93847 100644 --- a/app/assets/javascripts/ci/job_details/components/sidebar/sidebar.vue +++ b/app/assets/javascripts/ci/job_details/components/sidebar/sidebar.vue @@ -4,6 +4,7 @@ import { isEmpty } from 'lodash'; import { mapActions, mapGetters, mapState } from 'vuex'; import { forwardDeploymentFailureModalId } from '~/ci/constants'; import { filterAnnotations } from '~/ci/job_details/utils'; +import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; import ArtifactsBlock from './artifacts_block.vue'; import CommitBlock from './commit_block.vue'; import ExternalLinksBlock from './external_links_block.vue'; @@ -42,6 +43,9 @@ export default { // the artifact object will always have a locked property return Object.keys(this.job.artifact).length > 1; }, + artifact() { + return convertObjectPropsToCamelCase(this.job.artifact, { deep: true }); + }, hasExternalLinks() { return this.externalLinks.length > 0; }, @@ -92,7 +96,7 @@ export default { <artifacts-block v-if="hasArtifact" class="block gl-mb-2" - :artifact="job.artifact" + :artifact="artifact" :help-url="artifactHelpUrl" /> diff --git a/app/assets/javascripts/ci/runner/components/runner_form_fields.vue b/app/assets/javascripts/ci/runner/components/runner_form_fields.vue index 38e36733045..b8c80986fbc 100644 --- a/app/assets/javascripts/ci/runner/components/runner_form_fields.vue +++ b/app/assets/javascripts/ci/runner/components/runner_form_fields.vue @@ -92,9 +92,7 @@ export default { <gl-form-group :label="__('Tags')" label-for="runner-tags"> <template #description> <gl-sprintf - :message=" - s__('Runners|Multiple tags must be separated by a comma. For example, %{example}.') - " + :message="s__('Runners|Separate multiple tags with a comma. For example, %{example}.')" > <template #example> <!-- eslint-disable-next-line @gitlab/vue-require-i18n-strings --> @@ -106,7 +104,7 @@ export default { <gl-sprintf :message=" s__( - 'Runners|Add tags for the types of jobs the runner processes to ensure that the runner only runs jobs that you intend it to. %{helpLinkStart}Learn more.%{helpLinkEnd}', + 'Runners|Add tags to specify jobs that the runner can run. %{helpLinkStart}Learn more.%{helpLinkEnd}', ) " > @@ -191,7 +189,9 @@ export default { ) " label-for="runner-max-timeout" - :description="s__('Runners|Enter the number of seconds.')" + :description=" + s__('Runners|Enter the job timeout in seconds. Must be a minimum of 600 seconds.') + " > <gl-form-input id="runner-max-timeout" diff --git a/app/assets/javascripts/sentry/init_sentry.js b/app/assets/javascripts/sentry/init_sentry.js index dbd12dc36ce..5b4e5be1f10 100644 --- a/app/assets/javascripts/sentry/init_sentry.js +++ b/app/assets/javascripts/sentry/init_sentry.js @@ -4,6 +4,7 @@ import { defaultStackParser, makeFetchTransport, defaultIntegrations, + BrowserTracing, // exports captureException, @@ -37,7 +38,7 @@ const initSentry = () => { // https://github.com/getsentry/sentry-javascript/blob/7.66.0/MIGRATION.md#explicit-client-options transport: makeFetchTransport, stackParser: defaultStackParser, - integrations: defaultIntegrations, + integrations: [...defaultIntegrations, new BrowserTracing()], }); hub.bindClient(client); diff --git a/app/controllers/profiles/notifications_controller.rb b/app/controllers/profiles/notifications_controller.rb index 57e5ca4d55a..abb6e46394e 100644 --- a/app/controllers/profiles/notifications_controller.rb +++ b/app/controllers/profiles/notifications_controller.rb @@ -45,11 +45,17 @@ class Profiles::NotificationsController < Profiles::ApplicationController projects = project_notifications.map(&:source) ActiveRecord::Associations::Preloader.new( records: projects, - associations: { namespace: [:route, :owner], group: [], creator: [], project_setting: [] } + associations: project_associations ).call Preloaders::UserMaxAccessLevelInProjectsPreloader.new(projects, current_user).execute project_notifications.select { |notification| current_user.can?(:read_project, notification.source) } end # rubocop: enable CodeReuse/ActiveRecord + + def project_associations + { namespace: [:route, :owner], group: [], creator: [], project_setting: [] } + end end + +Profiles::NotificationsController.prepend_mod diff --git a/app/graphql/resolvers/group_issues_resolver.rb b/app/graphql/resolvers/group_issues_resolver.rb index 7bbc662c6c8..5e0fb27bafa 100644 --- a/app/graphql/resolvers/group_issues_resolver.rb +++ b/app/graphql/resolvers/group_issues_resolver.rb @@ -11,7 +11,11 @@ module Resolvers before_connection_authorization do |nodes, _| projects = nodes.map(&:project) - ActiveRecord::Associations::Preloader.new(records: projects, associations: :namespace).call + ActiveRecord::Associations::Preloader.new(records: projects, associations: project_associations).call + end + + def self.project_associations + [:namespace] end def ready?(**args) @@ -24,3 +28,5 @@ module Resolvers end end # rubocop:enable Graphql/ResolverType + +Resolvers::GroupIssuesResolver.prepend_mod diff --git a/app/graphql/resolvers/issues_resolver.rb b/app/graphql/resolvers/issues_resolver.rb index 589366ba26d..34f14eee0e5 100644 --- a/app/graphql/resolvers/issues_resolver.rb +++ b/app/graphql/resolvers/issues_resolver.rb @@ -23,7 +23,11 @@ module Resolvers projects = nodes.map(&:project) ::Preloaders::UserMaxAccessLevelInProjectsPreloader.new(projects, current_user).execute ::Preloaders::GroupPolicyPreloader.new(projects.filter_map(&:group), current_user).execute - ActiveRecord::Associations::Preloader.new(records: projects, associations: :namespace).call + ActiveRecord::Associations::Preloader.new(records: projects, associations: project_associations).call + end + + def self.project_associations + [:namespace] end def ready?(**args) @@ -62,3 +66,5 @@ module Resolvers end end end + +Resolvers::IssuesResolver.prepend_mod diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 30f8f6fdfe5..a892b6e6ac6 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -67,6 +67,8 @@ module UsersHelper project_ids = projects.pluck(:id) # rubocop: enable CodeReuse/ActiveRecord + preload_project_associations(projects) + Preloaders::UserMaxAccessLevelInProjectsPreloader .new(project_ids, current_user) .execute @@ -371,6 +373,10 @@ module UsersHelper def saved_replies_enabled? Feature.enabled?(:saved_replies, current_user) end + + def preload_project_associations(_) + # Overridden in EE + end end UsersHelper.prepend_mod_with('UsersHelper') diff --git a/app/policies/identity_provider_policy.rb b/app/policies/identity_provider_policy.rb index 1e748c78555..36f7ff28fa0 100644 --- a/app/policies/identity_provider_policy.rb +++ b/app/policies/identity_provider_policy.rb @@ -13,5 +13,3 @@ class IdentityProviderPolicy < BasePolicy rule { protected_provider }.prevent(:unlink) end - -IdentityProviderPolicy.prepend_mod_with('IdentityProviderPolicy') diff --git a/doc/administration/settings/account_and_limit_settings.md b/doc/administration/settings/account_and_limit_settings.md index 930448b3bd3..b33ceb2c4e5 100644 --- a/doc/administration/settings/account_and_limit_settings.md +++ b/doc/administration/settings/account_and_limit_settings.md @@ -48,7 +48,7 @@ To change the maximum attachment size: 1. Select **Admin Area**. 1. Select **Settings > General**. 1. Expand **Account and limit**. -1. Increase or decrease by changing the value in **Maximum attachment size (MB)**. +1. Increase or decrease by changing the value in **Maximum attachment size (MiB)**. If you choose a size larger than the configured value for the web server, you may receive errors. Read the [troubleshooting section](#troubleshooting) for more @@ -64,7 +64,7 @@ You can change the maximum push size for your instance: 1. Select **Admin Area**. 1. Select **Settings > General**. 1. Expand **Account and limit**. -1. Increase or decrease by changing the value in **Maximum push size (MB)**. +1. Increase or decrease by changing the value in **Maximum push size (MiB)**. For GitLab.com push size limits, read [accounts and limit settings](../../user/gitlab_com/index.md#account-and-limit-settings). @@ -132,18 +132,18 @@ These settings can be found in: - Each project's settings: 1. From the Project's homepage, navigate to **Settings > General**. - 1. Fill in the **Repository size limit (MB)** field in the **Naming, topics, avatar** section. + 1. Fill in the **Repository size limit (MiB)** field in the **Naming, topics, avatar** section. 1. Select **Save changes**. - Each group's settings: 1. From the Group's homepage, navigate to **Settings > General**. - 1. Fill in the **Repository size limit (MB)** field in the **Naming, visibility** section. + 1. Fill in the **Repository size limit (MiB)** field in the **Naming, visibility** section. 1. Select **Save changes**. - GitLab global settings: 1. On the left sidebar, select **Search or go to**. 1. Select **Admin Area**. 1. Select **Settings > General**. 1. Expand the **Account and limit** section. - 1. Fill in the **Size limit per repository (MB)** field. + 1. Fill in the **Size limit per repository (MiB)** field. 1. Select **Save changes**. The first push of a new project, including LFS objects, is checked for size. diff --git a/doc/administration/settings/import_and_export_settings.md b/doc/administration/settings/import_and_export_settings.md index af1729246ec..343bc08c801 100644 --- a/doc/administration/settings/import_and_export_settings.md +++ b/doc/administration/settings/import_and_export_settings.md @@ -70,7 +70,7 @@ To modify the maximum file size for exports in GitLab: ## Max import size -> [Changed](https://gitlab.com/gitlab-org/gitlab/-/issues/251106) from 50 MB to unlimited in GitLab 13.8. +> [Changed](https://gitlab.com/gitlab-org/gitlab/-/issues/251106) from 50 MiB to unlimited in GitLab 13.8. To modify the maximum file size for imports in GitLab: @@ -93,9 +93,9 @@ For GitLab.com repository size limits, read [accounts and limit settings](../../ > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/384976) in GitLab 16.3. -You can modify the maximum remote file size for imports from external object storages (for example, AWS) in GitLab. +By default, the maximum remote file size for imports from external object storages (for example, AWS) is 10 GiB. -To modify the maximum import remote file size: +To modify this setting: 1. On the left sidebar, select **Search or go to**. 1. Select **Admin Area**. @@ -107,9 +107,9 @@ To modify the maximum import remote file size: > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/384976) in GitLab 16.3. -You can modify the maximum download file size for imports by direct transfer in GitLab. +By default, the maximum download file size for imports by direct transfer is 5 GiB. -To modify the maximum download file size for imports by direct transfer: +To modify this setting: 1. On the left sidebar, select **Search or go to**. 1. Select **Admin Area**. @@ -122,15 +122,18 @@ To modify the maximum download file size for imports by direct transfer: > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/128218) in GitLab 16.3. > - **Maximum decompressed file size for archives from imports** field [renamed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/130081) from **Maximum decompressed size** in GitLab 16.4. -When you import a project using [file exports](../../user/project/settings/import_export.md) or [direct transfer](../../user/group/import/index.md#migrate-groups-by-direct-transfer-recommended), you can specify the maximum decompressed file size for imported archives. The default value is 25 GB. +When you import a project using [file exports](../../user/project/settings/import_export.md) or +[direct transfer](../../user/group/import/index.md#migrate-groups-by-direct-transfer-recommended), you can specify the +maximum decompressed file size for imported archives. The default value is 25 GiB. -When you import a compressed file, the decompressed size cannot exceed the maximum decompressed file size limit. If the decompressed size exceeds the configured limit, the following error is returned: +When you import a compressed file, the decompressed size cannot exceed the maximum decompressed file size limit. If the +decompressed size exceeds the configured limit, the following error is returned: ```plaintext Decompressed archive size validation failed. ``` -To modify the maximum decompressed file size for imports in GitLab: +To modify this setting: 1. On the left sidebar, select **Search or go to**. 1. Select **Admin Area**. diff --git a/doc/ci/runners/configure_runners.md b/doc/ci/runners/configure_runners.md index fd1716cc58a..33e53051319 100644 --- a/doc/ci/runners/configure_runners.md +++ b/doc/ci/runners/configure_runners.md @@ -57,6 +57,45 @@ How this feature works: 1. You start a job 1. The job, if running longer, times out after **30 minutes** +## Set `script` and `after_script` timeouts + +> [Introduced](https://gitlab.com/gitlab-org/gitlab-runner/-/merge_requests/4335) in GitLab Runner 16.4. + +To control the amount of time `script` and `after_script` runs before it terminates, you can set specify a timeout. + +For example, you can specify a timeout to terminate a long-running `script` early, so that artifacts and caches can still be uploaded +before the [job timeout](#set-maximum-job-timeout-for-a-runner) is exceeded. + +- To set a timeout for `script`, use the job variable `RUNNER_SCRIPT_TIMEOUT`. +- To set a timeout for `after_script`, and override the default of 5 minutes, use the job variable `RUNNER_AFTER_SCRIPT_TIMEOUT`. + +Both of these variables accept [Go's duration format](https://pkg.go.dev/time#ParseDuration) (for example, `40s`, `1h20m`, `2h` `4h30m30s`). + +For example: + +```yaml +job-with-script-timeouts: + variables: + RUNNER_SCRIPT_TIMEOUT: 15m + RUNNER_AFTER_SCRIPT_TIMEOUT: 10m + script: + - "I am allowed to run for min(15m, remaining job timeout)." + after_script: + - "I am allowed to run for min(10m, remaining job timeout)." + +job-artifact-upload-on-timeout: + timeout: 1h # set job timeout to 1 hour + variables: + RUNNER_SCRIPT_TIMEOUT: 50m # only allow script to run for 50 minutes + script: + - long-running-process > output.txt # will be terminated after 50m + + artifacts: # artifacts will have roughly ~10m to upload + paths: + - output.txt + when: on_failure # on_failure because script termination after a timeout is treated as a failure +``` + ## Protecting sensitive information To avoid exposing sensitive information, you can restrict the usage diff --git a/doc/ci/yaml/index.md b/doc/ci/yaml/index.md index 6275d4293ea..ddb40d9f435 100644 --- a/doc/ci/yaml/index.md +++ b/doc/ci/yaml/index.md @@ -631,7 +631,9 @@ Scripts you specify in `after_script` execute in a new shell, separate from any - Command aliases and variables exported in `script` scripts. - Changes outside of the working tree (depending on the runner executor), like software installed by a `before_script` or `script` script. -- Have a separate timeout, which is [hard-coded to 5 minutes](https://gitlab.com/gitlab-org/gitlab-runner/-/issues/2716). +- Have a separate timeout. For GitLab Runner 16.4 and later, this defaults to 5 minutes, and can be configured with the + [`RUNNER_AFTER_SCRIPT_TIMEOUT`](../runners/configure_runners.md#set-script-and-after_script-timeouts) variable. + In GitLab 16.3 and earlier, the timeout is hard-coded to 5 minutes. - Don't affect the job's exit code. If the `script` section succeeds and the `after_script` times out or fails, the job exits with code `0` (`Job Succeeded`). diff --git a/doc/operations/incident_management/manage_incidents.md b/doc/operations/incident_management/manage_incidents.md index 28c4adec250..3814bf83c51 100644 --- a/doc/operations/incident_management/manage_incidents.md +++ b/doc/operations/incident_management/manage_incidents.md @@ -201,15 +201,6 @@ In GitLab 15.1 and earlier, the escalation policy for [incidents created from al reflects the alert's escalation policy and cannot be changed. In [GitLab 15.2 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/356057), the incident escalation policy is independent and can be changed. -<!--- start_remove The following content will be removed on remove_date: '2023-08-22' --> - -## Embed metrics (removed) - -This feature was [deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/346541) in GitLab 14.7 -and [removed](https://gitlab.com/gitlab-org/gitlab/-/issues/399231) in 16.0. - -<!--- end_remove --> - ## Close an incident Prerequisites: diff --git a/doc/operations/index.md b/doc/operations/index.md index 73925afb2d8..766047e1f29 100644 --- a/doc/operations/index.md +++ b/doc/operations/index.md @@ -9,15 +9,6 @@ info: To determine the technical writer assigned to the Stage/Group associated w GitLab provides a variety of tools to help operate and maintain your applications. -<!--- start_remove The following content will be removed on remove_date: '2023-08-22' --> - -## Measure reliability and stability with metrics (removed) - -This feature was [deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/346541) in GitLab 14.7 -and [removed](https://gitlab.com/gitlab-org/gitlab/-/issues/399231) in 16.0. - -<!--- end_remove --> - ## Manage alerts and incidents GitLab helps reduce alert fatigue for IT responders by providing tools to identify diff --git a/doc/user/gitlab_com/index.md b/doc/user/gitlab_com/index.md index 09e05538fd7..6f809ae867a 100644 --- a/doc/user/gitlab_com/index.md +++ b/doc/user/gitlab_com/index.md @@ -210,21 +210,22 @@ varies by format: GitLab.com has the following account limits enabled. If a setting is not listed, the default value [is the same as for self-managed instances](../../administration/settings/account_and_limit_settings.md): -| Setting | GitLab.com default | -|--------------------------------------------------------------------------------------------------------------------|--------------------| -| [Repository size including LFS](../../administration/settings/account_and_limit_settings.md#repository-size-limit) | 10 GB | -| [Maximum import size](../project/settings/import_export.md#import-a-project-and-its-data) | 5 GB | -| Maximum remote file size for imports from external object storages | 10 GB | -| Maximum download file size when importing from source GitLab instances by direct transfer | 5 GB | -| Maximum attachment size | 100 MB | -| [Maximum decompressed file size for imported archives](../../administration/settings/import_and_export_settings.md#maximum-decompressed-file-size-for-imported-archives) | 25 GB | - -If you are near or over the repository size limit, you can either -[reduce your repository size with Git](../project/repository/reducing_the_repo_size_using_git.md) -or [purchase additional storage](https://about.gitlab.com/pricing/licensing-faq/#can-i-buy-more-storage). +| Setting | GitLab.com default | +|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-------------------| +| [Repository size including LFS](../../administration/settings/account_and_limit_settings.md#repository-size-limit) | 10 GB | +| [Maximum import size](../project/settings/import_export.md#import-a-project-and-its-data) | 5 GiB | +| [Maximum remote file size for imports from external object storages](../../administration/settings/import_and_export_settings.md#maximum-remote-file-size-for-imports) | 10 GiB | +| [Maximum download file size when importing from source GitLab instances by direct transfer](../../administration/settings/import_and_export_settings.md#maximum-download-file-size-for-imports-by-direct-transfer) | 5 GiB | +| Maximum attachment size | 100 MiB | +| [Maximum decompressed file size for imported archives](../../administration/settings/import_and_export_settings.md#maximum-decompressed-file-size-for-imported-archives) | 25 GiB | + +If you are near or over the repository size limit, you can either: + +- [Reduce your repository size with Git](../project/repository/reducing_the_repo_size_using_git.md). +- [Purchase additional storage](https://about.gitlab.com/pricing/licensing-faq/#can-i-buy-more-storage). NOTE: -`git push` and GitLab project imports are limited to 5 GB per request through +`git push` and GitLab project imports are limited to 5 GiB per request through Cloudflare. Imports other than a file upload are not affected by this limit. Repository limits apply to both public and private projects. diff --git a/doc/user/group/import/index.md b/doc/user/group/import/index.md index a049b4afcc1..e1d5c8e5f0a 100644 --- a/doc/user/group/import/index.md +++ b/doc/user/group/import/index.md @@ -118,13 +118,18 @@ Hardcoded limits apply on migration by direct transfer. | Limit | Description | |:------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 6 | Maximum number of migrations permitted by a destination GitLab instance per minute per user. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/386452) in GitLab 15.9. | -| 5 GB | Maximum relation size that can be downloaded from the source instance. | -| 10 GB | Maximum size of a decompressed archive. | | 210 seconds | Maximum number of seconds to wait for decompressing an archive file. | | 50 MB | Maximum length an NDJSON row can have. | | 5 minutes | Maximum number of seconds until an empty export status on source instance is raised. | | 8 hours | Time until migration times out. | +[Configurable limits](../../../administration/settings/account_and_limit_settings.md) are also available. + +In GitLab 16.3 and later, the following previously hard-coded settings are [configurable](https://gitlab.com/gitlab-org/gitlab/-/issues/384976): + +- Maximum relation size that can be downloaded from the source instance (set to 5 GiB). +- Maximum size of a decompressed archive (set to 10 GiB). + You can test the maximum relation size limit using these APIs: - [Group relations export API](../../../api/group_relations_export.md). diff --git a/lib/gitlab/prometheus/queries/matched_metric_query.rb b/lib/gitlab/prometheus/queries/matched_metric_query.rb deleted file mode 100644 index 73de5a11998..00000000000 --- a/lib/gitlab/prometheus/queries/matched_metric_query.rb +++ /dev/null @@ -1,82 +0,0 @@ -# frozen_string_literal: true - -module Gitlab - module Prometheus - module Queries - class MatchedMetricQuery < BaseQuery - MAX_QUERY_ITEMS = 40 - - def query - groups_data.map do |group, data| - { - group: group.name, - priority: group.priority, - active_metrics: data[:active_metrics], - metrics_missing_requirements: data[:metrics_missing_requirements] - } - end - end - - private - - def groups_data - metrics_groups = groups_with_active_metrics(Gitlab::Prometheus::MetricGroup.common_metrics) - lookup = active_series_lookup(metrics_groups) - - groups = {} - - metrics_groups.each do |group| - groups[group] ||= { active_metrics: 0, metrics_missing_requirements: 0 } - active_metrics = group.metrics.count { |metric| metric.required_metrics.all?(&lookup.method(:has_key?)) } - - groups[group][:active_metrics] += active_metrics - groups[group][:metrics_missing_requirements] += group.metrics.count - active_metrics - end - - groups - end - - def active_series_lookup(metric_groups) - timeframe_start = 8.hours.ago - timeframe_end = Time.now - - series = metric_groups.flat_map(&:metrics).flat_map(&:required_metrics).uniq - - lookup = series.each_slice(MAX_QUERY_ITEMS).flat_map do |batched_series| - client_series(*batched_series, start_time: timeframe_start, end_time: timeframe_end) - .select(&method(:has_matching_label?)) - .map { |series_info| [series_info['__name__'], true] } - end - lookup.to_h - end - - def has_matching_label?(series_info) - series_info.key?('environment') - end - - def available_metrics - @available_metrics ||= client_label_values || [] - end - - def filter_active_metrics(metric_group) - metric_group.metrics.select! do |metric| - metric.required_metrics.all?(&available_metrics.method(:include?)) - end - metric_group - end - - def groups_with_active_metrics(metric_groups) - metric_groups.map(&method(:filter_active_metrics)).select { |group| group.metrics.any? } - end - - def metrics_with_required_series(metric_groups) - metric_groups.flat_map do |group| - group.metrics.select do |metric| - metric.required_metrics.all?(&available_metrics.method(:include?)) - end - end - end - end - end - end -end diff --git a/lib/gitlab/prometheus/queries/validate_query.rb b/lib/gitlab/prometheus/queries/validate_query.rb deleted file mode 100644 index 160db7d44bc..00000000000 --- a/lib/gitlab/prometheus/queries/validate_query.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -module Gitlab - module Prometheus - module Queries - class ValidateQuery < BaseQuery - def query(query) - client_query(query) - { valid: true } - rescue Gitlab::PrometheusClient::QueryError, Gitlab::PrometheusClient::ConnectionError => ex - { valid: false, error: ex.message } - end - - def self.transform_reactive_result(result) - result[:query] = result.delete :data - result - end - end - end - end -end diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 0ed1810f1a7..8d1697b4a8e 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -40340,7 +40340,7 @@ msgstr "" msgid "Runners|Add notes such as the runner owner or what it should be used for." msgstr "" -msgid "Runners|Add tags for the types of jobs the runner processes to ensure that the runner only runs jobs that you intend it to. %{helpLinkStart}Learn more.%{helpLinkEnd}" +msgid "Runners|Add tags to specify jobs that the runner can run. %{helpLinkStart}Learn more.%{helpLinkEnd}" msgstr "" msgid "Runners|Add your feedback to this issue" @@ -40522,7 +40522,7 @@ msgstr "" msgid "Runners|Enable stale runner cleanup?" msgstr "" -msgid "Runners|Enter the number of seconds." +msgid "Runners|Enter the job timeout in seconds. Must be a minimum of 600 seconds." msgstr "" msgid "Runners|Environment" @@ -40639,9 +40639,6 @@ msgstr "" msgid "Runners|Most recent failures" msgstr "" -msgid "Runners|Multiple tags must be separated by a comma. For example, %{example}." -msgstr "" - msgid "Runners|Name" msgstr "" @@ -40925,6 +40922,9 @@ msgstr "" msgid "Runners|Select your preferred runner, then choose the capacity for the runner in the AWS CloudFormation console." msgstr "" +msgid "Runners|Separate multiple tags with a comma. For example, %{example}." +msgstr "" + msgid "Runners|Shared runners are disabled in the group settings." msgstr "" diff --git a/rubocop/cop/migration/background_migrations.rb b/rubocop/cop/migration/background_migrations.rb index 7dcc2101fb1..e131ab42318 100644 --- a/rubocop/cop/migration/background_migrations.rb +++ b/rubocop/cop/migration/background_migrations.rb @@ -14,11 +14,11 @@ module RuboCop def on_send(node) name = node.children[1] - disabled_methods = %i( + disabled_methods = %i[ queue_background_migration_jobs_by_range_at_intervals requeue_background_migration_jobs_by_range_at_intervals migrate_in - ) + ] add_offense(node.loc.selector) if disabled_methods.include? name end diff --git a/rubocop/cop/rspec/httparty_basic_auth.rb b/rubocop/cop/rspec/httparty_basic_auth.rb index d188002673f..68d48ca4f82 100644 --- a/rubocop/cop/rspec/httparty_basic_auth.rb +++ b/rubocop/cop/rspec/httparty_basic_auth.rb @@ -19,7 +19,7 @@ module RuboCop MESSAGE = "`basic_auth: { user: ... }` does not work - replace `user:` with `username:`" - RESTRICT_ON_SEND = %i(get put post delete).freeze + RESTRICT_ON_SEND = %i[get put post delete].freeze def_node_matcher :httparty_basic_auth?, <<~PATTERN (send diff --git a/rubocop/migration_helpers.rb b/rubocop/migration_helpers.rb index d49280c39e4..400c0c3a2a7 100644 --- a/rubocop/migration_helpers.rb +++ b/rubocop/migration_helpers.rb @@ -19,9 +19,9 @@ module RuboCop # List of helpers that add new columns, either directly (ADD_COLUMN_METHODS) # or through a create/alter table (TABLE_METHODS) - ADD_COLUMN_METHODS = %i(add_column change_column_type_concurrently).freeze + ADD_COLUMN_METHODS = %i[add_column change_column_type_concurrently].freeze - TABLE_METHODS = %i(create_table create_table_if_not_exists change_table).freeze + TABLE_METHODS = %i[create_table create_table_if_not_exists change_table].freeze def high_traffic_tables @high_traffic_tables ||= rubocop_migrations_config.dig('Migration/UpdateLargeTable', 'HighTrafficTables') diff --git a/scripts/qa/quarantine-types-check b/scripts/qa/quarantine-types-check index 188348b949c..8c2768b6722 100755 --- a/scripts/qa/quarantine-types-check +++ b/scripts/qa/quarantine-types-check @@ -7,8 +7,8 @@ QUARANTINE_TYPES = %w[stale bug investigating flaky broken test_environment wait missing_issues = [] quarantine_type_errors = [] -invalid_type_message = %"\n*** The following quarantined tests have invalid types:\n\n%s\n" -missing_issue_message = %"\n*** The following quarantined tests are missing issue links:\n\n%s\n" +invalid_type_message = %(\n*** The following quarantined tests have invalid types:\n\n%s\n) +missing_issue_message = %(\n*** The following quarantined tests are missing issue links:\n\n%s\n) test_metadata_file = ARGV.shift diff --git a/scripts/qa/testcases-check b/scripts/qa/testcases-check index 2bc1ea2c5c7..fad5f620e02 100755 --- a/scripts/qa/testcases-check +++ b/scripts/qa/testcases-check @@ -9,9 +9,9 @@ testcases = [] missing_testcases = [] formatted_duplicates = [] testcase_format_errors = [] -missing_message = %"\n*** The following tests are missing testcase links:\n\n%s\n" -duplicate_message = %"\n*** The following tests have duplicate testcase links:\n\n%s" -format_message = %"\n*** The following testcase links are incorrectly formatted:\n\n%s\n" +missing_message = %(\n*** The following tests are missing testcase links:\n\n%s\n) +duplicate_message = %(\n*** The following tests have duplicate testcase links:\n\n%s) +format_message = %(\n*** The following testcase links are incorrectly formatted:\n\n%s\n) test_metadata_file = ARGV.shift diff --git a/scripts/regenerate-schema b/scripts/regenerate-schema index 67c58339c6c..f1018403395 100755 --- a/scripts/regenerate-schema +++ b/scripts/regenerate-schema @@ -52,8 +52,8 @@ class SchemaRegenerator def checkout_ref return unless ci? - run %[git checkout #{source_ref}] - run %q[git clean -f -- db] + run %(git checkout #{source_ref}) + run %q(git clean -f -- db) end ## @@ -71,8 +71,8 @@ class SchemaRegenerator return false unless project_url return false unless target_project_url - run %[git remote add target_project #{target_project_url}.git] - run %[git fetch target_project #{target_branch}:#{target_branch}] + run %(git remote add target_project #{target_project_url}.git) + run %(git fetch target_project #{target_branch}:#{target_branch}) local_checkout_clean_schema end @@ -83,8 +83,8 @@ class SchemaRegenerator # Ask git to checkout the schema from the target branch and reset # the file to unstage the changes. def local_checkout_clean_schema - run %[git checkout #{merge_base} -- #{FILENAME}] - run %[git reset -- #{FILENAME}] + run %(git checkout #{merge_base} -- #{FILENAME}) + run %(git reset -- #{FILENAME}) end ## @@ -152,19 +152,19 @@ class SchemaRegenerator ## # Stop spring before modifying the database def stop_spring - run %q[bin/spring stop] + run %q(bin/spring stop) end ## # Run rake task to reset the database. def reset_db - run %q[bin/rails db:reset RAILS_ENV=test] + run %q(bin/rails db:reset RAILS_ENV=test) end ## # Run rake task to run migrations. def migrate - run %q[bin/rails db:migrate RAILS_ENV=test] + run %q(bin/rails db:migrate RAILS_ENV=test) end ## diff --git a/scripts/undercoverage b/scripts/undercoverage index 348f421c0d5..4acfc78b11b 100755 --- a/scripts/undercoverage +++ b/scripts/undercoverage @@ -20,11 +20,11 @@ module Undercover end compare_base = ARGV[0] -compare_base ||= IO.popen(%w(git merge-base origin/master HEAD)) { |p| p.read.chomp } +compare_base ||= IO.popen(%w[git merge-base origin/master HEAD]) { |p| p.read.chomp } coverage_file_path = 'coverage/lcov/gitlab.lcov' result = if File.exist?(coverage_file_path) - Undercover::CLI.run(%W(-c #{compare_base})) + Undercover::CLI.run(%W[-c #{compare_base}]) else warn "#{coverage_file_path} doesn't exist" 0 diff --git a/sidekiq_cluster/cli.rb b/sidekiq_cluster/cli.rb index fc065d799d4..ddedc63e458 100644 --- a/sidekiq_cluster/cli.rb +++ b/sidekiq_cluster/cli.rb @@ -23,10 +23,10 @@ module Gitlab THREAD_NAME = 'sidekiq-cluster' # The signals that should terminate both the master and workers. - TERMINATE_SIGNALS = %i(INT TERM).freeze + TERMINATE_SIGNALS = %i[INT TERM].freeze # The signals that should simply be forwarded to the workers. - FORWARD_SIGNALS = %i(TTIN USR1 USR2 HUP).freeze + FORWARD_SIGNALS = %i[TTIN USR1 USR2 HUP].freeze # The default queues that each Sidekiq process always listens to if routing rules are not customized: # - `default` queue comes from config initializer's Settings.build_sidekiq_routing_rules diff --git a/spec/frontend/ci/job_details/components/sidebar/artifacts_block_spec.js b/spec/frontend/ci/job_details/components/sidebar/artifacts_block_spec.js index 1d61bf3243f..e539be2b220 100644 --- a/spec/frontend/ci/job_details/components/sidebar/artifacts_block_spec.js +++ b/spec/frontend/ci/job_details/components/sidebar/artifacts_block_spec.js @@ -30,31 +30,31 @@ describe('Artifacts block', () => { 'These artifacts are the latest. They will not be deleted (even if expired) until newer artifacts are available.'; const expiredArtifact = { - expire_at: expireAt, + expireAt, expired: true, locked: false, }; const nonExpiredArtifact = { - download_path: '/gitlab-org/gitlab-foss/-/jobs/98314558/artifacts/download', - browse_path: '/gitlab-org/gitlab-foss/-/jobs/98314558/artifacts/browse', - keep_path: '/gitlab-org/gitlab-foss/-/jobs/98314558/artifacts/keep', - expire_at: expireAt, + downloadPath: '/gitlab-org/gitlab-foss/-/jobs/98314558/artifacts/download', + browsePath: '/gitlab-org/gitlab-foss/-/jobs/98314558/artifacts/browse', + keepPath: '/gitlab-org/gitlab-foss/-/jobs/98314558/artifacts/keep', + expireAt, expired: false, locked: false, }; const lockedExpiredArtifact = { ...expiredArtifact, - download_path: '/gitlab-org/gitlab-foss/-/jobs/98314558/artifacts/download', - browse_path: '/gitlab-org/gitlab-foss/-/jobs/98314558/artifacts/browse', + downloadPath: '/gitlab-org/gitlab-foss/-/jobs/98314558/artifacts/download', + browsePath: '/gitlab-org/gitlab-foss/-/jobs/98314558/artifacts/browse', expired: true, locked: true, }; const lockedNonExpiredArtifact = { ...nonExpiredArtifact, - keep_path: undefined, + keepPath: undefined, locked: true, }; diff --git a/spec/frontend/sentry/init_sentry_spec.js b/spec/frontend/sentry/init_sentry_spec.js index e31068b935b..4196664e8d6 100644 --- a/spec/frontend/sentry/init_sentry_spec.js +++ b/spec/frontend/sentry/init_sentry_spec.js @@ -3,6 +3,7 @@ import { defaultStackParser, makeFetchTransport, defaultIntegrations, + BrowserTracing, // exports captureException, @@ -96,7 +97,7 @@ describe('SentryConfig', () => { transport: makeFetchTransport, stackParser: defaultStackParser, - integrations: defaultIntegrations, + integrations: [...defaultIntegrations, expect.any(BrowserTracing)], }), ); }); diff --git a/spec/frontend/vue_merge_request_widget/mr_widget_options_spec.js b/spec/frontend/vue_merge_request_widget/mr_widget_options_spec.js index 09f58f17fd9..68af4feffb7 100644 --- a/spec/frontend/vue_merge_request_widget/mr_widget_options_spec.js +++ b/spec/frontend/vue_merge_request_widget/mr_widget_options_spec.js @@ -21,7 +21,7 @@ import { registerExtension, registeredExtensions, } from '~/vue_merge_request_widget/components/extensions'; -import { STATUS_CLOSED, STATUS_OPEN } from '~/issues/constants'; +import { STATUS_CLOSED, STATUS_OPEN, STATUS_MERGED } from '~/issues/constants'; import { STATE_QUERY_POLLING_INTERVAL_BACKOFF } from '~/vue_merge_request_widget/constants'; import { SUCCESS } from '~/vue_merge_request_widget/components/deployment/constants'; import eventHub from '~/vue_merge_request_widget/event_hub'; @@ -30,6 +30,7 @@ import Approvals from '~/vue_merge_request_widget/components/approvals/approvals import ConflictsState from '~/vue_merge_request_widget/components/states/mr_widget_conflicts.vue'; import Preparing from '~/vue_merge_request_widget/components/states/mr_widget_preparing.vue'; import ShaMismatch from '~/vue_merge_request_widget/components/states/sha_mismatch.vue'; +import MergedState from '~/vue_merge_request_widget/components/states/mr_widget_merged.vue'; import WidgetContainer from '~/vue_merge_request_widget/components/widget/app.vue'; import WidgetSuggestPipeline from '~/vue_merge_request_widget/components/mr_widget_suggest_pipeline.vue'; import MrWidgetAlertMessage from '~/vue_merge_request_widget/components/mr_widget_alert_message.vue'; @@ -186,25 +187,13 @@ describe('MrWidgetOptions', () => { describe('default', () => { describe('computed', () => { describe('componentName', () => { - beforeEach(async () => { - await createComponent(); - }); - - // quarantine: https://gitlab.com/gitlab-org/gitlab/-/issues/409365 - // eslint-disable-next-line jest/no-disabled-tests - it.skip.each` - ${'merged'} | ${'mr-widget-merged'} - `('should translate $state into $componentName', ({ state, componentName }) => { - wrapper.vm.mr.state = state; - - expect(wrapper.vm.componentName).toEqual(componentName); - }); - it.each` state | componentName | component + ${STATUS_MERGED} | ${'MergedState'} | ${MergedState} ${'conflicts'} | ${'ConflictsState'} | ${ConflictsState} ${'shaMismatch'} | ${'ShaMismatch'} | ${ShaMismatch} `('should translate $state into $componentName component', async ({ state, component }) => { + await createComponent(); Vue.set(wrapper.vm.mr, 'state', state); await nextTick(); expect(wrapper.findComponent(component).exists()).toBe(true); diff --git a/spec/graphql/mutations/design_management/delete_spec.rb b/spec/graphql/mutations/design_management/delete_spec.rb index 9a2efb61e55..1b78529fbc7 100644 --- a/spec/graphql/mutations/design_management/delete_spec.rb +++ b/spec/graphql/mutations/design_management/delete_spec.rb @@ -90,7 +90,7 @@ RSpec.describe Mutations::DesignManagement::Delete do allow(Gitlab::Tracking).to receive(:event) # rubocop:disable RSpec/ExpectGitlabTracking filenames.each(&:present?) # ignore setup - # Queries: as of 2022-08-30 + # Queries: as of 2022-09-08 # ------------- # 01. routing query # 02. policy query: find namespace by type and id @@ -101,30 +101,31 @@ RSpec.describe Mutations::DesignManagement::Delete do # 08. find project by id # 09. find namespace by id # 10. find group namespace by id - # 11. project.authorizations for user (same query as 5) - # 12. find user by id - # 13. project.project_features (same query as 3) - # 14. project.authorizations for user (same query as 5) - # 15. current designs by filename and issue - # 16, 17 project.authorizations for user (same query as 5) - # 18. find design_management_repository for project - # 19. find route by id and source_type + # 11. policy query: find namespace by id (same query as 3) + # 12. project.authorizations for user (same query as 5) + # 13. find user by id + # 14. project.project_features (same query as 3) + # 15. project.authorizations for user (same query as 5) + # 16. current designs by filename and issue + # 17, 18 project.authorizations for user (same query as 5) + # 19. find design_management_repository for project + # 20. find route by id and source_type # ------------- our queries are below: - # 20. start transaction - # 21. create version with sha and issue - # 22. create design-version links - # 23. validate version.actions.present? - # 24. validate version.sha is unique - # 25. validate version.issue.present? - # 26. leave transaction - # 27. find project by id (same query as 8) - # 28. find namespace by id (same query as 9) - # 29. find project by id (same query as 8) + # 21. start transaction + # 22. create version with sha and issue + # 23. create design-version links + # 24. validate version.actions.present? + # 25. validate version.sha is unique + # 26. validate version.issue.present? + # 27. leave transaction + # 28. find project by id (same query as 8) + # 29. find namespace by id (same query as 9) # 30. find project by id (same query as 8) - # 31. create event - # 32. find plan for standard context + # 31. find project by id (same query as 8) + # 32. create event + # 33. find plan for standard context # - expect { run_mutation }.not_to exceed_query_limit(32) + expect { run_mutation }.not_to exceed_query_limit(33) end end diff --git a/spec/graphql/resolvers/users/participants_resolver_spec.rb b/spec/graphql/resolvers/users/participants_resolver_spec.rb index 22111626c5b..ae23eabaeb0 100644 --- a/spec/graphql/resolvers/users/participants_resolver_spec.rb +++ b/spec/graphql/resolvers/users/participants_resolver_spec.rb @@ -138,7 +138,8 @@ RSpec.describe Resolvers::Users::ParticipantsResolver do # 1 extra query per source (3 emojis + 2 notes) to fetch participables collection # 2 extra queries to load work item widgets collection # 1 extra query to load the project creator to check if they are banned - expect { query.call }.not_to exceed_query_limit(control_count).with_threshold(8) + # 1 extra query to load the invited groups to see if the user is banned from any of them + expect { query.call }.not_to exceed_query_limit(control_count).with_threshold(9) end it 'does not execute N+1 for system note metadata relation' do diff --git a/spec/lib/gitlab/prometheus/queries/matched_metric_query_spec.rb b/spec/lib/gitlab/prometheus/queries/matched_metric_query_spec.rb deleted file mode 100644 index 60449aeef7d..00000000000 --- a/spec/lib/gitlab/prometheus/queries/matched_metric_query_spec.rb +++ /dev/null @@ -1,137 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Gitlab::Prometheus::Queries::MatchedMetricQuery do - include Prometheus::MetricBuilders - - let(:metric_group_class) { Gitlab::Prometheus::MetricGroup } - let(:metric_class) { Gitlab::Prometheus::Metric } - - def series_info_with_environment(*more_metrics) - %w{metric_a metric_b}.concat(more_metrics).map { |metric_name| { '__name__' => metric_name, 'environment' => '' } } - end - - let(:metric_names) { %w{metric_a metric_b} } - let(:series_info_without_environment) do - [{ '__name__' => 'metric_a' }, - { '__name__' => 'metric_b' }] - end - - let(:partially_empty_series_info) { [{ '__name__' => 'metric_a', 'environment' => '' }] } - let(:empty_series_info) { [] } - - let(:client) { double('prometheus_client') } - - subject { described_class.new(client) } - - context 'with one group where two metrics is found' do - before do - allow(metric_group_class).to receive(:common_metrics).and_return([simple_metric_group]) - allow(client).to receive(:label_values).and_return(metric_names) - end - - context 'both metrics in the group pass requirements' do - before do - allow(client).to receive(:series).and_return(series_info_with_environment) - end - - it 'responds with both metrics as actve' do - expect(subject.query).to eq([{ group: 'name', priority: 1, active_metrics: 2, metrics_missing_requirements: 0 }]) - end - end - - context 'none of the metrics pass requirements' do - before do - allow(client).to receive(:series).and_return(series_info_without_environment) - end - - it 'responds with both metrics missing requirements' do - expect(subject.query).to eq([{ group: 'name', priority: 1, active_metrics: 0, metrics_missing_requirements: 2 }]) - end - end - - context 'no series information found about the metrics' do - before do - allow(client).to receive(:series).and_return(empty_series_info) - end - - it 'responds with both metrics missing requirements' do - expect(subject.query).to eq([{ group: 'name', priority: 1, active_metrics: 0, metrics_missing_requirements: 2 }]) - end - end - - context 'one of the series info was not found' do - before do - allow(client).to receive(:series).and_return(partially_empty_series_info) - end - it 'responds with one active and one missing metric' do - expect(subject.query).to eq([{ group: 'name', priority: 1, active_metrics: 1, metrics_missing_requirements: 1 }]) - end - end - end - - context 'with one group where only one metric is found' do - before do - allow(metric_group_class).to receive(:common_metrics).and_return([simple_metric_group]) - allow(client).to receive(:label_values).and_return('metric_a') - end - - context 'both metrics in the group pass requirements' do - before do - allow(client).to receive(:series).and_return(series_info_with_environment) - end - - it 'responds with one metrics as active and no missing requiremens' do - expect(subject.query).to eq([{ group: 'name', priority: 1, active_metrics: 1, metrics_missing_requirements: 0 }]) - end - end - - context 'no metrics in group pass requirements' do - before do - allow(client).to receive(:series).and_return(series_info_without_environment) - end - - it 'responds with one metrics as active and no missing requiremens' do - expect(subject.query).to eq([{ group: 'name', priority: 1, active_metrics: 0, metrics_missing_requirements: 1 }]) - end - end - end - - context 'with two groups where metrics are found in each group' do - let(:second_metric_group) { simple_metric_group(name: 'nameb', metrics: simple_metrics(added_metric_name: 'metric_c')) } - - before do - allow(metric_group_class).to receive(:common_metrics).and_return([simple_metric_group, second_metric_group]) - allow(client).to receive(:label_values).and_return('metric_c') - end - - context 'all metrics in both groups pass requirements' do - before do - allow(client).to receive(:series).and_return(series_info_with_environment('metric_c')) - end - - it 'responds with one metrics as active and no missing requiremens' do - expect(subject.query).to eq([ - { group: 'name', priority: 1, active_metrics: 1, metrics_missing_requirements: 0 }, - { group: 'nameb', priority: 1, active_metrics: 2, metrics_missing_requirements: 0 } - ] - ) - end - end - - context 'no metrics in groups pass requirements' do - before do - allow(client).to receive(:series).and_return(series_info_without_environment) - end - - it 'responds with one metrics as active and no missing requiremens' do - expect(subject.query).to eq([ - { group: 'name', priority: 1, active_metrics: 0, metrics_missing_requirements: 1 }, - { group: 'nameb', priority: 1, active_metrics: 0, metrics_missing_requirements: 2 } - ] - ) - end - end - end -end diff --git a/spec/lib/gitlab/prometheus/queries/validate_query_spec.rb b/spec/lib/gitlab/prometheus/queries/validate_query_spec.rb deleted file mode 100644 index f09fa3548f8..00000000000 --- a/spec/lib/gitlab/prometheus/queries/validate_query_spec.rb +++ /dev/null @@ -1,59 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Gitlab::Prometheus::Queries::ValidateQuery do - include PrometheusHelpers - - let(:api_url) { 'https://prometheus.example.com' } - let(:client) { Gitlab::PrometheusClient.new(api_url) } - let(:query) { 'avg(metric)' } - - subject { described_class.new(client) } - - context 'valid query' do - before do - allow(client).to receive(:query).with(query) - end - - it 'passess query to prometheus' do - expect(subject.query(query)).to eq(valid: true) - - expect(client).to have_received(:query).with(query) - end - end - - context 'invalid query' do - let(:query) { 'invalid query' } - let(:error_message) { "invalid parameter 'query': 1:9: parse error: unexpected identifier \"query\"" } - - it 'returns invalid' do - freeze_time do - stub_prometheus_query_error( - prometheus_query_with_time_url(query, Time.now), - error_message - ) - - expect(subject.query(query)).to eq(valid: false, error: error_message) - end - end - end - - context 'when exceptions occur' do - context 'Gitlab::HTTP::BlockedUrlError' do - let(:api_url) { 'http://192.168.1.1' } - - let(:message) { "URL is blocked: Requests to the local network are not allowed" } - - before do - stub_application_setting(allow_local_requests_from_web_hooks_and_services: false) - end - - it 'catches exception and returns invalid' do - freeze_time do - expect(subject.query(query)).to eq(valid: false, error: message) - end - end - end - end -end diff --git a/spec/models/concerns/prometheus_adapter_spec.rb b/spec/models/concerns/prometheus_adapter_spec.rb index a3f2e99f3da..abb89832174 100644 --- a/spec/models/concerns/prometheus_adapter_spec.rb +++ b/spec/models/concerns/prometheus_adapter_spec.rb @@ -18,29 +18,6 @@ RSpec.describe PrometheusAdapter, :use_clean_rails_memory_store_caching do let(:environment_query) { Gitlab::Prometheus::Queries::EnvironmentQuery } describe '#query' do - describe 'validate_query' do - let(:environment) { build_stubbed(:environment, slug: 'env-slug') } - let(:validation_query) { Gitlab::Prometheus::Queries::ValidateQuery.name } - let(:query) { 'avg(response)' } - let(:validation_respone) { { data: { valid: true } } } - - around do |example| - freeze_time { example.run } - end - - context 'with valid data' do - subject { integration.query(:validate, query) } - - before do - stub_reactive_cache(integration, validation_respone, validation_query, query) - end - - it 'returns query data' do - is_expected.to eq(query: { valid: true }) - end - end - end - describe 'environment' do let(:environment) { build_stubbed(:environment, slug: 'env-slug') } @@ -61,25 +38,6 @@ RSpec.describe PrometheusAdapter, :use_clean_rails_memory_store_caching do end end - describe 'matched_metrics' do - let(:matched_metrics_query) { Gitlab::Prometheus::Queries::MatchedMetricQuery } - let(:prometheus_client) { double(:prometheus_client, label_values: nil) } - - context 'with valid data' do - subject { integration.query(:matched_metrics) } - - before do - allow(integration).to receive(:prometheus_client).and_return(prometheus_client) - synchronous_reactive_cache(integration) - end - - it 'returns reactive data' do - expect(subject[:success]).to be_truthy - expect(subject[:data]).to eq([]) - end - end - end - describe 'deployment' do let(:deployment) { build_stubbed(:deployment) } let(:deployment_query) { Gitlab::Prometheus::Queries::DeploymentQuery } diff --git a/spec/policies/project_member_policy_spec.rb b/spec/policies/project_member_policy_spec.rb index d7c155b39f5..8e7f2658e3f 100644 --- a/spec/policies/project_member_policy_spec.rb +++ b/spec/policies/project_member_policy_spec.rb @@ -2,9 +2,9 @@ require 'spec_helper' -RSpec.describe ProjectMemberPolicy do - let(:project) { create(:project) } - let(:maintainer) { create(:user) } +RSpec.describe ProjectMemberPolicy, feature_category: :groups_and_projects do + let_it_be(:project) { create(:project) } + let_it_be(:maintainer) { create(:user) } let(:member) { create(:project_member, project: project, user: member_user) } let(:current_user) { maintainer } diff --git a/tooling/danger/datateam.rb b/tooling/danger/datateam.rb index 86e413e55b6..1354e684d50 100644 --- a/tooling/danger/datateam.rb +++ b/tooling/danger/datateam.rb @@ -17,7 +17,7 @@ module Tooling PERFORMANCE_INDICATOR_REGEX = %r{gmau|smau|paid_gmau|umau} METRIC_REMOVED = %r{\+status: removed} DATABASE_REGEX = %r{\Adb/structure\.sql} - STRUCTURE_SQL_FILE = %w(db/structure.sql).freeze + STRUCTURE_SQL_FILE = %w[db/structure.sql].freeze def build_message return unless impacted? |