diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-19 21:09:14 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-19 21:09:14 +0300 |
commit | cd40e11c5728c995c62e98091aff43b6e4aecabe (patch) | |
tree | e3e7aa361c9d76230aeaf63dd3f89a8dff4003f7 | |
parent | 846dc476d835e43b123e0d66da3a60ed07f10641 (diff) |
Add latest changes from gitlab-org/gitlab@master
32 files changed, 409 insertions, 56 deletions
diff --git a/.gitlab/ci/rules.gitlab-ci.yml b/.gitlab/ci/rules.gitlab-ci.yml index 4b9168f193d..142341e5741 100644 --- a/.gitlab/ci/rules.gitlab-ci.yml +++ b/.gitlab/ci/rules.gitlab-ci.yml @@ -883,6 +883,9 @@ changes: *feature-flag-development-config-patterns when: never - <<: *if-dot-com-gitlab-org-and-security-merge-request + changes: *nodejs-patterns + allow_failure: true + - <<: *if-dot-com-gitlab-org-and-security-merge-request changes: *ci-qa-patterns allow_failure: true - <<: *if-dot-com-gitlab-org-and-security-merge-request diff --git a/app/assets/javascripts/diffs/components/diff_file_header.vue b/app/assets/javascripts/diffs/components/diff_file_header.vue index 495c87a695c..8cdbd2b7dbc 100644 --- a/app/assets/javascripts/diffs/components/diff_file_header.vue +++ b/app/assets/javascripts/diffs/components/diff_file_header.vue @@ -340,6 +340,7 @@ export default { :title="__('Copy file path')" :text="diffFile.file_path" :gfm="gfmCopyText" + size="small" data-testid="diff-file-copy-clipboard" category="tertiary" data-track-action="click_copy_file_button" @@ -392,6 +393,7 @@ export default { /> <gl-dropdown v-gl-tooltip.hover.focus="$options.i18n.optionsDropdownTitle" + size="small" right toggle-class="btn-icon js-diff-more-actions" class="gl-pt-0!" @@ -400,7 +402,7 @@ export default { @hidden="setMoreActionsShown(false)" > <template #button-content> - <gl-icon name="ellipsis_v" class="mr-0" /> + <gl-icon name="ellipsis_v" class="mr-0" :size="12" /> <span class="sr-only">{{ $options.i18n.optionsDropdownTitle }}</span> </template> <gl-dropdown-item diff --git a/app/assets/javascripts/ide/components/commit_sidebar/form.vue b/app/assets/javascripts/ide/components/commit_sidebar/form.vue index 44f543d9a76..38f3b094b7c 100644 --- a/app/assets/javascripts/ide/components/commit_sidebar/form.vue +++ b/app/assets/javascripts/ide/components/commit_sidebar/form.vue @@ -160,7 +160,7 @@ export default { data-testid="begin-commit-button" @click="beginCommit" > - {{ __('Commit…') }} + {{ __('Create commit...') }} </gl-button> </div> <p class="text-center bold">{{ overviewText }}</p> diff --git a/app/assets/javascripts/sidebar/components/time_tracking/time_tracker.vue b/app/assets/javascripts/sidebar/components/time_tracking/time_tracker.vue index d222a2af382..fdbcef22bba 100644 --- a/app/assets/javascripts/sidebar/components/time_tracking/time_tracker.vue +++ b/app/assets/javascripts/sidebar/components/time_tracking/time_tracker.vue @@ -207,7 +207,7 @@ export default { class="hide-collapsed gl-line-height-20 gl-text-gray-900 gl-display-flex gl-align-items-center" > {{ __('Time tracking') }} - <gl-loading-icon v-if="isTimeTrackingInfoLoading" size="sm" inline /> + <gl-loading-icon v-if="isTimeTrackingInfoLoading" size="sm" class="gl-ml-2" inline /> <gl-button :data-testid="showHelpState ? 'closeHelpButton' : 'helpButton'" category="tertiary" diff --git a/app/finders/packages/build_infos_for_many_packages_finder.rb b/app/finders/packages/build_infos_for_many_packages_finder.rb new file mode 100644 index 00000000000..8f9805f51d0 --- /dev/null +++ b/app/finders/packages/build_infos_for_many_packages_finder.rb @@ -0,0 +1,92 @@ +# frozen_string_literal: true + +module Packages + # TODO rename to BuildInfosFinder when cleaning up packages_graphql_pipelines_resolver + # https://gitlab.com/gitlab-org/gitlab/-/issues/358432 + class BuildInfosForManyPackagesFinder + include ActiveRecord::ConnectionAdapters::Quoting + + MAX_PAGE_SIZE = 100 + + def initialize(package_ids, params) + @package_ids = package_ids + @params = params + end + + def execute + return Packages::BuildInfo.none if @package_ids.blank? + + # This is a highly custom query that + # will not be re-used elsewhere + # rubocop: disable CodeReuse/ActiveRecord + query = Packages::Package.id_in(@package_ids) + .select('build_infos.*') + .from([Packages::Package.arel_table, lateral_query.arel.lateral.as('build_infos')]) + .order('build_infos.id DESC') + + # We manually select build_infos fields from the lateral query. + # Thus, we need to instruct ActiveRecord that returned rows are + # actually Packages::BuildInfo objects + Packages::BuildInfo.find_by_sql(query.to_sql) + # rubocop: enable CodeReuse/ActiveRecord + end + + private + + def lateral_query + order_direction = last ? :asc : :desc + + # This is a highly custom query that + # will not be re-used elsewhere + # rubocop: disable CodeReuse/ActiveRecord + where_condition = Packages::BuildInfo.arel_table[:package_id] + .eq(Arel.sql("#{Packages::Package.table_name}.id")) + build_infos = ::Packages::BuildInfo.without_empty_pipelines + .where(where_condition) + .order(id: order_direction) + .limit(max_rows_per_package_id) + # rubocop: enable CodeReuse/ActiveRecord + apply_cursor(build_infos) + end + + def max_rows_per_package_id + limit = [first, last, max_page_size, MAX_PAGE_SIZE].compact.min + limit += 1 if support_next_page + limit + end + + def apply_cursor(build_infos) + if before + build_infos.with_pipeline_id_greater_than(before) + elsif after + build_infos.with_pipeline_id_less_than(after) + else + build_infos + end + end + + def first + @params[:first] + end + + def last + @params[:last] + end + + def max_page_size + @params[:max_page_size] + end + + def before + @params[:before] + end + + def after + @params[:after] + end + + def support_next_page + @params[:support_next_page] + end + end +end diff --git a/app/views/admin/application_settings/general.html.haml b/app/views/admin/application_settings/general.html.haml index ae6ba3fed79..bc2fedec69c 100644 --- a/app/views/admin/application_settings/general.html.haml +++ b/app/views/admin/application_settings/general.html.haml @@ -98,11 +98,10 @@ %fieldset .form-group - .form-check - - link_start = '<a href="%{url}">'.html_safe % { url: help_page_path('user/project/web_ide/index', anchor: 'enable-live-preview') } - = f.gitlab_ui_checkbox_component :web_ide_clientside_preview_enabled, - s_('IDE|Live Preview'), - help_text: s_('Preview JavaScript projects in the Web IDE with CodeSandbox Live Preview. %{link_start}Learn more.%{link_end} ').html_safe % { link_start: link_start, link_end: '</a>'.html_safe } + - link_start = '<a href="%{url}">'.html_safe % { url: help_page_path('user/project/web_ide/index', anchor: 'enable-live-preview') } + = f.gitlab_ui_checkbox_component :web_ide_clientside_preview_enabled, + s_('IDE|Live Preview'), + help_text: s_('Preview JavaScript projects in the Web IDE with CodeSandbox Live Preview. %{link_start}Learn more.%{link_end} ').html_safe % { link_start: link_start, link_end: '</a>'.html_safe } = f.submit _('Save changes'), class: "gl-button btn btn-confirm" = render_if_exists 'admin/application_settings/maintenance_mode_settings_form' diff --git a/app/views/projects/_import_project_pane.html.haml b/app/views/projects/_import_project_pane.html.haml index af7509d1afe..6dfb338a916 100644 --- a/app/views/projects/_import_project_pane.html.haml +++ b/app/views/projects/_import_project_pane.html.haml @@ -81,7 +81,7 @@ .js-toggle-content.toggle-import-form{ class: ('hide' if active_tab != 'import') } - = form_for @project, html: { class: 'new_project gl-show-field-errors js-project-import' } do |f| + = gitlab_ui_form_for @project, html: { class: 'new_project gl-show-field-errors js-project-import' } do |f| %hr = render "shared/import_form", f: f = render 'projects/new_project_fields', f: f, project_name_id: "import-url-name", hide_init_with_readme: true, track_label: track_label diff --git a/app/views/projects/branches/_panel.html.haml b/app/views/projects/branches/_panel.html.haml index f03b5cf2eff..bd6831ff3b2 100644 --- a/app/views/projects/branches/_panel.html.haml +++ b/app/views/projects/branches/_panel.html.haml @@ -7,7 +7,7 @@ - return unless branches.any? -.card.gl-mt-3 +.card .card-header = panel_title %ul.content-list.all-branches.qa-all-branches diff --git a/app/views/projects/branches/index.html.haml b/app/views/projects/branches/index.html.haml index 96acd863a4c..85a0346e691 100644 --- a/app/views/projects/branches/index.html.haml +++ b/app/views/projects/branches/index.html.haml @@ -27,11 +27,6 @@ = render_if_exists 'projects/commits/mirror_status' .js-branch-list{ data: { diverging_counts_endpoint: diverging_commit_counts_namespace_project_branches_path(@project.namespace, @project, format: :json), default_branch: @project.default_branch } } -- if can?(current_user, :admin_project, @project) - - project_settings_link = link_to s_('Branches|project settings'), project_protected_branches_path(@project) - .row-content-block - %h5 - = s_('Branches|Protected branches can be managed in %{project_settings_link}.').html_safe % { project_settings_link: project_settings_link } - if @gitaly_unavailable = render 'shared/errors/gitaly_unavailable', reason: s_('Branches|Unable to load branches') diff --git a/app/views/projects/imports/new.html.haml b/app/views/projects/imports/new.html.haml index b021087c394..dc2bcfa33bb 100644 --- a/app/views/projects/imports/new.html.haml +++ b/app/views/projects/imports/new.html.haml @@ -12,7 +12,7 @@ :preserve #{h(@project.import_state.last_error)} -= form_for @project, url: project_import_path(@project), method: :post, html: { class: 'js-project-import' } do |f| += gitlab_ui_form_for @project, url: project_import_path(@project), method: :post, html: { class: 'js-project-import' } do |f| = render "shared/import_form", f: f .form-actions diff --git a/config/feature_flags/development/ipynb_semantic_diff.yml b/config/feature_flags/development/ipynb_semantic_diff.yml new file mode 100644 index 00000000000..ef16cacaa37 --- /dev/null +++ b/config/feature_flags/development/ipynb_semantic_diff.yml @@ -0,0 +1,8 @@ +--- +name: ipynb_semantic_diff +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/85079 +rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/358917 +milestone: '15.0' +type: development +group: group::code review +default_enabled: true diff --git a/db/docs/postgres_async_indexes.yml b/db/docs/postgres_async_indexes.yml index c1efbe2d690..b23b72de808 100644 --- a/db/docs/postgres_async_indexes.yml +++ b/db/docs/postgres_async_indexes.yml @@ -4,6 +4,8 @@ classes: - Gitlab::Database::AsyncIndexes::PostgresAsyncIndex feature_categories: - database -description: TODO +description: >- + Contains a queue-like structure for database indexes scheduled to be created asynchronously. + See https://docs.gitlab.com/ee/development/adding_database_indexes.html#create-indexes-asynchronously for more details. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/66478 milestone: '14.2' diff --git a/db/docs/postgres_reindex_actions.yml b/db/docs/postgres_reindex_actions.yml index 9055f5ffa06..d7297454d6a 100644 --- a/db/docs/postgres_reindex_actions.yml +++ b/db/docs/postgres_reindex_actions.yml @@ -4,6 +4,9 @@ classes: - Gitlab::Database::Reindexing::ReindexAction feature_categories: - database -description: TODO +description: >- + Captures details about reindexing operations on a per-index basis. + See https://docs.gitlab.com/ee/administration/raketasks/maintenance.html#rebuild-database-indexes + for details about reindexing. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/43156 milestone: '13.5' diff --git a/db/docs/postgres_reindex_queued_actions.yml b/db/docs/postgres_reindex_queued_actions.yml index 0ed3498d44f..7955d000f8c 100644 --- a/db/docs/postgres_reindex_queued_actions.yml +++ b/db/docs/postgres_reindex_queued_actions.yml @@ -4,6 +4,8 @@ classes: - Gitlab::Database::Reindexing::QueuedAction feature_categories: - database -description: TODO +description: >- + Contains a queue-like structure for reindexing actions. + Actions in this queue will be prioritized over regular reindexing actions. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/73480 milestone: '14.5' diff --git a/db/migrate/20220413075921_update_index_on_packages_build_infos.rb b/db/migrate/20220413075921_update_index_on_packages_build_infos.rb new file mode 100644 index 00000000000..96f37fab24e --- /dev/null +++ b/db/migrate/20220413075921_update_index_on_packages_build_infos.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class UpdateIndexOnPackagesBuildInfos < Gitlab::Database::Migration[1.0] + disable_ddl_transaction! + + NEW_INDEX_NAME = 'index_packages_build_infos_package_id_pipeline_id_id' + OLD_INDEX_NAME = 'index_packages_build_infos_package_id_pipeline_id' + + def up + add_concurrent_index :packages_build_infos, + [:package_id, :pipeline_id, :id], + name: NEW_INDEX_NAME + remove_concurrent_index_by_name :packages_build_infos, OLD_INDEX_NAME + end + + def down + add_concurrent_index :packages_build_infos, + [:package_id, :pipeline_id], + name: OLD_INDEX_NAME + remove_concurrent_index_by_name :packages_build_infos, NEW_INDEX_NAME + end +end diff --git a/db/schema_migrations/20220413075921 b/db/schema_migrations/20220413075921 new file mode 100644 index 00000000000..ef26fb07cd6 --- /dev/null +++ b/db/schema_migrations/20220413075921 @@ -0,0 +1 @@ +b3e580387d56847039c4030fbbbda1131016ef6b068ff60f2e4e48563a331051
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 6a8d5ebe079..c226da842c3 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -28493,7 +28493,7 @@ CREATE UNIQUE INDEX index_organizations_on_unique_name_per_group ON customer_rel CREATE INDEX index_packages_build_infos_on_pipeline_id ON packages_build_infos USING btree (pipeline_id); -CREATE INDEX index_packages_build_infos_package_id_pipeline_id ON packages_build_infos USING btree (package_id, pipeline_id); +CREATE INDEX index_packages_build_infos_package_id_pipeline_id_id ON packages_build_infos USING btree (package_id, pipeline_id, id); CREATE UNIQUE INDEX index_packages_composer_cache_namespace_and_sha ON packages_composer_cache_files USING btree (namespace_id, file_sha256); diff --git a/doc/development/licensed_feature_availability.md b/doc/development/licensed_feature_availability.md index 0de3f94cf70..6df5c2164e8 100644 --- a/doc/development/licensed_feature_availability.md +++ b/doc/development/licensed_feature_availability.md @@ -1,6 +1,6 @@ --- stage: Fulfillment -group: License +group: Provision info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- diff --git a/doc/user/admin_area/license.md b/doc/user/admin_area/license.md index 892b9f6e5b6..773f91d3076 100644 --- a/doc/user/admin_area/license.md +++ b/doc/user/admin_area/license.md @@ -1,6 +1,6 @@ --- stage: Fulfillment -group: License +group: Provision info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- diff --git a/doc/user/admin_area/license_file.md b/doc/user/admin_area/license_file.md index 1fd9dc24c13..5999e774d26 100644 --- a/doc/user/admin_area/license_file.md +++ b/doc/user/admin_area/license_file.md @@ -1,6 +1,6 @@ --- stage: Fulfillment -group: License +group: Provision info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- diff --git a/doc/user/project/repository/jupyter_notebooks/index.md b/doc/user/project/repository/jupyter_notebooks/index.md index cd0c6679d8d..39b57f89ceb 100644 --- a/doc/user/project/repository/jupyter_notebooks/index.md +++ b/doc/user/project/repository/jupyter_notebooks/index.md @@ -25,8 +25,14 @@ GitLab. ## Cleaner diffs -> - [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/6589) in GitLab 14.5 [with a flag](../../../../administration/feature_flags.md) named `jupyter_clean_diffs`. Enabled by default. +> - [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/6589) in GitLab 14.5 as an [Alpha](../../../../policy/alpha-beta-support.md#alpha-features) release [with a flag](../../../../administration/feature_flags.md) named `jupyter_clean_diffs`. Enabled by default. > - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75500) in GitLab 14.9. Feature flag `jupyter_clean_diffs` removed. +> - [Reintroduced toggle](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/85079) in GitLab 15.0 [with a flag](../../../../administration/feature_flags.md) named `ipynb_semantic_diff`. Enabled by default. + +FLAG: +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 `ipynb_semantic_diff`. +On GitLab.com, this feature is available. +This feature is ready for production use. When commits include changes to Jupyter Notebook files, GitLab: @@ -37,6 +43,10 @@ Code suggestions are not available on diffs and merge requests for `.ipynb` file ![Jupyter Notebook Clean Diff](img/jupyter_notebook_diff_v14_5.png) +This feature is an [Alpha](../../../../policy/alpha-beta-support.md#alpha-features) release, +and might lead to performance degradation. On self-managed GitLab, if unexpected issues +arise, disable the feature. + ## Jupyter Git integration Jupyter can be configured as an OAuth application with repository access, acting diff --git a/lib/gitlab/database.rb b/lib/gitlab/database.rb index 77d7d7e19c1..1895f0fab32 100644 --- a/lib/gitlab/database.rb +++ b/lib/gitlab/database.rb @@ -210,7 +210,7 @@ module Gitlab end def self.db_config_names - ::ActiveRecord::Base.configurations.configs_for(env_name: Rails.env).map(&:name) + ::ActiveRecord::Base.configurations.configs_for(env_name: Rails.env).map(&:name) - ['geo'] end # This returns all matching schemas that a given connection can use diff --git a/lib/gitlab/diff/file.rb b/lib/gitlab/diff/file.rb index 90e7a5f71a0..61bb0c797b4 100644 --- a/lib/gitlab/diff/file.rb +++ b/lib/gitlab/diff/file.rb @@ -44,7 +44,13 @@ module Gitlab new_blob_lazy old_blob_lazy - diff.diff = Gitlab::Diff::CustomDiff.preprocess_before_diff(diff.new_path, old_blob_lazy, new_blob_lazy) || diff.diff unless use_renderable_diff? + if use_semantic_ipynb_diff? && !use_renderable_diff? + diff.diff = Gitlab::Diff::CustomDiff.preprocess_before_diff(diff.new_path, old_blob_lazy, new_blob_lazy) || diff.diff + end + end + + def use_semantic_ipynb_diff? + strong_memoize(:_use_semantic_ipynb_diff) { Feature.enabled?(:ipynb_semantic_diff, repository.project, default_enabled: :yaml) } end def use_renderable_diff? @@ -375,7 +381,7 @@ module Gitlab end def rendered - return unless use_renderable_diff? && ipynb? && modified_file? && !too_large? + return unless use_semantic_ipynb_diff? && use_renderable_diff? && ipynb? && modified_file? && !too_large? strong_memoize(:rendered) { Rendered::Notebook::DiffFile.new(self) } end diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 9cd750bb0bf..24fb2d883c1 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -6262,9 +6262,6 @@ msgstr "" msgid "Branches|Please type the following to confirm:" msgstr "" -msgid "Branches|Protected branches can be managed in %{project_settings_link}." -msgstr "" - msgid "Branches|Show active branches" msgstr "" @@ -6322,9 +6319,6 @@ msgstr "" msgid "Branches|merged" msgstr "" -msgid "Branches|project settings" -msgstr "" - msgid "Branches|protected" msgstr "" @@ -9154,9 +9148,6 @@ msgstr "" msgid "Committed by" msgstr "" -msgid "Commit…" -msgstr "" - msgid "Community forum" msgstr "" @@ -10489,6 +10480,9 @@ msgstr "" msgid "Create commit" msgstr "" +msgid "Create commit..." +msgstr "" + msgid "Create common files more quickly, and standardize their format." msgstr "" diff --git a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/ui_variable_inheritable_when_forward_pipeline_variables_true_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/ui_variable_inheritable_when_forward_pipeline_variables_true_spec.rb index c683ccdc63f..496cc5f8a60 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/ui_variable_inheritable_when_forward_pipeline_variables_true_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/ui_variable_inheritable_when_forward_pipeline_variables_true_spec.rb @@ -1,8 +1,13 @@ # frozen_string_literal: true module QA - # Running with FF :ci_trigger_forward_variables - RSpec.describe 'Verify', :runner do + # TODO: + # Remove FF :ci_trigger_forward_variables + # when https://gitlab.com/gitlab-org/gitlab/-/issues/355572 is closed + RSpec.describe 'Verify', :runner, feature_flag: { + name: 'ci_trigger_forward_variables', + scope: :global + } do describe 'UI defined variable' do include_context 'variable inheritance test prep' diff --git a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/ui_variable_non_inheritable_when_forward_pipeline_variables_false_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/ui_variable_non_inheritable_when_forward_pipeline_variables_false_spec.rb index d1f9460fa7f..2a0aaf6d7a3 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/ui_variable_non_inheritable_when_forward_pipeline_variables_false_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/ui_variable_non_inheritable_when_forward_pipeline_variables_false_spec.rb @@ -1,8 +1,13 @@ # frozen_string_literal: true module QA - # Running with FF :ci_trigger_forward_variables - RSpec.describe 'Verify', :runner do + # TODO: + # Remove FF :ci_trigger_forward_variables + # when https://gitlab.com/gitlab-org/gitlab/-/issues/355572 is closed + RSpec.describe 'Verify', :runner, feature_flag: { + name: 'ci_trigger_forward_variables', + scope: :global + } do describe 'UI defined variable' do include_context 'variable inheritance test prep' diff --git a/qa/spec/support/shared_contexts/variable_inheritance_shared_context.rb b/qa/spec/support/shared_contexts/variable_inheritance_shared_context.rb index 7e6b69d1099..1dc8870d4d9 100644 --- a/qa/spec/support/shared_contexts/variable_inheritance_shared_context.rb +++ b/qa/spec/support/shared_contexts/variable_inheritance_shared_context.rb @@ -1,13 +1,7 @@ # frozen_string_literal: true module QA - # TODO: - # Remove FF :ci_trigger_forward_variables - # when https://gitlab.com/gitlab-org/gitlab/-/issues/355572 is closed - RSpec.shared_context 'variable inheritance test prep', feature_flag: { - name: 'ci_trigger_forward_variables', - scope: :global - } do + RSpec.shared_context 'variable inheritance test prep' do let(:random_string) { Faker::Alphanumeric.alphanumeric(number: 8) } let(:group) do diff --git a/spec/features/projects/branches_spec.rb b/spec/features/projects/branches_spec.rb index 8123cad4397..d906bb396be 100644 --- a/spec/features/projects/branches_spec.rb +++ b/spec/features/projects/branches_spec.rb @@ -199,14 +199,6 @@ RSpec.describe 'Branches' do project.add_maintainer(user) end - describe 'Initial branches page' do - it 'shows description for admin' do - visit project_branches_filtered_path(project, state: 'all') - - expect(page).to have_content("Protected branches can be managed in project settings") - end - end - it 'shows the merge request button' do visit project_branches_path(project) diff --git a/spec/finders/packages/build_infos_for_many_packages_finder_spec.rb b/spec/finders/packages/build_infos_for_many_packages_finder_spec.rb new file mode 100644 index 00000000000..f3c79d0c825 --- /dev/null +++ b/spec/finders/packages/build_infos_for_many_packages_finder_spec.rb @@ -0,0 +1,136 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe ::Packages::BuildInfosForManyPackagesFinder do + using RSpec::Parameterized::TableSyntax + + let_it_be(:package) { create(:package) } + let_it_be(:build_infos) { create_list(:package_build_info, 5, :with_pipeline, package: package) } + let_it_be(:build_info_with_empty_pipeline) { create(:package_build_info, package: package) } + + let_it_be(:other_package) { create(:package) } + let_it_be(:other_build_infos) { create_list(:package_build_info, 5, :with_pipeline, package: other_package) } + let_it_be(:other_build_info_with_empty_pipeline) { create(:package_build_info, package: other_package) } + + let_it_be(:all_build_infos) { build_infos + other_build_infos } + + let(:finder) { described_class.new(packages, params) } + let(:packages) { nil } + let(:first) { nil } + let(:last) { nil } + let(:after) { nil } + let(:before) { nil } + let(:max_page_size) { nil } + let(:support_next_page) { false } + let(:params) do + { + first: first, + last: last, + after: after, + before: before, + max_page_size: max_page_size, + support_next_page: support_next_page + } + end + + describe '#execute' do + subject { finder.execute } + + shared_examples 'returning the expected build infos' do + let(:expected_build_infos) do + expected_build_infos_indexes.map do |idx| + all_build_infos[idx] + end + end + + let(:after) do + all_build_infos[after_index].pipeline_id if after_index + end + + let(:before) do + all_build_infos[before_index].pipeline_id if before_index + end + + it { is_expected.to eq(expected_build_infos) } + end + + context 'with nil packages' do + let(:packages) { nil } + + it { is_expected.to be_empty } + end + + context 'with [] packages' do + let(:packages) { [] } + + it { is_expected.to be_empty } + end + + context 'with empy scope packages' do + let(:packages) { Packages::Package.none } + + it { is_expected.to be_empty } + end + + context 'with a single package' do + let(:packages) { package.id } + + # rubocop: disable Layout/LineLength + where(:first, :last, :after_index, :before_index, :max_page_size, :support_next_page, :expected_build_infos_indexes) do + # F L AI BI MPS SNP + nil | nil | nil | nil | nil | false | [4, 3, 2, 1, 0] + nil | nil | nil | nil | 10 | false | [4, 3, 2, 1, 0] + nil | nil | nil | nil | 2 | false | [4, 3] + 2 | nil | nil | nil | nil | false | [4, 3] + 2 | nil | nil | nil | nil | true | [4, 3, 2] + 2 | nil | 3 | nil | nil | false | [2, 1] + 2 | nil | 3 | nil | nil | true | [2, 1, 0] + 3 | nil | 4 | nil | 2 | false | [3, 2] + 3 | nil | 4 | nil | 2 | true | [3, 2, 1] + nil | 2 | nil | nil | nil | false | [1, 0] + nil | 2 | nil | nil | nil | true | [2, 1, 0] + nil | 2 | nil | 1 | nil | false | [3, 2] + nil | 2 | nil | 1 | nil | true | [4, 3, 2] + nil | 3 | nil | 0 | 2 | false | [2, 1] + nil | 3 | nil | 0 | 2 | true | [3, 2, 1] + end + # rubocop: enable Layout/LineLength + + with_them do + it_behaves_like 'returning the expected build infos' + end + end + + context 'with many packages' do + let(:packages) { [package.id, other_package.id] } + + # using after_index/before_index when receiving multiple packages doesn't + # make sense but we still verify here that the behavior is coherent. + # rubocop: disable Layout/LineLength + where(:first, :last, :after_index, :before_index, :max_page_size, :support_next_page, :expected_build_infos_indexes) do + # F L AI BI MPS SNP + nil | nil | nil | nil | nil | false | [9, 8, 7, 6, 5, 4, 3, 2, 1, 0] + nil | nil | nil | nil | 10 | false | [9, 8, 7, 6, 5, 4, 3, 2, 1, 0] + nil | nil | nil | nil | 2 | false | [9, 8, 4, 3] + 2 | nil | nil | nil | nil | false | [9, 8, 4, 3] + 2 | nil | nil | nil | nil | true | [9, 8, 7, 4, 3, 2] + 2 | nil | 3 | nil | nil | false | [2, 1] + 2 | nil | 3 | nil | nil | true | [2, 1, 0] + 3 | nil | 4 | nil | 2 | false | [3, 2] + 3 | nil | 4 | nil | 2 | true | [3, 2, 1] + nil | 2 | nil | nil | nil | false | [6, 5, 1, 0] + nil | 2 | nil | nil | nil | true | [7, 6, 5, 2, 1, 0] + nil | 2 | nil | 1 | nil | false | [6, 5, 3, 2] + nil | 2 | nil | 1 | nil | true | [7, 6, 5, 4, 3, 2] + nil | 3 | nil | 0 | 2 | false | [6, 5, 2, 1] + nil | 3 | nil | 0 | 2 | true | [7, 6, 5, 3, 2, 1] + end + + with_them do + it_behaves_like 'returning the expected build infos' + end + # rubocop: enable Layout/LineLength + end + end +end diff --git a/spec/frontend/ide/components/commit_sidebar/form_spec.js b/spec/frontend/ide/components/commit_sidebar/form_spec.js index d3b2923ac6c..28f62a9775a 100644 --- a/spec/frontend/ide/components/commit_sidebar/form_spec.js +++ b/spec/frontend/ide/components/commit_sidebar/form_spec.js @@ -120,7 +120,7 @@ describe('IDE commit form', () => { it('renders commit button in compact mode', () => { expect(findBeginCommitButton().exists()).toBe(true); - expect(findBeginCommitButton().text()).toBe('Commit…'); + expect(findBeginCommitButton().text()).toBe('Create commit...'); }); it('does not render form', () => { diff --git a/spec/lib/gitlab/database_spec.rb b/spec/lib/gitlab/database_spec.rb index 85a2fb1e512..ac8616f84a7 100644 --- a/spec/lib/gitlab/database_spec.rb +++ b/spec/lib/gitlab/database_spec.rb @@ -235,6 +235,26 @@ RSpec.describe Gitlab::Database do end end + describe '.db_config_names' do + let(:expected) { %w[foo bar] } + + it 'includes only main by default' do + allow(::ActiveRecord::Base).to receive(:configurations).and_return( + double(configs_for: %w[foo bar].map { |x| double(name: x) }) + ) + + expect(described_class.db_config_names).to eq(expected) + end + + it 'excludes geo when that is included' do + allow(::ActiveRecord::Base).to receive(:configurations).and_return( + double(configs_for: %w[foo bar geo].map { |x| double(name: x) }) + ) + + expect(described_class.db_config_names).to eq(expected) + end + end + describe '.gitlab_schemas_for_connection' do it 'does raise exception for invalid connection' do expect { described_class.gitlab_schemas_for_connection(:invalid) }.to raise_error /key not found: "unknown"/ diff --git a/spec/lib/gitlab/diff/file_spec.rb b/spec/lib/gitlab/diff/file_spec.rb index cb5f08c5dc6..0d7a183bb11 100644 --- a/spec/lib/gitlab/diff/file_spec.rb +++ b/spec/lib/gitlab/diff/file_spec.rb @@ -51,6 +51,54 @@ RSpec.describe Gitlab::Diff::File do project.commit(branch_name).diffs.diff_files.first end + describe '#initialize' do + let(:commit) { project.commit("532c837") } + + context 'when file is ipynb' do + let(:ipynb_semantic_diff) { false } + let(:rendered_diffs_viewer) { false } + + before do + stub_feature_flags(ipynb_semantic_diff: ipynb_semantic_diff, rendered_diffs_viewer: rendered_diffs_viewer) + end + + context 'when ipynb_semantic_diff is off, and rendered_viewer is off' do + it 'does not generate notebook diffs' do + expect(Gitlab::Diff::CustomDiff).not_to receive(:preprocess_before_diff) + expect(diff_file.rendered).to be_nil + end + end + + context 'when ipynb_semantic_diff is off, and rendered_viewer is on' do + let(:rendered_diffs_viewer) { true } + + it 'does not generate rendered diff' do + expect(Gitlab::Diff::CustomDiff).not_to receive(:preprocess_before_diff) + expect(diff_file.rendered).to be_nil + end + end + + context 'when ipynb_semantic_diff is on, and rendered_viewer is off' do + let(:ipynb_semantic_diff) { true } + + it 'transforms using custom diff CustomDiff' do + expect(Gitlab::Diff::CustomDiff).to receive(:preprocess_before_diff).and_call_original + expect(diff_file.rendered).to be_nil + end + end + + context 'when ipynb_semantic_diff is on, and rendered_viewer is on' do + let(:ipynb_semantic_diff) { true } + let(:rendered_diffs_viewer) { true } + + it 'transforms diff using NotebookDiffFile' do + expect(Gitlab::Diff::CustomDiff).not_to receive(:preprocess_before_diff) + expect(diff_file.rendered).not_to be_nil + end + end + end + end + describe '#has_renderable?' do context 'file is ipynb' do let(:commit) { project.commit("532c837") } @@ -104,6 +152,20 @@ RSpec.describe Gitlab::Diff::File do expect(diff_file.rendered).to be_nil end end + + context 'when semantic ipynb is off' do + before do + stub_feature_flags(ipynb_semantic_diff: false) + end + + it 'returns nil' do + expect(diff_file).not_to receive(:modified_file?) + expect(diff_file).not_to receive(:ipynb?) + expect(diff).not_to receive(:too_large?) + + expect(diff_file.rendered).to be_nil + end + end end end |