diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-08 18:13:15 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-08 18:13:15 +0000 |
commit | 3a563d7c1e15023f205d2a357e5d8a38a3b53ecc (patch) | |
tree | b7979f23104af9ed6d0ef077ce9964ba5d7ad65e | |
parent | dcc56fe601580b5d8f6c3da32550c6523f2baff3 (diff) | |
download | gitlab-ce-3a563d7c1e15023f205d2a357e5d8a38a3b53ecc.tar.gz |
Add latest changes from gitlab-org/gitlab@master
55 files changed, 385 insertions, 191 deletions
diff --git a/.rubocop_todo/layout/line_length.yml b/.rubocop_todo/layout/line_length.yml index c98021ba329..510c0c3d990 100644 --- a/.rubocop_todo/layout/line_length.yml +++ b/.rubocop_todo/layout/line_length.yml @@ -2203,7 +2203,6 @@ Layout/LineLength: - 'ee/spec/services/ci/compare_security_reports_service_spec.rb' - 'ee/spec/services/ci/create_pipeline_service/compliance_spec.rb' - 'ee/spec/services/ci/create_pipeline_service/dast_configuration_spec.rb' - - 'ee/spec/services/ci/minutes/batch_reset_service_spec.rb' - 'ee/spec/services/ci/minutes/refresh_cached_data_service_spec.rb' - 'ee/spec/services/ci/minutes/update_project_and_namespace_usage_service_spec.rb' - 'ee/spec/services/ci/process_build_service_spec.rb' diff --git a/.rubocop_todo/rspec/expect_in_hook.yml b/.rubocop_todo/rspec/expect_in_hook.yml index d156aa45035..de3a77b9139 100644 --- a/.rubocop_todo/rspec/expect_in_hook.yml +++ b/.rubocop_todo/rspec/expect_in_hook.yml @@ -62,7 +62,6 @@ RSpec/ExpectInHook: - 'ee/spec/requests/omniauth_kerberos_spec.rb' - 'ee/spec/services/app_sec/dast/profiles/update_service_spec.rb' - 'ee/spec/services/auto_merge/add_to_merge_train_when_pipeline_succeeds_service_spec.rb' - - 'ee/spec/services/ci/minutes/batch_reset_service_spec.rb' - 'ee/spec/services/ci/runners/register_runner_service_spec.rb' - 'ee/spec/services/ci/runners/reset_registration_token_service_spec.rb' - 'ee/spec/services/ci/runners/unassign_runner_service_spec.rb' @@ -375,7 +375,7 @@ group :development do gem 'solargraph', '~> 0.47.2', require: false gem 'letter_opener_web', '~> 2.0.0' - gem 'lookbook', '~> 1.5', '>= 1.5.5' + gem 'lookbook', '~> 2.0', '>= 2.0.1' # Better errors handler gem 'better_errors', '~> 2.10.0' diff --git a/Gemfile.checksum b/Gemfile.checksum index 8b9a45e5a19..314cece6915 100644 --- a/Gemfile.checksum +++ b/Gemfile.checksum @@ -339,7 +339,7 @@ {"name":"lockbox","version":"1.1.1","platform":"ruby","checksum":"0af16b14c54f791c148615a0115387b51903d868c7fe622f49606c97071c2ac0"}, {"name":"lograge","version":"0.11.2","platform":"ruby","checksum":"4cbd1554b86f545d795eff15a0c24fd25057d2ac4e1caa5fc186168b3da932ef"}, {"name":"loofah","version":"2.20.0","platform":"ruby","checksum":"e8fa874c8e2cd2fbdbecc1b6badc3f713639796aaca3f6dd494c4737828a24d6"}, -{"name":"lookbook","version":"1.5.5","platform":"ruby","checksum":"012afebd7f01c7035d8f53306453cdbe87cc6df7ee30394111c9effce2fdf2ac"}, +{"name":"lookbook","version":"2.0.1","platform":"ruby","checksum":"0f14729c8c992810de0792a0be865a5792e5765fbaea5950cce74c6e5c73fc4a"}, {"name":"lru_redux","version":"1.1.0","platform":"ruby","checksum":"ee71d0ccab164c51de146c27b480a68b3631d5b4297b8ffe8eda1c72de87affb"}, {"name":"lumberjack","version":"1.2.7","platform":"ruby","checksum":"a5c6aae6b4234f1420dbcd80b23e3bca0817bd239440dde097ebe3fa63c63b1f"}, {"name":"mail","version":"2.8.1","platform":"ruby","checksum":"ec3b9fadcf2b3755c78785cb17bc9a0ca9ee9857108a64b6f5cfc9c0b5bfc9ad"}, diff --git a/Gemfile.lock b/Gemfile.lock index f074a37cc8e..ed7f586b3a0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -923,17 +923,16 @@ GEM loofah (2.20.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) - lookbook (1.5.5) - actioncable + lookbook (2.0.1) activemodel css_parser htmlbeautifier (~> 1.3) htmlentities (~> 4.3.4) - listen (~> 3.0) + marcel (~> 1.0) railties (>= 5.0) redcarpet (~> 3.5) rouge (>= 3.26, < 5.0) - view_component (> 2.0, < 4) + view_component (>= 2.0) yard (~> 0.9.25) zeitwerk (~> 2.5) lru_redux (1.1.0) @@ -1822,7 +1821,7 @@ DEPENDENCIES lockbox (~> 1.1.1) lograge (~> 0.5) loofah (~> 2.20.0) - lookbook (~> 1.5, >= 1.5.5) + lookbook (~> 2.0, >= 2.0.1) lru_redux mail (= 2.8.1) mail-smtp_pool (~> 0.1.0)! diff --git a/app/assets/javascripts/vue_shared/components/markdown/eventhub.js b/app/assets/javascripts/vue_shared/components/markdown/eventhub.js new file mode 100644 index 00000000000..e31806ad199 --- /dev/null +++ b/app/assets/javascripts/vue_shared/components/markdown/eventhub.js @@ -0,0 +1,3 @@ +import createEventHub from '~/helpers/event_hub_factory'; + +export default createEventHub(); diff --git a/app/assets/javascripts/vue_shared/components/markdown/markdown_editor.vue b/app/assets/javascripts/vue_shared/components/markdown/markdown_editor.vue index e54d3130ea0..06d1779b180 100644 --- a/app/assets/javascripts/vue_shared/components/markdown/markdown_editor.vue +++ b/app/assets/javascripts/vue_shared/components/markdown/markdown_editor.vue @@ -4,8 +4,13 @@ import axios from '~/lib/utils/axios_utils'; import LocalStorageSync from '~/vue_shared/components/local_storage_sync.vue'; import { updateDraft, clearDraft, getDraft } from '~/lib/utils/autosave'; import { setUrlParams, joinPaths } from '~/lib/utils/url_utility'; -import { EDITING_MODE_MARKDOWN_FIELD, EDITING_MODE_CONTENT_EDITOR } from '../../constants'; +import { + EDITING_MODE_MARKDOWN_FIELD, + EDITING_MODE_CONTENT_EDITOR, + CLEAR_AUTOSAVE_ENTRY_EVENT, +} from '../../constants'; import MarkdownField from './field.vue'; +import eventHub from './eventhub'; export default { components: { @@ -125,6 +130,11 @@ export default { getValue: () => this.getValue(), setValue: (val) => this.setValue(val), }); + + eventHub.$on(CLEAR_AUTOSAVE_ENTRY_EVENT, this.clearDraft); + }, + beforeDestroy() { + eventHub.$off(CLEAR_AUTOSAVE_ENTRY_EVENT, this.clearDraft); }, methods: { getValue() { @@ -188,6 +198,10 @@ export default { if (this.markdown) updateDraft(this.autosaveKey, this.markdown); else clearDraft(this.autosaveKey); }, + clearDraft(key) { + if (!this.autosaveKey || key !== this.autosaveKey) return; + clearDraft(this.autosaveKey); + }, togglePreview(value) { if (this.editingMode === EDITING_MODE_MARKDOWN_FIELD) { this.$refs.markdownField.previewMarkdown = value; diff --git a/app/assets/javascripts/vue_shared/components/markdown/mount_markdown_editor.js b/app/assets/javascripts/vue_shared/components/markdown/mount_markdown_editor.js index 0f2a46f78f7..b0e609e2433 100644 --- a/app/assets/javascripts/vue_shared/components/markdown/mount_markdown_editor.js +++ b/app/assets/javascripts/vue_shared/components/markdown/mount_markdown_editor.js @@ -1,6 +1,8 @@ import Vue from 'vue'; import { queryToObject, objectToQuery } from '~/lib/utils/url_utility'; +import { CLEAR_AUTOSAVE_ENTRY_EVENT } from '../../constants'; import MarkdownEditor from './markdown_editor.vue'; +import eventHub from './eventhub'; const MR_SOURCE_BRANCH = 'merge_request[source_branch]'; const MR_TARGET_BRANCH = 'merge_request[target_branch]'; @@ -35,6 +37,19 @@ function getSearchTerm(newIssuePath) { return newIssuePath === pathname ? '' : format(search); } +function mountAutosaveClearOnSubmit(autosaveKey) { + const resetAutosaveButtons = document.querySelectorAll('.js-reset-autosave'); + if (resetAutosaveButtons.length === 0) { + return; + } + + for (const resetAutosaveButton of resetAutosaveButtons) { + resetAutosaveButton.addEventListener('click', () => { + eventHub.$emit(CLEAR_AUTOSAVE_ENTRY_EVENT, autosaveKey); + }); + } +} + export function mountMarkdownEditor() { const el = document.querySelector('.js-markdown-editor'); @@ -65,6 +80,7 @@ export function mountMarkdownEditor() { }; const setFacade = (props) => Object.assign(facade, props); + const autosaveKey = `autosave/${document.location.pathname}/${searchTerm}/description`; // eslint-disable-next-line no-new new Vue({ @@ -85,7 +101,7 @@ export function mountMarkdownEditor() { class: formFieldClasses, 'data-qa-selector': qaSelector, }, - autosaveKey: `autosave/${document.location.pathname}/${searchTerm}/description`, + autosaveKey, enableAutocomplete: true, autocompleteDataSources: gl.GfmAutoComplete?.dataSources, supportsQuickActions: true, @@ -95,5 +111,7 @@ export function mountMarkdownEditor() { }, }); + mountAutosaveClearOnSubmit(autosaveKey); + return facade; } diff --git a/app/assets/javascripts/vue_shared/constants.js b/app/assets/javascripts/vue_shared/constants.js index 29a31503840..3896e963a53 100644 --- a/app/assets/javascripts/vue_shared/constants.js +++ b/app/assets/javascripts/vue_shared/constants.js @@ -96,3 +96,4 @@ export const confidentialityInfoText = (workspaceType, issuableType) => export const EDITING_MODE_MARKDOWN_FIELD = 'markdownField'; export const EDITING_MODE_CONTENT_EDITOR = 'contentEditor'; +export const CLEAR_AUTOSAVE_ENTRY_EVENT = 'markdown_clear_autosave_entry'; diff --git a/app/components/diffs/base_component.rb b/app/components/diffs/base_component.rb index 9e1347d1e84..f5bc59cb314 100644 --- a/app/components/diffs/base_component.rb +++ b/app/components/diffs/base_component.rb @@ -2,6 +2,8 @@ module Diffs class BaseComponent < ViewComponent::Base + warn_on_deprecated_slot_setter + # To make converting the partials to components easier, # we delegate all missing methods to the helpers, # where they probably are. diff --git a/app/components/diffs/overflow_warning_component.html.haml b/app/components/diffs/overflow_warning_component.html.haml index bfc2f3f23a7..19048c5058e 100644 --- a/app/components/diffs/overflow_warning_component.html.haml +++ b/app/components/diffs/overflow_warning_component.html.haml @@ -1,9 +1,9 @@ = render Pajamas::AlertComponent.new(title: _('Some changes are not shown.'), variant: :warning, alert_options: { class: 'gl-mb-5', data: { testid: "too-many-changes-alert" } }) do |c| - = c.body do + = c.with_body do = message - = c.actions do + = c.with_actions do = diff_link = patch_link diff --git a/app/components/layouts/horizontal_section_component.rb b/app/components/layouts/horizontal_section_component.rb index 48c960f17d9..caeaa1782c0 100644 --- a/app/components/layouts/horizontal_section_component.rb +++ b/app/components/layouts/horizontal_section_component.rb @@ -2,6 +2,8 @@ module Layouts class HorizontalSectionComponent < ViewComponent::Base + warn_on_deprecated_slot_setter + # @param [Boolean] border # @param [Hash] options def initialize(border: true, options: {}) diff --git a/app/components/pajamas/component.rb b/app/components/pajamas/component.rb index 3b1826a646c..a7b45ffd7fd 100644 --- a/app/components/pajamas/component.rb +++ b/app/components/pajamas/component.rb @@ -2,6 +2,8 @@ module Pajamas class Component < ViewComponent::Base + warn_on_deprecated_slot_setter + private # Filter a given a value against a list of allowed values diff --git a/app/helpers/blame_helper.rb b/app/helpers/blame_helper.rb index f25917407a7..56d651a8b65 100644 --- a/app/helpers/blame_helper.rb +++ b/app/helpers/blame_helper.rb @@ -44,11 +44,7 @@ module BlameHelper namespace_project_blame_page_url(namespace_id: project.namespace, project_id: project, id: id, streaming: true) end - def entire_blame_path(id, project, blame_mode) - if blame_mode.streaming_supported? - namespace_project_blame_streaming_path(namespace_id: project.namespace, project_id: project, id: id) - else - namespace_project_blame_path(namespace_id: project.namespace, project_id: project, id: id, no_pagination: true) - end + def entire_blame_path(id, project) + namespace_project_blame_streaming_path(namespace_id: project.namespace, project_id: project, id: id) end end diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index dd5debdf4a0..da427a7e068 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -36,7 +36,7 @@ class CommitStatus < Ci::ApplicationRecord validates :pipeline, presence: true, unless: :importing? validates :name, presence: true, unless: :importing? - validates :stage, :ref, :target_url, :description, length: { maximum: 255 }, if: :ci_builds_columns_size_validation_enabled? + validates :stage, :ref, :target_url, :description, length: { maximum: 255 } alias_attribute :author, :user alias_attribute :pipeline_id, :commit_id @@ -321,8 +321,4 @@ class CommitStatus < Ci::ApplicationRecord def unrecoverable_failure? script_failure? || missing_dependency_failure? || archived_failure? || scheduler_failure? || data_integrity_failure? end - - def ci_builds_columns_size_validation_enabled? - Feature.enabled?(:ci_builds_columns_size_validation, project) - end end diff --git a/app/views/projects/blame/show.html.haml b/app/views/projects/blame/show.html.haml index a56d398d3a0..e2cad2fb3d7 100644 --- a/app/views/projects/blame/show.html.haml +++ b/app/views/projects/blame/show.html.haml @@ -42,7 +42,7 @@ - if @blame_mode.pagination? && @blame_pagination.total_pages > 1 .gl-display-flex.gl-justify-content-center.gl-flex-direction-column.gl-align-items-center.gl-p-3.gl-bg-gray-50.gl-border-t-solid.gl-border-t-1.gl-border-gray-100 - = render Pajamas::ButtonComponent.new(href: entire_blame_path(@id, @project, @blame_mode), size: :small, button_options: { class: 'gl-mt-3' }) do |c| + = render Pajamas::ButtonComponent.new(href: entire_blame_path(@id, @project), size: :small, button_options: { class: 'gl-mt-3' }) do |c| = _('Show full blame') - if @blame_mode.streaming? diff --git a/app/views/shared/issuable/_form.html.haml b/app/views/shared/issuable/_form.html.haml index 5ba92676f89..58d0a39578a 100644 --- a/app/views/shared/issuable/_form.html.haml +++ b/app/views/shared/issuable/_form.html.haml @@ -62,9 +62,9 @@ = sanitize(html_escape(_('Please review the %{linkStart}contribution guidelines%{linkEnd} for this project.')) % { linkStart: contribution_guidelines_start, linkEnd: contribution_guidelines_end }) - if issuable.new_record? - = form.submit "#{_('Create')} #{issuable.class.model_name.human.downcase}", pajamas_button: true, class: 'gl-mr-2 js-issuable-submit-button', data: { qa_selector: 'issuable_create_button', track_action: 'click_button', track_label: 'submit_mr', track_value: 0 } + = form.submit "#{_('Create')} #{issuable.class.model_name.human.downcase}", pajamas_button: true, class: 'gl-mr-2 js-issuable-submit-button js-reset-autosave', data: { qa_selector: 'issuable_create_button', track_action: 'click_button', track_label: 'submit_mr', track_value: 0 } - else - = form.submit _('Save changes'), pajamas_button: true, class: 'gl-mr-2 js-issuable-submit-button', data: { track_action: 'click_button', track_label: 'submit_mr', track_value: 0 } + = form.submit _('Save changes'), pajamas_button: true, class: 'gl-mr-2 js-issuable-submit-button js-reset-autosave', data: { track_action: 'click_button', track_label: 'submit_mr', track_value: 0 } - if issuable.new_record? = link_to _('Cancel'), polymorphic_path([@project, issuable.class]), class: 'btn gl-button btn-default js-reset-autosave' diff --git a/config/environments/development.rb b/config/environments/development.rb index 3823b76d0f2..06e58966199 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -37,11 +37,11 @@ Rails.application.configure do # Annotate rendered view with template file names as HTML comments config.action_view.annotate_rendered_view_with_filenames = true - # ViewComponent previews + # ViewComponent & Lookbook previews config.view_component.default_preview_layout = "component_preview" config.view_component.preview_route = "/-/view_component/previews" - config.view_component.preview_paths << "#{config.root}/spec/components/previews" - # Push preview path now to prevent FrozenError during view_component's initialzer + config.lookbook.preview_paths = ["#{config.root}/spec/components/previews"] + # Push preview path now to prevent FrozenError during initialzer config.autoload_paths.push("#{config.root}/spec/components/previews") config.lookbook.page_paths = ["#{config.root}/spec/components/docs"] diff --git a/config/feature_flags/development/blame_page_streaming.yml b/config/feature_flags/development/blame_page_streaming.yml deleted file mode 100644 index 44d64800dab..00000000000 --- a/config/feature_flags/development/blame_page_streaming.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: blame_page_streaming -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/110208 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/392890 -milestone: '15.10' -type: development -group: group::source code -default_enabled: false diff --git a/config/feature_flags/development/ci_builds_columns_size_validation.yml b/config/feature_flags/development/ci_builds_columns_size_validation.yml deleted file mode 100644 index f7dff9d2275..00000000000 --- a/config/feature_flags/development/ci_builds_columns_size_validation.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: ci_builds_columns_size_validation -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/118148 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/407404 -milestone: '16.0' -type: development -group: group::pipeline execution -default_enabled: false diff --git a/data/deprecations/16-0-graphql-RunnerMembershipFilter-renamed.yml b/data/deprecations/16-0-graphql-RunnerMembershipFilter-renamed.yml new file mode 100644 index 00000000000..67148c698e4 --- /dev/null +++ b/data/deprecations/16-0-graphql-RunnerMembershipFilter-renamed.yml @@ -0,0 +1,24 @@ +- title: "GraphQL type, `RunnerMembershipFilter` renamed to `CiRunnerMembershipFilter`" # (required) Clearly explain the change, or planned change. For example, "The `confidential` field for a `Note` is deprecated" or "CI/CD job names will be limited to 250 characters." + removal_milestone: "17.0" # (required) The milestone when this feature is planned to be removed + announcement_milestone: "16.0" # (required) The milestone when this feature was first announced as deprecated. + breaking_change: true # (required) Change to false if this is not a breaking change. + reporter: pedropombeiro # (required) GitLab username of the person reporting the change + stage: Verify # (required) String value of the stage that the feature was created in. e.g., Growth + issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/409333 # (required) Link to the deprecation issue in GitLab + body: | # (required) Do not modify this line, instead modify the lines below. + The GraphQL type, `RunnerMembershipFilter`, has been renamed to `CiRunnerMembershipFilter`. In GitLab 17.0, + the aliasing for the `RunnerMembershipFilter` type will be removed. +# +# OPTIONAL END OF SUPPORT FIELDS +# +# If an End of Support period applies, the announcement should be shared with GitLab Support +# in the `#spt_managers` channel in Slack, and mention `@gitlab-com/support` in this MR. +# + end_of_support_milestone: # (optional) Use "XX.YY" format. The milestone when support for this feature will end. + # + # OTHER OPTIONAL FIELDS + # + tiers: # (optional - may be required in the future) An array of tiers that the feature is available in currently. e.g., [Free, Silver, Gold, Core, Premium, Ultimate] + documentation_url: https://docs.gitlab.com/ee/api/graphql/reference/index.html#cirunnermembershipfilter # (optional) This is a link to the current documentation page + image_url: # (optional) This is a link to a thumbnail image depicting the feature + video_url: # (optional) Use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg diff --git a/db/migrate/20230424155321_add_licenses_field_to_package_metadata_packages.rb b/db/migrate/20230424155321_add_licenses_field_to_package_metadata_packages.rb new file mode 100644 index 00000000000..99a8f5633dd --- /dev/null +++ b/db/migrate/20230424155321_add_licenses_field_to_package_metadata_packages.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddLicensesFieldToPackageMetadataPackages < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + def change + add_column :pm_packages, :licenses, :jsonb, null: true + end +end diff --git a/db/schema_migrations/20230424155321 b/db/schema_migrations/20230424155321 new file mode 100644 index 00000000000..0d8b21d4a4b --- /dev/null +++ b/db/schema_migrations/20230424155321 @@ -0,0 +1 @@ +0a043de128c0a756f9f6028fb255b775ca854fb15222d04de7d7a99299b6b099
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index e93f83f425c..acf40d37086 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -20295,6 +20295,7 @@ CREATE TABLE pm_packages ( name text NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, + licenses jsonb, CONSTRAINT check_3a3aedb8ba CHECK ((char_length(name) <= 255)) ); diff --git a/doc/ci/yaml/index.md b/doc/ci/yaml/index.md index c85c663ae0f..8eb7e5a13df 100644 --- a/doc/ci/yaml/index.md +++ b/doc/ci/yaml/index.md @@ -3178,6 +3178,14 @@ job: description: './path/to/CHANGELOG.md' ``` +**Additional details**: + +- The `description` is evaluated by the shell that runs `release-cli`. + You can use CI/CD variables to define the description, but some shells + [use different syntax](../variables/index.md#use-cicd-variables-in-job-scripts) + to reference variables. Similarly, some shells might require special characters + to be escaped. For example, backticks (`` ` ``) might need to be escaped with a backslash (<code>\</code>). + #### `release:ref` The `ref` for the release, if the `release: tag_name` doesn't exist yet. diff --git a/doc/development/database/database_lab.md b/doc/development/database/database_lab.md index 25eac5246bf..357133d8bca 100644 --- a/doc/development/database/database_lab.md +++ b/doc/development/database/database_lab.md @@ -130,6 +130,79 @@ For information on testing migrations, review our ### Access the console with `psql` +NOTE: +You must have `AllFeaturesUser` [`psql` access](#access-database-lab-engine) to access the console with `psql`. + +#### Simplified access through `pgai` Ruby gem + +[@mbobin](https://gitlab.com/mbobin) created the [`pgai` Ruby Gem](https://gitlab.com/mbobin/pgai/#pgai) that +greatly simplifies access to a database clone, with support for: + +- Access to all database clones listed in the [Postgres.ai instances page](https://console.postgres.ai/gitlab/instances); +- Multiple `psql` sessions on the same clone. + +If you have `AllFeaturesUser` [`psql` access](#access-database-lab-engine), you can follow the steps below to configure +the `pgai` Gem: + +1. To get started, you need to gather some values from the [Postgres.ai instances page](https://console.postgres.ai/gitlab/instances): + + 1. Navigate to the instance that you want to configure and the on right side of the screen. + 1. Under **Connection**, select **Connect**. The menu might be collapsed. + + A pop-up with everything that's needed for configuration appears, using this format: + + ```shell + dblab init --url http://127.0.0.1:1234 --token TOKEN --environment-id <environment-id> + ``` + + ```shell + ssh -NTML 1234:localhost:<environment-port> <postgresai-user>@<postgresai-proxy> -i ~/.ssh/id_rsa + ``` + +1. Add the following snippet to your SSH configuration file at `~/.ssh/config`, replacing the variable values: + + ```plaintext + Host pgai-proxy + HostName <postgresai-proxy> + User <postgresai-user> + IdentityFile ~/.ssh/id_ed25519 + ``` + +1. Run the following command so you can accept the server key fingerprint: + + ```shell + ssh pgai-proxy + ``` + +1. Run the following commands: + + ```shell + gem install pgai + + # Grab an access token: https://console.postgres.ai/gitlab/tokens + # GITLAB_USER is your GitLab handle + pgai config --dbname=gitlabhq_dblab --prefix=$GITLAB_USER --proxy=pgai-proxy + + # Grab the respective port values from https://console.postgres.ai/gitlab/instances + # for the instances you'll be using (in this case, for the `main` database instance) + pgai env add --alias main --id <environment-id> --port <environment-port> + ``` + +1. Once this one-time configuration is done, you can use `pgai connect` to connect to a particular database. For + instance, to connect to the `main` database: + + ```shell + pgai connect main + ``` + +1. Once done with the clone, you can destroy it: + + ```shell + pgai destroy main + ``` + +#### Manual access through the Postgres.ai instances page + Team members with [`psql` access](#access-database-lab-engine), can gain direct access to a clone via `psql`. Access to `psql` enables you to see data, not just metadata. diff --git a/doc/update/deprecations.md b/doc/update/deprecations.md index d20a6d5c033..d27f688a027 100644 --- a/doc/update/deprecations.md +++ b/doc/update/deprecations.md @@ -259,6 +259,20 @@ This change is a breaking change. You should use an [authentication token](../ci <div class="deprecation breaking-change" data-milestone="17.0"> +### GraphQL type, `RunnerMembershipFilter` renamed to `CiRunnerMembershipFilter` + +<div class="deprecation-notes"> +- Announced in: GitLab <span class="milestone">16.0</span> +- [Breaking change](https://docs.gitlab.com/ee/development/deprecation_guidelines/) +</div> + +The GraphQL type, `RunnerMembershipFilter`, has been renamed to `CiRunnerMembershipFilter`. In GitLab 17.0, +the aliasing for the `RunnerMembershipFilter` type will be removed. + +</div> + +<div class="deprecation breaking-change" data-milestone="17.0"> + ### GraphQL: The `DISABLED_WITH_OVERRIDE` value of the `SharedRunnersSetting` enum is deprecated. Use `DISABLED_AND_OVERRIDABLE` instead <div class="deprecation-notes"> diff --git a/doc/user/ai_features.md b/doc/user/ai_features.md index 82e8b4cec36..e8635fd88e9 100644 --- a/doc/user/ai_features.md +++ b/doc/user/ai_features.md @@ -48,7 +48,7 @@ Third-party AI features require the [group-level third-party AI features setting > Introduced in GitLab 15.11 as an [Experiment](../policy/alpha-beta-support.md#experiment) on GitLab.com. -This feature is an [Experiment](../policy/alpha-beta-support.md) on GitLab.com that is powered by OpenAI's GPT-3. +This feature is an [Experiment](../policy/alpha-beta-support.md) on GitLab.com that is powered by OpenAI GPT-3. GitLab can help you get up to speed faster if you: @@ -81,7 +81,7 @@ We cannot guarantee that the large language model produces results that are corr > Introduced in GitLab 16.0 as an [Experiment](../policy/alpha-beta-support.md#experiment). -This feature is an [Experiment](../policy/alpha-beta-support.md) on GitLab.com that is powered by OpenAI's GPT-3. It requires the [group-level third-party AI features setting](group/manage.md#group-third-party-ai-features-setting) to be enabled. +This feature is an [Experiment](../policy/alpha-beta-support.md) on GitLab.com that is powered by OpenAI GPT-3. It requires the [group-level third-party AI features setting](group/manage.md#group-third-party-ai-features-setting) to be enabled. Getting help has never been easier. If you have a question about how the GitLab product works, you can ask product how-to questions and get AI generated support from GitLab Chat. @@ -95,23 +95,20 @@ To give feedback, select the **Give Feedback** link. > [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/10400) in GitLab 16.0 as an [Experiment](../policy/alpha-beta-support.md#experiment). -This feature is an [Experiment](../policy/alpha-beta-support.md) on GitLab.com that is powered by OpenAI's GPT-3. It requires the [group-level third-party AI features setting](group/manage.md#group-third-party-ai-features-setting) to be enabled. +This feature is an [Experiment](../policy/alpha-beta-support.md) on GitLab.com that is powered by OpenAI GPT-3. It requires the [group-level third-party AI features setting](group/manage.md#group-third-party-ai-features-setting) to be enabled. -Merge request summaries can be generated by using the `/summarize_diff` quick action in a merge request comment. This posts a comment from a GitLab bot that provides a summary of the changes and the related SHA for when that summary was generated. +You can generate a merge request summary by using the `/summarize_diff` quick action in a merge request comment. This action posts a comment from a GitLab bot. The comment provides a summary of the changes and the related SHA for when that summary was generated. -Feedback on this experimental feature can be provided in [issue 408726](https://gitlab.com/gitlab-org/gitlab/-/issues/408726). +Provide feedback on this experimental feature in [issue 408726](https://gitlab.com/gitlab-org/gitlab/-/issues/408726). -#### Data usage - -This data is sent to the large language model referenced above when you use the `/summarize_diff` quick action: - -1. The diff of changes between the head of the source branch and the target branch +**Data usage**: When you use this quick action, the diff of changes between the head of the source branch +and the target branch is sent to the GPT-3 language model. ### Summarize my merge request review **(ULTIMATE SAAS)** > [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/10466) in GitLab 16.0 as an [Experiment](../policy/alpha-beta-support.md#experiment). -This feature is an [Experiment](../policy/alpha-beta-support.md) on GitLab.com that is powered by OpenAI's GPT-3. It requires the [group-level third-party AI features setting](group/manage.md#group-third-party-ai-features-setting) to be enabled. +This feature is an [Experiment](../policy/alpha-beta-support.md) on GitLab.com that is powered by OpenAI GPT-3. It requires the [group-level third-party AI features setting](group/manage.md#group-third-party-ai-features-setting) to be enabled. When you've completed your review of a merge request and are ready to [submit your review](project/merge_requests/reviews/index.md#submit-a-review) you can choose to have summary generated for you. To generate the summary: @@ -120,20 +117,18 @@ When you've completed your review of a merge request and are ready to [submit yo The summary is generated and entered in to the comment box where you can edit and refine prior to submitting with your review. -Feedback on this experimental feature can be provided in [issue 408991](https://gitlab.com/gitlab-org/gitlab/-/issues/408991). +Provide feedback on this experimental feature in [issue 408991](https://gitlab.com/gitlab-org/gitlab/-/issues/408991). -#### Data usage +**Data usage**: When you use this feature, the following data is sent to the GPT-3 language model: -This data is sent to the large language model referenced above when you click on **Summarize my code review**: - -1. Draft comment's text -1. File path of the commented file(s) +- Draft comment's text +- File path of the commented files ### Generate suggested tests in merge requests **(ULTIMATE SAAS)** > [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/10366) in GitLab 16.0 as an [Experiment](../policy/alpha-beta-support.md#experiment). -This feature is an [Experiment](../policy/alpha-beta-support.md) on GitLab.com that is powered by OpenAI's GPT-3. It requires the [group-level third-party AI features setting](group/manage.md#group-third-party-ai-features-setting) to be enabled. +This feature is an [Experiment](../policy/alpha-beta-support.md) on GitLab.com that is powered by OpenAI GPT-3. It requires the [group-level third-party AI features setting](group/manage.md#group-third-party-ai-features-setting) to be enabled. When in a merge request you can choose to have GitLab suggest tests for the file you are reviewing. This can help to determine if appropriate test coverage has been provided or help with writing tests to provide more coverage for your project. To generate a test suggestion: @@ -144,12 +139,10 @@ A sidebar opens where the test suggestion is generated. From there you can choos Feedback on this experimental feature can be provided in [issue 408995](https://gitlab.com/gitlab-org/gitlab/-/issues/408995). -#### Data usage - -This data is sent to the large language model referenced above when you click on **Generate test with AI**: +**Data usage**: When you use this feature, the following data is sent to the GPT-3 language model: -1. Contents of the file -1. The file name +- Contents of the file +- The file name ## Data Usage diff --git a/doc/user/packages/debian_repository/index.md b/doc/user/packages/debian_repository/index.md index 5ce65bfd8aa..220e2085637 100644 --- a/doc/user/packages/debian_repository/index.md +++ b/doc/user/packages/debian_repository/index.md @@ -11,8 +11,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w > - [Deployed behind a feature flag](../../feature_flags.md), disabled by default. WARNING: -The Debian package registry for GitLab is under development and isn't ready for production use due to -limited functionality. This [epic](https://gitlab.com/groups/gitlab-org/-/epics/6057) details the remaining +The Debian package registry for GitLab is under development and isn't ready for production use. This [epic](https://gitlab.com/groups/gitlab-org/-/epics/6057) details the remaining work and timelines to make it production ready. Publish Debian packages in your project's Package Registry. Then install the @@ -36,6 +35,9 @@ Debian repository support is still a work in progress. It's gated behind a featu [GitLab administrators with access to the GitLab Rails console](../../../administration/feature_flags.md) can opt to enable it. +WARNING: +Understand the [stability and security risks of enabling features still in development](../../../administration/feature_flags.md#risks-when-enabling-features-still-in-development). + To enable it: ```ruby @@ -52,6 +54,9 @@ Feature.disable(:debian_packages) The Debian group repository is also behind a second feature flag that is disabled by default. +WARNING: +Understand the [stability and security risks of enabling features still in development](../../../administration/feature_flags.md#risks-when-enabling-features-still-in-development). + To enable it: ```ruby diff --git a/doc/user/project/merge_requests/approvals/index.md b/doc/user/project/merge_requests/approvals/index.md index 3a39ff4f5f7..6b50aaf1128 100644 --- a/doc/user/project/merge_requests/approvals/index.md +++ b/doc/user/project/merge_requests/approvals/index.md @@ -101,7 +101,7 @@ Without the approvals, the work cannot merge. Required approvals enable multiple database, for all proposed code changes. - Use the [code owners of changed files](rules.md#code-owners-as-eligible-approvers), to determine who should review the work. -- Require an [approval before merging code that causes test coverage to decline](../../../../ci/testing/code_coverage.md#coverage-check-approval-rule) +- Require an [approval before merging code that causes test coverage to decline](../../../../ci/testing/code_coverage.md#coverage-check-approval-rule). - Users on GitLab Ultimate can also [require approval from a security team](../../../application_security/index.md#security-approvals-in-merge-requests) before merging code that could introduce a vulnerability. @@ -109,13 +109,14 @@ Without the approvals, the work cannot merge. Required approvals enable multiple > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/334698) in GitLab 15.1. > - [Changed](https://gitlab.com/gitlab-org/gitlab/-/issues/389905) in GitLab 15.11 [with a flag](../../../../administration/feature_flags.md) named `invalid_scan_result_policy_prevents_merge`. Disabled by default. +> - [Enabled on GitLab.com and self-managed](https://gitlab.com/gitlab-org/gitlab/-/issues/405023) in GitLab 16.0. FLAG: -On self-managed GitLab, by default this feature is not available. To make it available per project or for your entire instance, -ask an administrator to [enable the feature flag](../../../../administration/feature_flags.md) named `invalid_scan_result_policy_prevents_merge`. -On GitLab.com, this feature is available but can be configured by GitLab.com administrators only. +On self-managed GitLab, by default this feature is available. To hide the feature, +ask an administrator to [disable the feature flag](../../../../administration/feature_flags.md) named `invalid_scan_result_policy_prevents_merge`. +On GitLab.com, this feature is enabled by default. -Whenever an approval rule cannot be satisfied, the rule is displayed as `(!) Auto approved`. This applies to the following conditions: +Whenever an approval rule cannot be satisfied, the rule is displayed as **(!) Auto approved**. This applies to the following conditions: - The only eligible approver is the author of the merge request. - No eligible approvers (either groups or users) have been assigned to the approval rule. @@ -124,7 +125,7 @@ Whenever an approval rule cannot be satisfied, the rule is displayed as `(!) Aut These rules are automatically approved to unblock their respective merge requests, unless they were created through a security policy. -Invalid approval rules created through a security policy are presented with `(!) Action Required` +Invalid approval rules created through a security policy are presented with **(!) Action Required** and are not automatically approved, blocking their respective merge requests. ## Related topics diff --git a/lib/gitlab/database/pg_depend.rb b/lib/gitlab/database/pg_depend.rb new file mode 100644 index 00000000000..5f3cdaeb979 --- /dev/null +++ b/lib/gitlab/database/pg_depend.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Gitlab + module Database + class PgDepend < SharedModel + self.table_name = 'pg_depend' + + TYPES = { + 'VIEW' => %w[v m].freeze + }.freeze + + scope :from_pg_extension, ->(type = nil) do + joins('INNER JOIN pg_class ON pg_class.oid = pg_depend.objid') + .where(pg_class: { relkind: TYPES.fetch(type.to_s) }) + .where("refclassid = 'pg_extension'::pg_catalog.regclass") + end + end + end +end diff --git a/lib/gitlab/git/blame_mode.rb b/lib/gitlab/git/blame_mode.rb index d8fc8fece06..15200e3888c 100644 --- a/lib/gitlab/git/blame_mode.rb +++ b/lib/gitlab/git/blame_mode.rb @@ -8,13 +8,7 @@ module Gitlab @params = params end - def streaming_supported? - Feature.enabled?(:blame_page_streaming, project) - end - def streaming? - return false unless streaming_supported? - Gitlab::Utils.to_boolean(params[:streaming], default: false) end diff --git a/lib/tasks/gitlab/db.rake b/lib/tasks/gitlab/db.rake index 42a34a2d00b..372ebcfbee8 100644 --- a/lib/tasks/gitlab/db.rake +++ b/lib/tasks/gitlab/db.rake @@ -61,13 +61,18 @@ namespace :gitlab do # In PostgreSQLAdapter, data_sources returns both views and tables, so use tables instead tables = connection.tables + # Views that are dependencies to PG_EXTENSION (like pg_stat_statements) should be ignored + ignored_views = Gitlab::Database::PgDepend.using_connection(connection) do + Gitlab::Database::PgDepend.from_pg_extension('VIEW').pluck('relname') + end + # Removes the entry from the array tables.delete 'schema_migrations' # Truncate schema_migrations to ensure migrations re-run connection.execute('TRUNCATE schema_migrations') if connection.table_exists? 'schema_migrations' # Drop any views - connection.views.each do |view| + (connection.views - ignored_views).each do |view| connection.execute("DROP VIEW IF EXISTS #{connection.quote_table_name(view)} CASCADE") end diff --git a/package.json b/package.json index 03f7432dd29..a4548d62902 100644 --- a/package.json +++ b/package.json @@ -278,7 +278,7 @@ "timezone-mock": "^1.0.8", "vue-loader-vue3": "npm:vue-loader@17", "vue-test-utils-compat": "0.0.13", - "webpack-dev-server": "4.13.3", + "webpack-dev-server": "4.15.0", "xhr-mock": "^2.5.1", "yarn-check-webpack-plugin": "^1.2.0", "yarn-deduplicate": "^6.0.0" diff --git a/qa/Gemfile b/qa/Gemfile index 58bf10a1f75..f320c091f7f 100644 --- a/qa/Gemfile +++ b/qa/Gemfile @@ -9,7 +9,7 @@ gem 'capybara', '~> 3.39.0' gem 'capybara-screenshot', '~> 1.0.26' gem 'rake', '~> 13', '>= 13.0.6' gem 'rspec', '~> 3.12' -gem 'selenium-webdriver', '~> 4.9' +gem 'selenium-webdriver', '~> 4.9', '>= 4.9.1' gem 'airborne', '~> 0.3.7', require: false # airborne is messing with rspec sandboxed mode so not requiring by default gem 'rest-client', '~> 2.1.0' gem 'rspec-retry', '~> 0.6.2', require: 'rspec/retry' diff --git a/qa/Gemfile.lock b/qa/Gemfile.lock index e04cfe94c6d..7b63e25f381 100644 --- a/qa/Gemfile.lock +++ b/qa/Gemfile.lock @@ -260,7 +260,7 @@ GEM sawyer (0.9.2) addressable (>= 2.3.5) faraday (>= 0.17.3, < 3) - selenium-webdriver (4.9.0) + selenium-webdriver (4.9.1) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) @@ -335,7 +335,7 @@ DEPENDENCIES rspec-retry (~> 0.6.2) rspec_junit_formatter (~> 0.6.0) ruby-debug-ide (~> 0.7.3) - selenium-webdriver (~> 4.9) + selenium-webdriver (~> 4.9, >= 4.9.1) slack-notifier (~> 2.4) terminal-table (~> 3.0.2) warning (~> 1.3) diff --git a/qa/qa/page/sub_menus/common.rb b/qa/qa/page/sub_menus/common.rb index c45f0d3e089..28b4cb37333 100644 --- a/qa/qa/page/sub_menus/common.rb +++ b/qa/qa/page/sub_menus/common.rb @@ -45,7 +45,10 @@ module QA # @param [String] sub_menu # @return [void] def open_submenu(parent_menu_name, sub_menu) - click_element(:menu_section_button, section_name: parent_menu_name) + # prevent closing sub-menu if it was already open + unless has_element?(:menu_section, section_name: parent_menu_name, wait: 0) + click_element(:menu_section_button, section_name: parent_menu_name) + end within_element(:menu_section, section_name: parent_menu_name) do click_element(:nav_item_link, submenu_item: sub_menu) diff --git a/spec/components/layouts/horizontal_section_component_spec.rb b/spec/components/layouts/horizontal_section_component_spec.rb index efc48213911..b0a749e58d6 100644 --- a/spec/components/layouts/horizontal_section_component_spec.rb +++ b/spec/components/layouts/horizontal_section_component_spec.rb @@ -9,8 +9,8 @@ RSpec.describe Layouts::HorizontalSectionComponent, type: :component do describe 'slots' do it 'renders title' do render_inline described_class.new do |c| - c.title { title } - c.body { body } + c.with_title { title } + c.with_body { body } end expect(page).to have_css('h4', text: title) @@ -18,8 +18,8 @@ RSpec.describe Layouts::HorizontalSectionComponent, type: :component do it 'renders body slot' do render_inline described_class.new do |c| - c.title { title } - c.body { body } + c.with_title { title } + c.with_body { body } end expect(page).to have_content(body) @@ -28,9 +28,9 @@ RSpec.describe Layouts::HorizontalSectionComponent, type: :component do context 'when description slot is provided' do before do render_inline described_class.new do |c| - c.title { title } - c.description { description } - c.body { body } + c.with_title { title } + c.with_description { description } + c.with_body { body } end end @@ -42,8 +42,8 @@ RSpec.describe Layouts::HorizontalSectionComponent, type: :component do context 'when description slot is not provided' do before do render_inline described_class.new do |c| - c.title { title } - c.body { body } + c.with_title { title } + c.with_body { body } end end @@ -57,8 +57,8 @@ RSpec.describe Layouts::HorizontalSectionComponent, type: :component do describe 'border' do it 'defaults to true and adds gl-border-b CSS class' do render_inline described_class.new do |c| - c.title { title } - c.body { body } + c.with_title { title } + c.with_body { body } end expect(page).to have_css('.gl-border-b') @@ -66,8 +66,8 @@ RSpec.describe Layouts::HorizontalSectionComponent, type: :component do it 'does not add gl-border-b CSS class when set to false' do render_inline described_class.new(border: false) do |c| - c.title { title } - c.body { body } + c.with_title { title } + c.with_body { body } end expect(page).not_to have_css('.gl-border-b') @@ -77,8 +77,8 @@ RSpec.describe Layouts::HorizontalSectionComponent, type: :component do describe 'options' do it 'adds options to wrapping element' do render_inline described_class.new(options: { data: { testid: 'foo-bar' }, class: 'foo-bar' }) do |c| - c.title { title } - c.body { body } + c.with_title { title } + c.with_body { body } end expect(page).to have_css('.foo-bar[data-testid="foo-bar"]') diff --git a/spec/components/pajamas/alert_component_spec.rb b/spec/components/pajamas/alert_component_spec.rb index 4a90a9e0b88..8f02979357e 100644 --- a/spec/components/pajamas/alert_component_spec.rb +++ b/spec/components/pajamas/alert_component_spec.rb @@ -8,8 +8,8 @@ RSpec.describe Pajamas::AlertComponent, :aggregate_failures, type: :component do before do render_inline described_class.new do |c| - c.body { body } - c.actions { actions } + c.with_body { body } + c.with_actions { actions } end end diff --git a/spec/components/pajamas/avatar_component_spec.rb b/spec/components/pajamas/avatar_component_spec.rb index 3b4e4e49fc2..d59ef390fad 100644 --- a/spec/components/pajamas/avatar_component_spec.rb +++ b/spec/components/pajamas/avatar_component_spec.rb @@ -92,7 +92,7 @@ RSpec.describe Pajamas::AvatarComponent, type: :component do let(:record) { user } it "uses a gravatar" do - expect(rendered_component).to match /gravatar\.com/ + expect(rendered_content).to match /gravatar\.com/ end end end diff --git a/spec/components/pajamas/banner_component_spec.rb b/spec/components/pajamas/banner_component_spec.rb index 861b10c3f69..6b99b4c1d76 100644 --- a/spec/components/pajamas/banner_component_spec.rb +++ b/spec/components/pajamas/banner_component_spec.rb @@ -13,7 +13,7 @@ RSpec.describe Pajamas::BannerComponent, type: :component do describe 'basic usage' do before do render_inline(subject) do |c| - c.title { title } + c.with_title { title } content end end @@ -124,8 +124,8 @@ RSpec.describe Pajamas::BannerComponent, type: :component do context 'with illustration slot' do before do render_inline(subject) do |c| - c.title { title } - c.illustration { "<svg></svg>".html_safe } + c.with_title { title } + c.with_illustration { "<svg></svg>".html_safe } content end end @@ -147,8 +147,8 @@ RSpec.describe Pajamas::BannerComponent, type: :component do context 'with primary_action slot' do before do render_inline(subject) do |c| - c.title { title } - c.primary_action { "<a class='special' href='#'>Special</a>".html_safe } + c.with_title { title } + c.with_primary_action { "<a class='special' href='#'>Special</a>".html_safe } content end end diff --git a/spec/components/pajamas/card_component_spec.rb b/spec/components/pajamas/card_component_spec.rb index 38d23cfca9c..6328385754d 100644 --- a/spec/components/pajamas/card_component_spec.rb +++ b/spec/components/pajamas/card_component_spec.rb @@ -9,9 +9,9 @@ RSpec.describe Pajamas::CardComponent, :aggregate_failures, type: :component do context 'slots' do before do render_inline described_class.new do |c| - c.header { header } - c.body { body } - c.footer { footer } + c.with_header { header } + c.with_body { body } + c.with_footer { footer } end end @@ -51,9 +51,9 @@ RSpec.describe Pajamas::CardComponent, :aggregate_failures, type: :component do header_options: { class: '_header_class_', data: { testid: '_header_testid_' } }, body_options: { class: '_body_class_', data: { testid: '_body_testid_' } }, footer_options: { class: '_footer_class_', data: { testid: '_footer_testid_' } }) do |c| - c.header { header } - c.body { body } - c.footer { footer } + c.with_header { header } + c.with_body { body } + c.with_footer { footer } end end diff --git a/spec/components/pajamas/checkbox_component_spec.rb b/spec/components/pajamas/checkbox_component_spec.rb index 3d50509ef10..ea3ebe77811 100644 --- a/spec/components/pajamas/checkbox_component_spec.rb +++ b/spec/components/pajamas/checkbox_component_spec.rb @@ -76,7 +76,7 @@ RSpec.describe Pajamas::CheckboxComponent, :aggregate_failures, type: :component method: method ) ) do |c| - c.label { label } + c.with_label { label } end end end @@ -94,7 +94,7 @@ RSpec.describe Pajamas::CheckboxComponent, :aggregate_failures, type: :component label: label ) ) do |c| - c.help_text { help_text } + c.with_help_text { help_text } end end end @@ -112,8 +112,8 @@ RSpec.describe Pajamas::CheckboxComponent, :aggregate_failures, type: :component method: method ) ) do |c| - c.label { label } - c.help_text { help_text } + c.with_label { label } + c.with_help_text { help_text } end end end diff --git a/spec/components/pajamas/checkbox_tag_component_spec.rb b/spec/components/pajamas/checkbox_tag_component_spec.rb index bca7a6005d5..fb5f927469b 100644 --- a/spec/components/pajamas/checkbox_tag_component_spec.rb +++ b/spec/components/pajamas/checkbox_tag_component_spec.rb @@ -9,7 +9,7 @@ RSpec.describe Pajamas::CheckboxTagComponent, :aggregate_failures, type: :compon context 'with default options' do before do render_inline(described_class.new(name: name)) do |c| - c.label { label } + c.with_label { label } end end @@ -32,7 +32,7 @@ RSpec.describe Pajamas::CheckboxTagComponent, :aggregate_failures, type: :compon label_options: label_options ) ) do |c| - c.label { label } + c.with_label { label } end end @@ -48,8 +48,8 @@ RSpec.describe Pajamas::CheckboxTagComponent, :aggregate_failures, type: :compon context 'with `help_text` slot' do before do render_inline(described_class.new(name: name)) do |c| - c.label { label } - c.help_text { help_text } + c.with_label { label } + c.with_help_text { help_text } end end diff --git a/spec/components/pajamas/radio_component_spec.rb b/spec/components/pajamas/radio_component_spec.rb index 8df432746d0..5b12e7c2785 100644 --- a/spec/components/pajamas/radio_component_spec.rb +++ b/spec/components/pajamas/radio_component_spec.rb @@ -76,7 +76,7 @@ RSpec.describe Pajamas::RadioComponent, :aggregate_failures, type: :component do value: value ) ) do |c| - c.label { label } + c.with_label { label } end end end @@ -95,7 +95,7 @@ RSpec.describe Pajamas::RadioComponent, :aggregate_failures, type: :component do label: label ) ) do |c| - c.help_text { help_text } + c.with_help_text { help_text } end end end @@ -114,8 +114,8 @@ RSpec.describe Pajamas::RadioComponent, :aggregate_failures, type: :component do value: value ) ) do |c| - c.label { label } - c.help_text { help_text } + c.with_label { label } + c.with_help_text { help_text } end end end diff --git a/spec/features/issues/user_creates_issue_spec.rb b/spec/features/issues/user_creates_issue_spec.rb index 56c395091d9..075b81d9af4 100644 --- a/spec/features/issues/user_creates_issue_spec.rb +++ b/spec/features/issues/user_creates_issue_spec.rb @@ -235,6 +235,7 @@ RSpec.describe "User creates issue", feature_category: :team_planning do wait_for_requests expect(page).to have_field('Title', with: '') + expect(page).to have_field('Description', with: '') fill_in 'issue_title', with: 'bug 345' fill_in 'issue_description', with: 'bug description' @@ -242,6 +243,21 @@ RSpec.describe "User creates issue", feature_category: :team_planning do click_button 'Create issue' end end + + it 'clears local storage after cancelling a new issue creation', :js do + 2.times do + visit new_project_issue_path(project) + wait_for_requests + + expect(page).to have_field('Title', with: '') + expect(page).to have_field('Description', with: '') + + fill_in 'issue_title', with: 'bug 345' + fill_in 'issue_description', with: 'bug description' + + click_link 'Cancel' + end + end end context 'when signed in as reporter', :js do diff --git a/spec/features/projects/blobs/blame_spec.rb b/spec/features/projects/blobs/blame_spec.rb index 6f5bf8ac26e..c5379cf56c0 100644 --- a/spec/features/projects/blobs/blame_spec.rb +++ b/spec/features/projects/blobs/blame_spec.rb @@ -102,14 +102,6 @@ RSpec.describe 'File blame', :js, feature_category: :projects do end end - context 'when streaming is disabled' do - before do - stub_feature_flags(blame_page_streaming: false) - end - - it_behaves_like 'a full blame page' - end - context 'when streaming is enabled' do before do stub_const('Gitlab::Git::BlamePagination::STREAMING_PER_PAGE', 50) diff --git a/spec/frontend/vue_shared/components/markdown/markdown_editor_spec.js b/spec/frontend/vue_shared/components/markdown/markdown_editor_spec.js index d32e148ef79..26a74036b10 100644 --- a/spec/frontend/vue_shared/components/markdown/markdown_editor_spec.js +++ b/spec/frontend/vue_shared/components/markdown/markdown_editor_spec.js @@ -3,7 +3,12 @@ import Autosize from 'autosize'; import MockAdapter from 'axios-mock-adapter'; import { nextTick } from 'vue'; import { mountExtended } from 'helpers/vue_test_utils_helper'; -import { EDITING_MODE_MARKDOWN_FIELD, EDITING_MODE_CONTENT_EDITOR } from '~/vue_shared/constants'; +import { + EDITING_MODE_MARKDOWN_FIELD, + EDITING_MODE_CONTENT_EDITOR, + CLEAR_AUTOSAVE_ENTRY_EVENT, +} from '~/vue_shared/constants'; +import markdownEditorEventHub from '~/vue_shared/components/markdown/eventhub'; import MarkdownEditor from '~/vue_shared/components/markdown/markdown_editor.vue'; import ContentEditor from '~/content_editor/components/content_editor.vue'; import BubbleMenu from '~/content_editor/components/bubble_menus/bubble_menu.vue'; @@ -251,6 +256,38 @@ describe('vue_shared/component/markdown/markdown_editor', () => { expect(localStorage.setItem).not.toHaveBeenCalled(); }); + + describe('clear local storage event handler', () => { + it('does not clear the local storage if the autosave key is not defined', async () => { + buildWrapper(); + + await waitForPromises(); + + markdownEditorEventHub.$emit(CLEAR_AUTOSAVE_ENTRY_EVENT, 'issue/1234'); + + expect(localStorage.removeItem).not.toHaveBeenCalled(); + }); + + it('does not clear the local storage if the event autosave key does not match', async () => { + buildWrapper({ propsData: { autosaveKey: 'issue/1234' } }); + + await waitForPromises(); + + markdownEditorEventHub.$emit(CLEAR_AUTOSAVE_ENTRY_EVENT, 'issue/1235'); + + expect(localStorage.removeItem).not.toHaveBeenCalled(); + }); + + it('clears the local storage if the event autosave key matches', async () => { + buildWrapper({ propsData: { autosaveKey: 'issue/1234' } }); + + await waitForPromises(); + + markdownEditorEventHub.$emit(CLEAR_AUTOSAVE_ENTRY_EVENT, 'issue/1234'); + + expect(localStorage.removeItem).toHaveBeenCalledWith('autosave/issue/1234'); + }); + }); }); it('renders markdown field textarea', () => { diff --git a/spec/helpers/blame_helper_spec.rb b/spec/helpers/blame_helper_spec.rb index 54d714b2038..30670064d93 100644 --- a/spec/helpers/blame_helper_spec.rb +++ b/spec/helpers/blame_helper_spec.rb @@ -69,23 +69,12 @@ RSpec.describe BlameHelper, feature_category: :source_code_management do end describe '#entire_blame_path' do - subject { helper.entire_blame_path(id, project, blame_mode) } + subject { helper.entire_blame_path(id, project) } let_it_be(:project) { build_stubbed(:project) } let(:id) { 'main/README.md' } - let(:blame_mode) { instance_double('Gitlab::Git::BlameMode', 'streaming_supported?' => streaming_enabled) } - context 'when streaming is supported' do - let(:streaming_enabled) { true } - - it { is_expected.to eq "/#{project.full_path}/-/blame/#{id}/streaming" } - end - - context 'when streaming is not supported' do - let(:streaming_enabled) { false } - - it { is_expected.to eq "/#{project.full_path}/-/blame/#{id}?no_pagination=true" } - end + it { is_expected.to eq "/#{project.full_path}/-/blame/#{id}/streaming" } end end diff --git a/spec/lib/gitlab/database/pg_depend_spec.rb b/spec/lib/gitlab/database/pg_depend_spec.rb new file mode 100644 index 00000000000..f8b0e1af3a5 --- /dev/null +++ b/spec/lib/gitlab/database/pg_depend_spec.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Gitlab::Database::PgDepend, type: :model, feature_category: :database do + let(:connection) { described_class.connection } + + describe '.from_pg_extension' do + subject { described_class.from_pg_extension('VIEW') } + + context 'when having views as dependency' do + before do + connection.execute('CREATE EXTENSION IF NOT EXISTS pg_stat_statements;') + end + + it 'returns pg_stat_statements' do + expect(subject.pluck('relname')).to eq(['pg_stat_statements']) + end + end + end +end diff --git a/spec/lib/gitlab/git/blame_mode_spec.rb b/spec/lib/gitlab/git/blame_mode_spec.rb index 1fc6f12c552..3496b763f92 100644 --- a/spec/lib/gitlab/git/blame_mode_spec.rb +++ b/spec/lib/gitlab/git/blame_mode_spec.rb @@ -8,20 +8,6 @@ RSpec.describe Gitlab::Git::BlameMode, feature_category: :source_code_management let_it_be(:project) { build(:project) } let(:params) { {} } - describe '#streaming_supported?' do - subject { blame_mode.streaming_supported? } - - it { is_expected.to be_truthy } - - context 'when `blame_page_streaming` is disabled' do - before do - stub_feature_flags(blame_page_streaming: false) - end - - it { is_expected.to be_falsey } - end - end - describe '#streaming?' do subject { blame_mode.streaming? } @@ -31,14 +17,6 @@ RSpec.describe Gitlab::Git::BlameMode, feature_category: :source_code_management let(:params) { { streaming: true } } it { is_expected.to be_truthy } - - context 'when `blame_page_streaming` is disabled' do - before do - stub_feature_flags(blame_page_streaming: false) - end - - it { is_expected.to be_falsey } - end end end diff --git a/spec/models/commit_status_spec.rb b/spec/models/commit_status_spec.rb index 7a7ea9e09cd..d033d4adba7 100644 --- a/spec/models/commit_status_spec.rb +++ b/spec/models/commit_status_spec.rb @@ -34,17 +34,6 @@ RSpec.describe CommitStatus, feature_category: :continuous_integration do it { is_expected.to validate_length_of(:target_url).is_at_most(255) } it { is_expected.to validate_length_of(:description).is_at_most(255) } - context 'when feature flag ci_builds_columns_size_validation is disabled' do - before do - stub_feature_flags(ci_builds_columns_size_validation: false) - end - - it { is_expected.not_to validate_length_of(:stage).is_at_most(255) } - it { is_expected.not_to validate_length_of(:ref).is_at_most(255) } - it { is_expected.not_to validate_length_of(:target_url).is_at_most(255) } - it { is_expected.not_to validate_length_of(:description).is_at_most(255) } - end - it { is_expected.to delegate_method(:sha).to(:pipeline) } it { is_expected.to delegate_method(:short_sha).to(:pipeline) } diff --git a/spec/support/rspec_order_todo.yml b/spec/support/rspec_order_todo.yml index 9f259101ffc..49f71acd3a8 100644 --- a/spec/support/rspec_order_todo.yml +++ b/spec/support/rspec_order_todo.yml @@ -2541,7 +2541,6 @@ - './ee/spec/services/ci/external_pull_requests/process_github_event_service_spec.rb' - './ee/spec/services/ci/minutes/additional_packs/change_namespace_service_spec.rb' - './ee/spec/services/ci/minutes/additional_packs/create_service_spec.rb' -- './ee/spec/services/ci/minutes/batch_reset_service_spec.rb' - './ee/spec/services/ci/minutes/email_notification_service_spec.rb' - './ee/spec/services/ci/minutes/refresh_cached_data_service_spec.rb' - './ee/spec/services/ci/minutes/reset_usage_service_spec.rb' diff --git a/spec/tasks/gitlab/db_rake_spec.rb b/spec/tasks/gitlab/db_rake_spec.rb index c2cc6d05630..eb4024bbe6a 100644 --- a/spec/tasks/gitlab/db_rake_spec.rb +++ b/spec/tasks/gitlab/db_rake_spec.rb @@ -588,8 +588,14 @@ RSpec.describe 'gitlab:db namespace rake task', :silence_stdout, feature_categor describe 'drop_tables' do let(:tables) { %w(one two schema_migrations) } - let(:views) { %w(three four) } + let(:views) { %w(three four pg_stat_statements) } let(:schemas) { Gitlab::Database::EXTRA_SCHEMAS } + let(:ignored_views) { double(ActiveRecord::Relation, pluck: ['pg_stat_statements']) } + + before do + allow(Gitlab::Database::PgDepend).to receive(:using_connection).and_yield + allow(Gitlab::Database::PgDepend).to receive(:from_pg_extension).with('VIEW').and_return(ignored_views) + end context 'with a single database' do let(:connection) { ActiveRecord::Base.connection } @@ -664,6 +670,8 @@ RSpec.describe 'gitlab:db namespace rake task', :silence_stdout, feature_categor expect(connection).to receive(:execute).with('DROP VIEW IF EXISTS "three" CASCADE') expect(connection).to receive(:execute).with('DROP VIEW IF EXISTS "four" CASCADE') + expect(Gitlab::Database::PgDepend).to receive(:from_pg_extension).with('VIEW') + expect(connection).not_to receive(:execute).with('DROP VIEW IF EXISTS "pg_stat_statements" CASCADE') expect(connection).to receive(:execute).with('TRUNCATE schema_migrations') diff --git a/yarn.lock b/yarn.lock index 8246c313120..8e3b71b7476 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12967,10 +12967,10 @@ webpack-dev-middleware@^5.3.1: range-parser "^1.2.1" schema-utils "^4.0.0" -webpack-dev-server@4.13.3: - version "4.13.3" - resolved "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-4.13.3.tgz#9feb740b8b56b886260bae1360286818a221bae8" - integrity sha512-KqqzrzMRSRy5ePz10VhjyL27K2dxqwXQLP5rAKwRJBPUahe7Z2bBWzHw37jeb8GCPKxZRO79ZdQUAPesMh/Nug== +webpack-dev-server@4.15.0: + version "4.15.0" + resolved "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-4.15.0.tgz#87ba9006eca53c551607ea0d663f4ae88be7af21" + integrity sha512-HmNB5QeSl1KpulTBQ8UT4FPrByYyaLxpJoQ0+s7EvUrMc16m0ZS1sgb1XGqzmgCPk0c9y+aaXxn11tbLzuM7NQ== dependencies: "@types/bonjour" "^3.5.9" "@types/connect-history-api-fallback" "^1.3.5" |