diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-29 03:10:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-29 03:10:07 +0300 |
commit | be6cab1d69ab884df73b155d8402a8d13289e066 (patch) | |
tree | e6876667e663135091ced21a552db373d92afad4 | |
parent | 4656fe08b9262cc3798ba23e111ffe1d9b9527b4 (diff) |
Add latest changes from gitlab-org/gitlab@master
58 files changed, 384 insertions, 152 deletions
diff --git a/.gitlab/CODEOWNERS b/.gitlab/CODEOWNERS index 095601ba825..cd6aec3f9ea 100644 --- a/.gitlab/CODEOWNERS +++ b/.gitlab/CODEOWNERS @@ -241,7 +241,7 @@ Dangerfile @gl-quality/eng-prod /ee/lib/gitlab/ci/reports/dependency_list/ @gitlab-org/secure/composition-analysis-be /ee/lib/gitlab/ci/reports/license_scanning/ @gitlab-org/secure/composition-analysis-be /ee/lib/gitlab/ci/reports/security/ @gitlab-org/secure/composition-analysis-be @gitlab-org/secure/dynamic-analysis-be @gitlab-org/secure/static-analysis-be @gitlab-org/secure/fuzzing-be -/ee/app/services/ci/run_dast_scan_service.rb @gitlab-org/secure/dynamic-analysis-be +/ee/app/services/app_sec/dast/ @gitlab-org/secure/dynamic-analysis-be [Container Security] /ee/app/views/projects/threat_monitoring/** @gitlab-org/protect/container-security-frontend diff --git a/app/assets/javascripts/ide/stores/utils.js b/app/assets/javascripts/ide/stores/utils.js index 0cef3b98e61..ec661fdb0d6 100644 --- a/app/assets/javascripts/ide/stores/utils.js +++ b/app/assets/javascripts/ide/stores/utils.js @@ -117,7 +117,7 @@ export const createCommitPayload = ({ action: commitActionForFile(f), file_path: f.path, previous_path: f.prevPath || undefined, - content: f.prevPath && !f.changed ? null : content || undefined, + content: content || undefined, encoding: isBlob ? 'base64' : 'text', last_commit_id: newBranch || f.deleted || f.prevPath ? undefined : f.lastCommitSha, }; diff --git a/app/controllers/projects/badges_controller.rb b/app/controllers/projects/badges_controller.rb index f75ab5cdbf2..0cd59c136e5 100644 --- a/app/controllers/projects/badges_controller.rb +++ b/app/controllers/projects/badges_controller.rb @@ -24,7 +24,10 @@ class Projects::BadgesController < Projects::ApplicationController .new(project, params[:ref], opts: { job: params[:job], key_text: params[:key_text], - key_width: params[:key_width] + key_width: params[:key_width], + min_good: params[:min_good], + min_acceptable: params[:min_acceptable], + min_medium: params[:min_medium] }) render_badge coverage_report diff --git a/app/models/ci/build_need.rb b/app/models/ci/build_need.rb index 003659570b3..bf1470ca20f 100644 --- a/app/models/ci/build_need.rb +++ b/app/models/ci/build_need.rb @@ -5,8 +5,6 @@ module Ci include BulkInsertSafe include IgnorableColumns - ignore_columns :build_id_convert_to_bigint, remove_with: '14.1', remove_after: '2021-07-22' - belongs_to :build, class_name: "Ci::Processable", foreign_key: :build_id, inverse_of: :needs validates :build, presence: true diff --git a/app/models/ci/build_runner_session.rb b/app/models/ci/build_runner_session.rb index 45de47116cd..e12c0f82c99 100644 --- a/app/models/ci/build_runner_session.rb +++ b/app/models/ci/build_runner_session.rb @@ -6,8 +6,6 @@ module Ci class BuildRunnerSession < Ci::ApplicationRecord include IgnorableColumns - ignore_columns :build_id_convert_to_bigint, remove_with: '14.1', remove_after: '2021-07-22' - TERMINAL_SUBPROTOCOL = 'terminal.gitlab.com' DEFAULT_SERVICE_NAME = 'build' DEFAULT_PORT_NAME = 'default_port' diff --git a/app/models/ci/build_trace_chunk.rb b/app/models/ci/build_trace_chunk.rb index 7a15d7ba940..6edb5ef4579 100644 --- a/app/models/ci/build_trace_chunk.rb +++ b/app/models/ci/build_trace_chunk.rb @@ -9,8 +9,6 @@ module Ci include ::Gitlab::OptimisticLocking include IgnorableColumns - ignore_columns :build_id_convert_to_bigint, remove_with: '14.1', remove_after: '2021-07-22' - belongs_to :build, class_name: "Ci::Build", foreign_key: :build_id default_value_for :data_store, :redis_trace_chunks diff --git a/app/models/ci/stage.rb b/app/models/ci/stage.rb index 39e26bf2785..131e18adf62 100644 --- a/app/models/ci/stage.rb +++ b/app/models/ci/stage.rb @@ -8,8 +8,6 @@ module Ci include Presentable include IgnorableColumns - ignore_column :id_convert_to_bigint, remove_with: '14.2', remove_after: '2021-08-22' - enum status: Ci::HasStatus::STATUSES_ENUM belongs_to :project diff --git a/app/models/deployment.rb b/app/models/deployment.rb index 4a690ccc67e..7f7da9950ce 100644 --- a/app/models/deployment.rb +++ b/app/models/deployment.rb @@ -10,8 +10,6 @@ class Deployment < ApplicationRecord include FastDestroyAll include IgnorableColumns - ignore_column :deployable_id_convert_to_bigint, remove_with: '14.2', remove_after: '2021-08-22' - belongs_to :project, required: true belongs_to :environment, required: true belongs_to :cluster, class_name: 'Clusters::Cluster', optional: true diff --git a/app/models/issue.rb b/app/models/issue.rb index 64254d3923c..1cf9af7bb45 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -107,8 +107,6 @@ class Issue < ApplicationRecord scope :order_due_date_asc, -> { reorder(::Gitlab::Database.nulls_last_order('due_date', 'ASC')) } scope :order_due_date_desc, -> { reorder(::Gitlab::Database.nulls_last_order('due_date', 'DESC')) } scope :order_closest_future_date, -> { reorder(Arel.sql('CASE WHEN issues.due_date >= CURRENT_DATE THEN 0 ELSE 1 END ASC, ABS(CURRENT_DATE - issues.due_date) ASC')) } - scope :order_relative_position_asc, -> { reorder(::Gitlab::Database.nulls_last_order('relative_position', 'ASC')) } - scope :order_relative_position_desc, -> { reorder(::Gitlab::Database.nulls_first_order('relative_position', 'DESC')) } scope :order_closed_date_desc, -> { reorder(closed_at: :desc) } scope :order_created_at_desc, -> { reorder(created_at: :desc) } scope :order_severity_asc, -> { includes(:issuable_severity).order('issuable_severities.severity ASC NULLS FIRST') } @@ -267,8 +265,8 @@ class Issue < ApplicationRecord 'due_date' => -> { order_due_date_asc.with_order_id_desc }, 'due_date_asc' => -> { order_due_date_asc.with_order_id_desc }, 'due_date_desc' => -> { order_due_date_desc.with_order_id_desc }, - 'relative_position' => -> { order_relative_position_asc.with_order_id_desc }, - 'relative_position_asc' => -> { order_relative_position_asc.with_order_id_desc } + 'relative_position' => -> { order_by_relative_position }, + 'relative_position_asc' => -> { order_by_relative_position } } ) end @@ -278,7 +276,7 @@ class Issue < ApplicationRecord when 'closest_future_date', 'closest_future_date_asc' then order_closest_future_date when 'due_date', 'due_date_asc' then order_due_date_asc.with_order_id_desc when 'due_date_desc' then order_due_date_desc.with_order_id_desc - when 'relative_position', 'relative_position_asc' then order_relative_position_asc.with_order_id_desc + when 'relative_position', 'relative_position_asc' then order_by_relative_position when 'severity_asc' then order_severity_asc.with_order_id_desc when 'severity_desc' then order_severity_desc.with_order_id_desc else @@ -286,13 +284,8 @@ class Issue < ApplicationRecord end end - # `with_cte` argument allows sorting when using CTE queries and prevents - # errors in postgres when using CTE search optimisation - def self.order_by_position_and_priority(with_cte: false) - order = Gitlab::Pagination::Keyset::Order.build([column_order_relative_position, column_order_highest_priority, column_order_id_desc]) - - order_labels_priority(with_cte: with_cte) - .reorder(order) + def self.order_by_relative_position + reorder(Gitlab::Pagination::Keyset::Order.build([column_order_relative_position, column_order_id_asc])) end def self.column_order_relative_position @@ -307,25 +300,6 @@ class Issue < ApplicationRecord ) end - def self.column_order_highest_priority - Gitlab::Pagination::Keyset::ColumnOrderDefinition.new( - attribute_name: 'highest_priority', - column_expression: Arel.sql('highest_priorities.label_priority'), - order_expression: Gitlab::Database.nulls_last_order('highest_priorities.label_priority', 'ASC'), - reversed_order_expression: Gitlab::Database.nulls_last_order('highest_priorities.label_priority', 'DESC'), - order_direction: :asc, - nullable: :nulls_last, - distinct: false - ) - end - - def self.column_order_id_desc - Gitlab::Pagination::Keyset::ColumnOrderDefinition.new( - attribute_name: 'id', - order_expression: arel_table[:id].desc - ) - end - def self.column_order_id_asc Gitlab::Pagination::Keyset::ColumnOrderDefinition.new( attribute_name: 'id', diff --git a/app/services/boards/issues/list_service.rb b/app/services/boards/issues/list_service.rb index 9a3e3bc3bdb..6021d634f86 100644 --- a/app/services/boards/issues/list_service.rb +++ b/app/services/boards/issues/list_service.rb @@ -22,7 +22,7 @@ module Boards def order(items) return items.order_closed_date_desc if list&.closed? - items.order_by_position_and_priority(with_cte: params[:search].present?) + items.order_by_relative_position end def finder diff --git a/app/services/issues/relative_position_rebalancing_service.rb b/app/services/issues/relative_position_rebalancing_service.rb index 7d199f99a24..872d294bcda 100644 --- a/app/services/issues/relative_position_rebalancing_service.rb +++ b/app/services/issues/relative_position_rebalancing_service.rb @@ -82,7 +82,7 @@ module Issues collection.each do |project| caching.cache_current_project_id(project.id) index += 1 - scope = Issue.in_projects(project).reorder(custom_reorder).select(:id, :relative_position) + scope = Issue.in_projects(project).order_by_relative_position.select(:id, :relative_position) with_retry(PREFETCH_ISSUES_BATCH_SIZE, 100) do |batch_size| Gitlab::Pagination::Keyset::Iterator.new(scope: scope).each_batch(of: batch_size) do |batch| @@ -166,10 +166,6 @@ module Issues @start_position ||= (RelativePositioning::START_POSITION - (gaps / 2) * gap_size).to_i end - def custom_reorder - ::Gitlab::Pagination::Keyset::Order.build([Issue.column_order_relative_position, Issue.column_order_id_asc]) - end - def with_retry(initial_batch_size, exit_batch_size) retries = 0 batch_size = initial_batch_size diff --git a/db/post_migrate/20210907211557_finalize_ci_builds_bigint_conversion.rb b/db/post_migrate/20210907211557_finalize_ci_builds_bigint_conversion.rb index 872eef5fd31..02f98833703 100644 --- a/db/post_migrate/20210907211557_finalize_ci_builds_bigint_conversion.rb +++ b/db/post_migrate/20210907211557_finalize_ci_builds_bigint_conversion.rb @@ -103,6 +103,11 @@ class FinalizeCiBuildsBigintConversion < Gitlab::Database::Migration[1.0] remove_foreign_key(:ci_resources, TABLE_NAME, column: :build_id, name: 'fk_rails_e169a8e3d5') end + # Remove this unexpected FK if it exists - https://gitlab.com/gitlab-org/gitlab/-/issues/341822 + if foreign_key_exists?(:ci_sources_pipelines, TABLE_NAME, column: :source_job_id, name: 'fk_3f0c88d7dc') + remove_foreign_key(:ci_sources_pipelines, TABLE_NAME, column: :source_job_id, name: 'fk_3f0c88d7dc') + end + swap_columns end diff --git a/db/post_migrate/20210927153807_update_issues_relative_position_indexes.rb b/db/post_migrate/20210927153807_update_issues_relative_position_indexes.rb new file mode 100644 index 00000000000..c7b0c7c6d14 --- /dev/null +++ b/db/post_migrate/20210927153807_update_issues_relative_position_indexes.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class UpdateIssuesRelativePositionIndexes < Gitlab::Database::Migration[1.0] + disable_ddl_transaction! + + RELATIVE_POSITION_INDEX_NAME = 'idx_issues_on_project_id_and_rel_asc_and_id' + RELATIVE_POSITION_STATE_INDEX_NAME = 'idx_issues_on_project_id_and_rel_position_and_state_id_and_id' + + NEW_RELATIVE_POSITION_STATE_INDEX_NAME = 'idx_issues_on_project_id_and_rel_position_and_id_and_state_id' + + def up + add_concurrent_index :issues, [:project_id, :relative_position, :id, :state_id], name: NEW_RELATIVE_POSITION_STATE_INDEX_NAME + + remove_concurrent_index_by_name :issues, RELATIVE_POSITION_INDEX_NAME + remove_concurrent_index_by_name :issues, RELATIVE_POSITION_STATE_INDEX_NAME + end + + def down + add_concurrent_index :issues, [:project_id, :relative_position, :state_id, :id], order: { id: :desc }, name: RELATIVE_POSITION_STATE_INDEX_NAME + add_concurrent_index :issues, [:project_id, :relative_position, :id], name: RELATIVE_POSITION_INDEX_NAME + + remove_concurrent_index_by_name :issues, NEW_RELATIVE_POSITION_STATE_INDEX_NAME + end +end diff --git a/db/schema_migrations/20210927153807 b/db/schema_migrations/20210927153807 new file mode 100644 index 00000000000..c6a675e380b --- /dev/null +++ b/db/schema_migrations/20210927153807 @@ -0,0 +1 @@ +8e54f43a955023e422bf40476f468fbdf04f06e806b08fddf35208c65607fec3
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index b9f69dd4437..c30123db88b 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -24045,9 +24045,7 @@ CREATE INDEX idx_issues_on_project_id_and_created_at_and_id_and_state_id ON issu CREATE INDEX idx_issues_on_project_id_and_due_date_and_id_and_state_id ON issues USING btree (project_id, due_date, id, state_id) WHERE (due_date IS NOT NULL); -CREATE INDEX idx_issues_on_project_id_and_rel_asc_and_id ON issues USING btree (project_id, relative_position, id); - -CREATE INDEX idx_issues_on_project_id_and_rel_position_and_state_id_and_id ON issues USING btree (project_id, relative_position, state_id, id DESC); +CREATE INDEX idx_issues_on_project_id_and_rel_position_and_id_and_state_id ON issues USING btree (project_id, relative_position, id, state_id); CREATE INDEX idx_issues_on_project_id_and_updated_at_and_id_and_state_id ON issues USING btree (project_id, updated_at, id, state_id); diff --git a/doc/ci/pipelines/settings.md b/doc/ci/pipelines/settings.md index 94d7e317104..4eec4ec1342 100644 --- a/doc/ci/pipelines/settings.md +++ b/doc/ci/pipelines/settings.md @@ -358,6 +358,29 @@ in your `README.md`: ![coverage](https://gitlab.com/gitlab-org/gitlab/badges/main/coverage.svg?job=coverage) ``` +#### Test coverage report badge colors and limits + +The default colors and limits for the badge are as follows: + +- 95 up to and including 100% - good (`#4c1`) +- 90 up to 95% - acceptable (`#a3c51c`) +- 75 up to 90% - medium (`#dfb317`) +- 0 up to 75% - low (`#e05d44`) +- no coverage - unknown (`#9f9f9f`) + +NOTE: +*Up to* means up to, but not including, the upper bound. + +You can overwrite the limits by using the following additional parameters ([Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/28317) in GitLab 14.4): + +- `min_good` (default 95, can use any value between 3 and 100) +- `min_acceptable` (default 90, can use any value between 2 and min_good-1) +- `min_medium` (default 75, can use any value between 1 and min_acceptable-1) + +If an invalid boundary is set, GitLab automatically adjusts it to be valid. For example, +if `min_good` is set `80`, and `min_acceptable` is set to `85` (too high), GitLab automatically +sets `min_acceptable` to `79` (`min_good` - `1`). + ### Badge styles Pipeline badges can be rendered in different styles by adding the `style=style_name` parameter to the URL. Two styles are available: diff --git a/doc/ci/runners/build_cloud/linux_build_cloud.md b/doc/ci/runners/build_cloud/linux_build_cloud.md index 1125d8dbcb4..d40db417d49 100644 --- a/doc/ci/runners/build_cloud/linux_build_cloud.md +++ b/doc/ci/runners/build_cloud/linux_build_cloud.md @@ -4,7 +4,7 @@ group: Runner 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 --- -# Build Cloud runners for Linux +# Build Cloud runners for Linux **(FREE)** GitLab Build Cloud runners for Linux run in autoscale mode and are powered by Google Cloud Platform. @@ -21,7 +21,7 @@ The `gitlab-shared-runners-manager-X.gitlab.com` fleet of runners are dedicated Jobs handled by the shared runners on GitLab.com (`shared-runners-manager-X.gitlab.com`), **time out after 3 hours**, regardless of the timeout configured in a -project. Check the issues [4010](https://gitlab.com/gitlab-com/infrastructure/-/issues/4010) and [4070](https://gitlab.com/gitlab-com/infrastructure/-/issues/4070) for the reference. +project. Check the issues [#4010](https://gitlab.com/gitlab-com/infrastructure/-/issues/4010) and [#4070](https://gitlab.com/gitlab-com/infrastructure/-/issues/4070) for the reference. Below are the runners' settings. diff --git a/doc/ci/runners/build_cloud/macos/environment.md b/doc/ci/runners/build_cloud/macos/environment.md index 5336890b931..8a2417186ae 100644 --- a/doc/ci/runners/build_cloud/macos/environment.md +++ b/doc/ci/runners/build_cloud/macos/environment.md @@ -4,7 +4,7 @@ group: Runner 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 --- -# VM instances and images for Build Cloud for macOS +# VM instances and images for Build Cloud for macOS **(FREE)** When you use the Build Cloud for macOS: diff --git a/doc/ci/runners/build_cloud/macos_build_cloud.md b/doc/ci/runners/build_cloud/macos_build_cloud.md index 794bc2e597d..5d55462fb63 100644 --- a/doc/ci/runners/build_cloud/macos_build_cloud.md +++ b/doc/ci/runners/build_cloud/macos_build_cloud.md @@ -4,7 +4,7 @@ group: Runner 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 --- -# Build Cloud runners for macOS (Beta) +# Build Cloud runners for macOS (Beta) **(FREE SAAS)** The GitLab Build Cloud for macOS Beta provides on-demand runners integrated with GitLab SaaS [CI/CD](../../../ci/index.md). Use these runners to build, test, and deploy apps for the Apple ecosystem (macOS, iOS, tvOS). You can take advantage diff --git a/doc/ci/runners/build_cloud/windows_build_cloud.md b/doc/ci/runners/build_cloud/windows_build_cloud.md index 0004041a3e8..5a1a3a4b58e 100644 --- a/doc/ci/runners/build_cloud/windows_build_cloud.md +++ b/doc/ci/runners/build_cloud/windows_build_cloud.md @@ -4,7 +4,7 @@ group: Runner 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 --- -# Build Cloud runners for Windows (beta) +# Build Cloud runners for Windows (beta) **(FREE)** GitLab Build Cloud runners for Windows are in [beta](https://about.gitlab.com/handbook/product/gitlab-the-product/#beta) and shouldn't be used for production workloads. diff --git a/doc/development/database/multiple_databases.md b/doc/development/database/multiple_databases.md index 0fd9f821fab..01c16ca088c 100644 --- a/doc/development/database/multiple_databases.md +++ b/doc/development/database/multiple_databases.md @@ -6,16 +6,14 @@ info: To determine the technical writer assigned to the Stage/Group associated w # Multiple Databases -In order to scale GitLab, the GitLab application database -will be [decomposed into multiple -databases](https://gitlab.com/groups/gitlab-org/-/epics/6168). +To scale GitLab, the we are +[decomposing the GitLab application database into multiple databases](https://gitlab.com/groups/gitlab-org/-/epics/6168). -## CI Database +## CI/CD Database -Support for configuring the GitLab Rails application to use a distinct -database for CI tables was added in [GitLab -14.1](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64289). This -feature is still under development, and is not ready for production use. +> Support for configuring the GitLab Rails application to use a distinct +database for CI/CD tables was [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64289) +in GitLab 14.1. This feature is still under development, and is not ready for production use. By default, GitLab is configured to use only one main database. To opt-in to use a main database, and CI database, modify the @@ -92,8 +90,8 @@ test: &test ### Migrations -Any migrations that affect `Ci::CiDatabaseRecord` models -and their tables must be placed in two directories for now: +Place any migrations that affect `Ci::CiDatabaseRecord` models +and their tables in two directories: - `db/migrate` - `db/ci_migrate` diff --git a/doc/user/group/custom_project_templates.md b/doc/user/group/custom_project_templates.md index 41046477b90..a9c56139b4d 100644 --- a/doc/user/group/custom_project_templates.md +++ b/doc/user/group/custom_project_templates.md @@ -17,6 +17,12 @@ in the group and select the **Group** tab. Every project in the subgroup, but not nested subgroups, can be selected by members of the group when a new project is created. +- Public projects can be selected by any signed-in user as a template for a new project, + if all enabled [project features](../project/settings/index.md#sharing-and-permissions) + except for **GitLab Pages** and **Security & Compliance** are set to **Everyone With Access**. + The same applies to internal projects. +- Private projects can be selected only by users who are members of the projects. + Repository and database information that is copied over to each new project is identical to the data exported with the [GitLab Project Import/Export](../project/settings/import_export.md). diff --git a/doc/user/packages/composer_repository/index.md b/doc/user/packages/composer_repository/index.md index 2787aefdeca..1a53dc4dfac 100644 --- a/doc/user/packages/composer_repository/index.md +++ b/doc/user/packages/composer_repository/index.md @@ -10,6 +10,11 @@ info: To determine the technical writer assigned to the Stage/Group associated w > - [Moved](https://gitlab.com/gitlab-org/gitlab/-/issues/221259) to GitLab Free in 13.3. > - Support for Composer 2.0 [added](https://gitlab.com/gitlab-org/gitlab/-/issues/259840) in GitLab Free 13.10. +WARNING: +The Composer 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/6817) details the remaining +work and timelines to make it production ready. + Publish [Composer](https://getcomposer.org/) packages in your project's Package Registry. Then, install the packages whenever you need to use them as a dependency. diff --git a/doc/user/packages/conan_repository/index.md b/doc/user/packages/conan_repository/index.md index dc08baaf731..973cd11aea5 100644 --- a/doc/user/packages/conan_repository/index.md +++ b/doc/user/packages/conan_repository/index.md @@ -9,6 +9,11 @@ info: To determine the technical writer assigned to the Stage/Group associated w > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/8248) in GitLab Premium 12.6. > - [Moved](https://gitlab.com/gitlab-org/gitlab/-/issues/221259) to GitLab Free in 13.3. +WARNING: +The Conan 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/6816) details the remaining +work and timelines to make it production ready. + Publish Conan packages in your project's Package Registry. Then install the packages whenever you need to use them as a dependency. diff --git a/doc/user/packages/debian_repository/index.md b/doc/user/packages/debian_repository/index.md index c8939fcd00d..b4b3e8ec158 100644 --- a/doc/user/packages/debian_repository/index.md +++ b/doc/user/packages/debian_repository/index.md @@ -12,7 +12,8 @@ info: To determine the technical writer assigned to the Stage/Group associated w WARNING: The Debian package registry for GitLab is under development and isn't ready for production use due to -limited functionality. +limited functionality. 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 packages whenever you need to use them as a dependency. diff --git a/doc/user/packages/go_proxy/index.md b/doc/user/packages/go_proxy/index.md index 0c04c4a23d0..22adbf08145 100644 --- a/doc/user/packages/go_proxy/index.md +++ b/doc/user/packages/go_proxy/index.md @@ -9,10 +9,14 @@ info: To determine the technical writer assigned to the Stage/Group associated w > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/27376) in GitLab Premium 13.1. > - It's deployed behind a feature flag, disabled by default. > - It's disabled for GitLab.com. -> - It's not recommended for production use. > - To use it in GitLab self-managed instances, ask a GitLab administrator to [enable it](#enable-the-go-proxy). > - [Moved](https://gitlab.com/gitlab-org/gitlab/-/issues/221259) to GitLab Free in 13.3. +WARNING: +The Go 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/3043) details the remaining +work and timelines to make it production ready. + With the Go proxy for GitLab, every project in GitLab can be fetched with the [Go proxy protocol](https://proxy.golang.org/). diff --git a/doc/user/packages/helm_repository/index.md b/doc/user/packages/helm_repository/index.md index 5aed778d870..7c700ec0489 100644 --- a/doc/user/packages/helm_repository/index.md +++ b/doc/user/packages/helm_repository/index.md @@ -8,6 +8,11 @@ info: To determine the technical writer assigned to the Stage/Group associated w > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/18997) in GitLab 14.1. +WARNING: +The Helm chart 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/6366) details the remaining +work and timelines to make it production ready. + Publish Helm packages in your project's Package Registry. Then install the packages whenever you need to use them as a dependency. diff --git a/doc/user/packages/index.md b/doc/user/packages/index.md index 9158b5cc674..a8f1b1998ae 100644 --- a/doc/user/packages/index.md +++ b/doc/user/packages/index.md @@ -10,20 +10,31 @@ The GitLab [Package Registry](package_registry/index.md) acts as a private or pu for a variety of common package managers. You can publish and share packages, which can be easily consumed as a dependency in downstream projects. +WARNING: +Not all package manager formats are ready for production use. To view each format's status, see the +table's **Status** column. + The Package Registry supports the following formats: -| Package type | GitLab version | -| ------------ | -------------- | -| [Composer](composer_repository/index.md) | 13.2+ | -| [Conan](conan_repository/index.md) | 12.6+ | -| [Go](go_proxy/index.md) | 13.1+ | -| [Helm](helm_repository/index.md) | 14.1+ | -| [Maven](maven_repository/index.md) | 11.3+ | -| [npm](npm_registry/index.md) | 11.7+ | -| [NuGet](nuget_repository/index.md) | 12.8+ | -| [PyPI](pypi_repository/index.md) | 12.10+ | -| [Generic packages](generic_packages/index.md) | 13.5+ | -| [Ruby gems](rubygems_registry/index.md) | 13.10+ | +| Package type | GitLab version | Status | +| ------------ | -------------- |------- | +| [Maven](maven_repository/index.md) | 11.3+ | Stable | +| [npm](npm_registry/index.md) | 11.7+ | Stable | +| [NuGet](nuget_repository/index.md) | 12.8+ | Stable | +| [PyPI](pypi_repository/index.md) | 12.10+ | Stable | +| [Generic packages](generic_packages/index.md) | 13.5+ | Stable | +| [Composer](composer_repository/index.md) | 13.2+ | [Beta](https://gitlab.com/groups/gitlab-org/-/epics/6817) | +| [Conan](conan_repository/index.md) | 12.6+ | [Beta](https://gitlab.com/groups/gitlab-org/-/epics/6816) | +| [Helm](helm_repository/index.md) | 14.1+ | [Beta](https://gitlab.com/groups/gitlab-org/-/epics/6366) | +| [Debian](debian_repository/index.md) | 14.2+ | [Alpha](https://gitlab.com/groups/gitlab-org/-/epics/6057) | +| [Go](go_proxy/index.md) | 13.1+ | [Alpha](https://gitlab.com/groups/gitlab-org/-/epics/3043) | +| [Ruby gems](rubygems_registry/index.md) | 13.10+ | [Alpha](https://gitlab.com/groups/gitlab-org/-/epics/3200) | + +Status: + +- Alpha: behind a feature flag and not officially supported. +- Beta: several known issues that may prevent expected use. +- Stable: ready for production use. You can also use the [API](../../api/packages.md) to administer the Package Registry. @@ -40,12 +51,12 @@ guides you through the process. | CocoaPods | [#36890](https://gitlab.com/gitlab-org/gitlab/-/issues/36890) | | Conda | [#36891](https://gitlab.com/gitlab-org/gitlab/-/issues/36891) | | CRAN | [#36892](https://gitlab.com/gitlab-org/gitlab/-/issues/36892) | -| Debian | [Draft: Merge Request](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/50438) | | Opkg | [#36894](https://gitlab.com/gitlab-org/gitlab/-/issues/36894) | | P2 | [#36895](https://gitlab.com/gitlab-org/gitlab/-/issues/36895) | | Puppet | [#36897](https://gitlab.com/gitlab-org/gitlab/-/issues/36897) | -| RPM | [#5932](https://gitlab.com/gitlab-org/gitlab/-/issues/5932) | +| RPM | [#5932](https://gitlab.com/groups/gitlab-org/-/epics/5128) | | SBT | [#36898](https://gitlab.com/gitlab-org/gitlab/-/issues/36898) | +| Swift | [#12233](https://gitlab.com/gitlab-org/gitlab/-/issues/12233) | | Vagrant | [#36899](https://gitlab.com/gitlab-org/gitlab/-/issues/36899) | <!-- vale gitlab.Spelling = YES --> diff --git a/doc/user/packages/rubygems_registry/index.md b/doc/user/packages/rubygems_registry/index.md index 2a0fea6e0ef..61a18716dfd 100644 --- a/doc/user/packages/rubygems_registry/index.md +++ b/doc/user/packages/rubygems_registry/index.md @@ -9,8 +9,9 @@ info: To determine the technical writer assigned to the Stage/Group associated w > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/803) in [GitLab Free](https://about.gitlab.com/pricing/) 13.10. WARNING: -The Ruby gems registry for GitLab is under development and isn't ready for production use due to -limited functionality. +The Ruby gems 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/3200) details the remaining +work and timelines to make it production ready. You can publish Ruby gems in your project's Package Registry, then install the packages when you need to use them as a dependency. Although you can push gems to the registry, you cannot install diff --git a/doc/user/project/issue_board.md b/doc/user/project/issue_board.md index 4d1805e3d31..8a599608f71 100644 --- a/doc/user/project/issue_board.md +++ b/doc/user/project/issue_board.md @@ -203,17 +203,13 @@ When visiting a board, issues appear ordered in any list. You're able to change that order by dragging the issues. The changed order is saved, so that anybody who visits the same board later sees the reordering, with some exceptions. -The first time an issue appears in any board (that is, the first time a user -loads a board containing that issue), it is ordered in relation to other issues in that list. -The order is done according to [label priority](labels.md#label-priority). +When an issue is created, the system assigns a relative order value that is greater than the maximum value +of that issue's project or root group. This means the issue will be at the bottom of any issue list that +it appears in. -At this point, that issue is assigned a relative order value by the system, -with respect to the other issues in the list. Any time -you drag and reorder the issue, its relative order value changes accordingly. - -Also, any time that issue appears in any board, the ordering is done according to -the updated relative order value. It's only the first -time an issue appears that it takes from the priority order mentioned above. If a user in your GitLab instance +Any time you drag and reorder the issue, its relative order value changes accordingly. +Then, any time that issue appears in any board, the ordering is done according to +the updated relative order value. If a user in your GitLab instance drags issue `A` above issue `B`, the ordering is maintained when these two issues are subsequently loaded in any board in the same instance. This could be a different project board or a different group board, for example. diff --git a/doc/user/project/requirements/index.md b/doc/user/project/requirements/index.md index 3be3b1682bb..661bd3e0598 100644 --- a/doc/user/project/requirements/index.md +++ b/doc/user/project/requirements/index.md @@ -7,8 +7,12 @@ info: To determine the technical writer assigned to the Stage/Group associated w # Requirements Management **(ULTIMATE)** +NOTE: +In 14.4, Requirements was moved under **Issues**. + > - [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/2703) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 12.10. > - The ability to add and edit a requirement's long description [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/224622) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 13.5. +> - [Moved under Issues](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/70748) in 14.4 With requirements, you can set criteria to check your products against. They can be based on users, stakeholders, system, software, or anything else you find important to capture. @@ -38,7 +42,7 @@ Users with Reporter or higher [permissions](../../permissions.md) can create req To create a requirement: -1. In a project, go to **Requirements**. +1. In a project, go to **Issues > Requirements**. 1. Select **New requirement**. 1. Enter a title and description and select **Create requirement**. @@ -107,7 +111,7 @@ You can search for a requirement from the requirements list page based on the fo To search for a requirement: -1. In a project, go to **Requirements > List**. +1. In a project, go to **Issues > Requirements > List**. 1. Select the **Search or filter results** field. A dropdown menu appears. 1. Select the requirement author or status from the dropdown or enter plain text to search by requirement title. 1. Press <kbd>Enter</kbd> on your keyboard to filter the list. @@ -222,7 +226,7 @@ Before you import your file: To import requirements: -1. In a project, go to **Requirements**. +1. In a project, go to **Issues > Requirements**. - If the project already has existing requirements, select the import icon (**{import}**) in the top right. - For a project without any requirements, select **Import CSV** in the middle of the page. @@ -281,7 +285,7 @@ Users with Reporter or higher [permissions](../../permissions.md) can export req To export requirements: -1. In a project, go to **Requirements**. +1. In a project, go to **Issues > Requirements**. 1. In the top right, select the **Export as CSV** icon (**{export}**). A confirmation modal appears. diff --git a/lib/banzai/filter/references/milestone_reference_filter.rb b/lib/banzai/filter/references/milestone_reference_filter.rb index 94f7106d31e..609aaf885ba 100644 --- a/lib/banzai/filter/references/milestone_reference_filter.rb +++ b/lib/banzai/filter/references/milestone_reference_filter.rb @@ -5,8 +5,6 @@ module Banzai module References # HTML filter that replaces milestone references with links. class MilestoneReferenceFilter < AbstractReferenceFilter - include Gitlab::Utils::StrongMemoize - self.reference_type = :milestone self.object_class = Milestone @@ -63,21 +61,15 @@ module Banzai end def valid_context?(parent) - strong_memoize(:valid_context) do - group_context?(parent) || project_context?(parent) - end + group_context?(parent) || project_context?(parent) end def group_context?(parent) - strong_memoize(:group_context) do - parent.is_a?(Group) - end + parent.is_a?(Group) end def project_context?(parent) - strong_memoize(:project_context) do - parent.is_a?(Project) - end + parent.is_a?(Project) end def references_in(text, pattern = Milestone.reference_pattern) diff --git a/lib/gitlab/ci/badge/coverage/report.rb b/lib/gitlab/ci/badge/coverage/report.rb index 28863a0703b..78b51dbdaf0 100644 --- a/lib/gitlab/ci/badge/coverage/report.rb +++ b/lib/gitlab/ci/badge/coverage/report.rb @@ -15,7 +15,10 @@ module Gitlab::Ci @job = opts[:job] @customization = { key_width: opts[:key_width].to_i, - key_text: opts[:key_text] + key_text: opts[:key_text], + min_good: opts[:min_good].to_i, + min_acceptable: opts[:min_acceptable].to_i, + min_medium: opts[:min_medium].to_i } end diff --git a/lib/gitlab/ci/badge/coverage/template.rb b/lib/gitlab/ci/badge/coverage/template.rb index 96702420e9d..f12b4f2dbfb 100644 --- a/lib/gitlab/ci/badge/coverage/template.rb +++ b/lib/gitlab/ci/badge/coverage/template.rb @@ -16,12 +16,20 @@ module Gitlab::Ci low: '#e05d44', unknown: '#9f9f9f' }.freeze + COVERAGE_MAX = 100 + COVERAGE_MIN = 0 + MIN_GOOD_DEFAULT = 95 + MIN_ACCEPTABLE_DEFAULT = 90 + MIN_MEDIUM_DEFAULT = 75 def initialize(badge) @entity = badge.entity @status = badge.status @key_text = badge.customization.dig(:key_text) @key_width = badge.customization.dig(:key_width) + @min_good = badge.customization.dig(:min_good) + @min_acceptable = badge.customization.dig(:min_acceptable) + @min_medium = badge.customization.dig(:min_medium) end def value_text @@ -32,12 +40,36 @@ module Gitlab::Ci @status ? 54 : 58 end + def min_good_value + if @min_good && @min_good.between?(3, COVERAGE_MAX) + @min_good + else + MIN_GOOD_DEFAULT + end + end + + def min_acceptable_value + if @min_acceptable && @min_acceptable.between?(2, min_good_value - 1) + @min_acceptable + else + [MIN_ACCEPTABLE_DEFAULT, (min_good_value - 1)].min + end + end + + def min_medium_value + if @min_medium && @min_medium.between?(1, min_acceptable_value - 1) + @min_medium + else + [MIN_MEDIUM_DEFAULT, (min_acceptable_value - 1)].min + end + end + def value_color case @status - when 95..100 then STATUS_COLOR[:good] - when 90..95 then STATUS_COLOR[:acceptable] - when 75..90 then STATUS_COLOR[:medium] - when 0..75 then STATUS_COLOR[:low] + when min_good_value..COVERAGE_MAX then STATUS_COLOR[:good] + when min_acceptable_value..min_good_value then STATUS_COLOR[:acceptable] + when min_medium_value..min_acceptable_value then STATUS_COLOR[:medium] + when COVERAGE_MIN..min_medium_value then STATUS_COLOR[:low] else STATUS_COLOR[:unknown] end diff --git a/package.json b/package.json index 9031a342c98..1f12a8c64e2 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "@gitlab/favicon-overlay": "2.0.0", "@gitlab/svgs": "1.212.0", "@gitlab/tributejs": "1.0.0", - "@gitlab/ui": "32.11.1", + "@gitlab/ui": "32.11.2", "@gitlab/visual-review-tools": "1.6.1", "@rails/actioncable": "6.1.3-2", "@rails/ujs": "6.1.3-2", @@ -113,7 +113,7 @@ "codesandbox-api": "0.0.23", "compression-webpack-plugin": "^5.0.2", "copy-webpack-plugin": "^6.4.1", - "core-js": "^3.18.0", + "core-js": "^3.18.1", "cron-validator": "^1.1.1", "cropper": "^2.3.0", "css-loader": "^2.1.1", diff --git a/spec/controllers/boards/issues_controller_spec.rb b/spec/controllers/boards/issues_controller_spec.rb index cc60ab16d2e..b2200050e41 100644 --- a/spec/controllers/boards/issues_controller_spec.rb +++ b/spec/controllers/boards/issues_controller_spec.rb @@ -116,7 +116,7 @@ RSpec.describe Boards::IssuesController do it 'does not query issues table more than once' do recorder = ActiveRecord::QueryRecorder.new { list_issues(user: user, board: board, list: list1) } - query_count = recorder.occurrences.select { |query,| query.start_with?('SELECT issues.*') }.each_value.first + query_count = recorder.occurrences.select { |query,| query.match?(/FROM "?issues"?/) }.each_value.first expect(query_count).to eq(1) end diff --git a/spec/features/projects/badges/coverage_spec.rb b/spec/features/projects/badges/coverage_spec.rb index 1760ec880bc..5c1bc1ad239 100644 --- a/spec/features/projects/badges/coverage_spec.rb +++ b/spec/features/projects/badges/coverage_spec.rb @@ -12,6 +12,120 @@ RSpec.describe 'test coverage badge' do sign_in(user) end + it 'user requests coverage badge image for pipeline with custom limits - 80% good' do + create_pipeline do |pipeline| + create_build(pipeline, coverage: 80, name: 'test:1') + end + + show_test_coverage_badge(min_good: 75, min_acceptable: 50, min_medium: 25) + + expect_coverage_badge_color(:good) + expect_coverage_badge('80.00%') + end + + it 'user requests coverage badge image for pipeline with custom limits - 74% - bad config' do + create_pipeline do |pipeline| + create_build(pipeline, coverage: 74, name: 'test:1') + end + # User sets a minimum good value that is lower than min acceptable and min medium, + # in which case we force the min acceptable value to be min good -1 and min medium value to be min acceptable -1 + show_test_coverage_badge(min_good: 75, min_acceptable: 76, min_medium: 77) + + expect_coverage_badge_color(:acceptable) + expect_coverage_badge('74.00%') + end + + it 'user requests coverage badge image for pipeline with custom limits - 73% - bad config' do + create_pipeline do |pipeline| + create_build(pipeline, coverage: 73, name: 'test:1') + end + # User sets a minimum good value that is lower than min acceptable and min medium, + # in which case we force the min acceptable value to be min good -1 and min medium value to be min acceptable -1 + show_test_coverage_badge(min_good: 75, min_acceptable: 76, min_medium: 77) + + expect_coverage_badge_color(:medium) + expect_coverage_badge('73.00%') + end + + it 'user requests coverage badge image for pipeline with custom limits - 72% - partial config - low' do + create_pipeline do |pipeline| + create_build(pipeline, coverage: 72, name: 'test:1') + end + # User only sets good to 75 and leaves the others on the default settings, + # in which case we force the min acceptable value to be min good -1 and min medium value to be min acceptable -1 + show_test_coverage_badge(min_good: 75) + + expect_coverage_badge_color(:low) + expect_coverage_badge('72.00%') + end + + it 'user requests coverage badge image for pipeline with custom limits - 72% - partial config - medium' do + create_pipeline do |pipeline| + create_build(pipeline, coverage: 72, name: 'test:1') + end + # User only sets good to 74 and leaves the others on the default settings, + # in which case we force the min acceptable value to be min good -1 and min medium value to be min acceptable -1 + show_test_coverage_badge(min_good: 74) + + expect_coverage_badge_color(:medium) + expect_coverage_badge('72.00%') + end + + it 'user requests coverage badge image for pipeline with custom limits - 72% - partial config - medium v2' do + create_pipeline do |pipeline| + create_build(pipeline, coverage: 72, name: 'test:1') + end + # User only sets medium to 72 and leaves the others on the defaults good as 95 and acceptable as 90 + show_test_coverage_badge(min_medium: 72) + + expect_coverage_badge_color(:medium) + expect_coverage_badge('72.00%') + end + + it 'user requests coverage badge image for pipeline with custom limits - 70% acceptable' do + create_pipeline do |pipeline| + create_build(pipeline, coverage: 70, name: 'test:1') + end + + show_test_coverage_badge(min_good: 75, min_acceptable: 50, min_medium: 25) + + expect_coverage_badge_color(:acceptable) + expect_coverage_badge('70.00%') + end + + it 'user requests coverage badge image for pipeline with custom limits - 30% medium' do + create_pipeline do |pipeline| + create_build(pipeline, coverage: 30, name: 'test:1') + end + + show_test_coverage_badge(min_good: 75, min_acceptable: 50, min_medium: 25) + + expect_coverage_badge_color(:medium) + expect_coverage_badge('30.00%') + end + + it 'user requests coverage badge image for pipeline with custom limits - 20% low' do + create_pipeline do |pipeline| + create_build(pipeline, coverage: 20, name: 'test:1') + end + + show_test_coverage_badge(min_good: 75, min_acceptable: 50, min_medium: 25) + + expect_coverage_badge_color(:low) + expect_coverage_badge('20.00%') + end + + it 'user requests coverage badge image for pipeline with custom limits - nonsense values which use the defaults' do + create_pipeline do |pipeline| + create_build(pipeline, coverage: 92, name: 'test:1') + end + + show_test_coverage_badge(min_good: "nonsense", min_acceptable: "rubbish", min_medium: "NaN") + + expect_coverage_badge_color(:acceptable) + expect_coverage_badge('92.00%') + end + it 'user requests coverage badge image for pipeline' do create_pipeline do |pipeline| create_build(pipeline, coverage: 100, name: 'test:1') @@ -20,6 +134,7 @@ RSpec.describe 'test coverage badge' do show_test_coverage_badge + expect_coverage_badge_color(:good) expect_coverage_badge('95.00%') end @@ -32,6 +147,7 @@ RSpec.describe 'test coverage badge' do show_test_coverage_badge(job: 'coverage') + expect_coverage_badge_color(:medium) expect_coverage_badge('85.00%') end @@ -73,8 +189,9 @@ RSpec.describe 'test coverage badge' do create(:ci_build, :success, opts) end - def show_test_coverage_badge(job: nil) - visit coverage_project_badges_path(project, ref: :master, job: job, format: :svg) + def show_test_coverage_badge(job: nil, min_good: nil, min_acceptable: nil, min_medium: nil) + visit coverage_project_badges_path(project, ref: :master, job: job, min_good: min_good, + min_acceptable: min_acceptable, min_medium: min_medium, format: :svg) end def expect_coverage_badge(coverage) @@ -82,4 +199,12 @@ RSpec.describe 'test coverage badge' do expect(page.response_headers['Content-Type']).to include('image/svg+xml') expect(svg.at(%Q{text:contains("#{coverage}")})).to be_truthy end + + def expect_coverage_badge_color(color) + svg = Nokogiri::HTML(page.body) + expect(page.response_headers['Content-Type']).to include('image/svg+xml') + badge_color = svg.xpath("//path[starts-with(@d, 'M62')]")[0].attributes['fill'].to_s + expected_badge_color = Gitlab::Ci::Badge::Coverage::Template::STATUS_COLOR[color] + expect(badge_color).to eq(expected_badge_color) + end end diff --git a/spec/frontend/ide/stores/utils_spec.js b/spec/frontend/ide/stores/utils_spec.js index 79b6b66319e..a8875e0cd02 100644 --- a/spec/frontend/ide/stores/utils_spec.js +++ b/spec/frontend/ide/stores/utils_spec.js @@ -94,7 +94,7 @@ describe('Multi-file store utils', () => { { action: commitActionTypes.move, file_path: 'renamedFile', - content: null, + content: undefined, encoding: 'text', last_commit_id: undefined, previous_path: 'prevPath', diff --git a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/author_token_spec.js b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/author_token_spec.js index d3e1bfef561..14fcffd3c50 100644 --- a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/author_token_spec.js +++ b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/author_token_spec.js @@ -57,7 +57,7 @@ function createComponent(options = {}) { provide: { portalName: 'fake target', alignSuggestions: function fakeAlignSuggestions() {}, - suggestionsListClass: 'custom-class', + suggestionsListClass: () => 'custom-class', }, data() { return { ...data }; diff --git a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/base_token_spec.js b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/base_token_spec.js index eb1dbed52cc..b48621f9d87 100644 --- a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/base_token_spec.js +++ b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/base_token_spec.js @@ -67,7 +67,7 @@ function createComponent({ provide: { portalName: 'fake target', alignSuggestions: jest.fn(), - suggestionsListClass: 'custom-class', + suggestionsListClass: () => 'custom-class', }, stubs, slots, diff --git a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/branch_token_spec.js b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/branch_token_spec.js index 09eac636cae..f3e8b2d0c1b 100644 --- a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/branch_token_spec.js +++ b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/branch_token_spec.js @@ -42,7 +42,7 @@ function createComponent(options = {}) { provide: { portalName: 'fake target', alignSuggestions: function fakeAlignSuggestions() {}, - suggestionsListClass: 'custom-class', + suggestionsListClass: () => 'custom-class', }, stubs, }); diff --git a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/emoji_token_spec.js b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/emoji_token_spec.js index c2d61fd9f05..36071c900df 100644 --- a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/emoji_token_spec.js +++ b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/emoji_token_spec.js @@ -48,7 +48,7 @@ function createComponent(options = {}) { provide: { portalName: 'fake target', alignSuggestions: function fakeAlignSuggestions() {}, - suggestionsListClass: 'custom-class', + suggestionsListClass: () => 'custom-class', }, stubs, }); diff --git a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/epic_token_spec.js b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/epic_token_spec.js index 68ed46fc3a2..12649a2c430 100644 --- a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/epic_token_spec.js +++ b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/epic_token_spec.js @@ -37,7 +37,7 @@ function createComponent(options = {}) { provide: { portalName: 'fake target', alignSuggestions: function fakeAlignSuggestions() {}, - suggestionsListClass: 'custom-class', + suggestionsListClass: () => 'custom-class', }, stubs, }); diff --git a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/iteration_token_spec.js b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/iteration_token_spec.js index a609aaa1c4e..af90ee93543 100644 --- a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/iteration_token_spec.js +++ b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/iteration_token_spec.js @@ -21,7 +21,7 @@ describe('IterationToken', () => { provide: { portalName: 'fake target', alignSuggestions: function fakeAlignSuggestions() {}, - suggestionsListClass: 'custom-class', + suggestionsListClass: () => 'custom-class', }, }); diff --git a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/label_token_spec.js b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/label_token_spec.js index a348344b9dd..f55fb2836e3 100644 --- a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/label_token_spec.js +++ b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/label_token_spec.js @@ -48,7 +48,7 @@ function createComponent(options = {}) { provide: { portalName: 'fake target', alignSuggestions: function fakeAlignSuggestions() {}, - suggestionsListClass: 'custom-class', + suggestionsListClass: () => 'custom-class', }, stubs, listeners, diff --git a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/milestone_token_spec.js b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/milestone_token_spec.js index bfb593bf82d..936841651d1 100644 --- a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/milestone_token_spec.js +++ b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/milestone_token_spec.js @@ -48,7 +48,7 @@ function createComponent(options = {}) { provide: { portalName: 'fake target', alignSuggestions: function fakeAlignSuggestions() {}, - suggestionsListClass: 'custom-class', + suggestionsListClass: () => 'custom-class', }, stubs, }); diff --git a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/weight_token_spec.js b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/weight_token_spec.js index e788c742736..4277899f8db 100644 --- a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/weight_token_spec.js +++ b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/weight_token_spec.js @@ -19,7 +19,7 @@ describe('WeightToken', () => { provide: { portalName: 'fake target', alignSuggestions: function fakeAlignSuggestions() {}, - suggestionsListClass: 'custom-class', + suggestionsListClass: () => 'custom-class', }, }); diff --git a/spec/graphql/resolvers/board_list_issues_resolver_spec.rb b/spec/graphql/resolvers/board_list_issues_resolver_spec.rb index 98acd9e9516..b9ba2634c8f 100644 --- a/spec/graphql/resolvers/board_list_issues_resolver_spec.rb +++ b/spec/graphql/resolvers/board_list_issues_resolver_spec.rb @@ -35,7 +35,7 @@ RSpec.describe Resolvers::BoardListIssuesResolver do # by relative_position and then ID result = resolve_board_list_issues - expect(result.map(&:id)).to eq [issue3.id, issue1.id, issue2.id, issue4.id] + expect(result.map(&:id)).to eq [issue1.id, issue3.id, issue2.id, issue4.id] expect(result.map(&:relative_position)).not_to include(nil) end diff --git a/spec/graphql/resolvers/issues_resolver_spec.rb b/spec/graphql/resolvers/issues_resolver_spec.rb index 8d64379beea..3a7c778da62 100644 --- a/spec/graphql/resolvers/issues_resolver_spec.rb +++ b/spec/graphql/resolvers/issues_resolver_spec.rb @@ -338,7 +338,7 @@ RSpec.describe Resolvers::IssuesResolver do let_it_be(:relative_issue4) { create(:issue, project: project, relative_position: nil) } it 'sorts issues ascending' do - expect(resolve_issues(sort: :relative_position_asc).to_a).to eq [relative_issue3, relative_issue1, relative_issue4, relative_issue2] + expect(resolve_issues(sort: :relative_position_asc).to_a).to eq [relative_issue3, relative_issue1, relative_issue2, relative_issue4] end end diff --git a/spec/lib/banzai/filter/references/milestone_reference_filter_spec.rb b/spec/lib/banzai/filter/references/milestone_reference_filter_spec.rb index cdf6110dd6c..c21a9339ebb 100644 --- a/spec/lib/banzai/filter/references/milestone_reference_filter_spec.rb +++ b/spec/lib/banzai/filter/references/milestone_reference_filter_spec.rb @@ -437,6 +437,19 @@ RSpec.describe Banzai::Filter::References::MilestoneReferenceFilter do expect(reference_filter(act, context).to_html).to eq exp end end + + context 'when referencing both project and group milestones' do + let(:milestone) { create(:milestone, project: project) } + let(:group_milestone) { create(:milestone, title: 'group_milestone', group: group) } + + it 'links to valid references' do + links = reference_filter("See #{milestone.to_reference(full: true)} and #{group_milestone.to_reference}", context).css('a') + + expect(links.length).to eq(2) + expect(links[0].attr('href')).to eq(urls.milestone_url(milestone)) + expect(links[1].attr('href')).to eq(urls.milestone_url(group_milestone)) + end + end end context 'when milestone is open' do diff --git a/spec/lib/gitlab/import_export/json/streaming_serializer_spec.rb b/spec/lib/gitlab/import_export/json/streaming_serializer_spec.rb index b63f9acb279..f54a57f806e 100644 --- a/spec/lib/gitlab/import_export/json/streaming_serializer_spec.rb +++ b/spec/lib/gitlab/import_export/json/streaming_serializer_spec.rb @@ -115,7 +115,7 @@ RSpec.describe Gitlab::ImportExport::Json::StreamingSerializer do end it 'orders exported issues by custom column(relative_position)' do - expected_issues = exportable.issues.order_relative_position_desc.order(id: :desc).map(&:to_json) + expected_issues = exportable.issues.reorder(::Gitlab::Database.nulls_first_order('relative_position', 'DESC')).order(id: :desc).map(&:to_json) expect(json_writer).to receive(:write_relation_array).with(exportable_path, :issues, expected_issues) diff --git a/spec/lib/gitlab/pagination/keyset/iterator_spec.rb b/spec/lib/gitlab/pagination/keyset/iterator_spec.rb index d8e79287745..c6d34d43264 100644 --- a/spec/lib/gitlab/pagination/keyset/iterator_spec.rb +++ b/spec/lib/gitlab/pagination/keyset/iterator_spec.rb @@ -73,7 +73,7 @@ RSpec.describe Gitlab::Pagination::Keyset::Iterator do iterator.each_batch(of: 2) { |rel| positions.concat(rel.pluck(:relative_position, :id)) } - expect(positions).to eq(project.issues.order_relative_position_asc.order(id: :asc).pluck(:relative_position, :id)) + expect(positions).to eq(project.issues.reorder(::Gitlab::Database.nulls_last_order('relative_position', 'ASC')).order(id: :asc).pluck(:relative_position, :id)) end end @@ -85,7 +85,7 @@ RSpec.describe Gitlab::Pagination::Keyset::Iterator do iterator.each_batch(of: 2) { |rel| positions.concat(rel.pluck(:relative_position, :id)) } - expect(positions).to eq(project.issues.order_relative_position_desc.order(id: :desc).pluck(:relative_position, :id)) + expect(positions).to eq(project.issues.reorder(::Gitlab::Database.nulls_first_order('relative_position', 'DESC')).order(id: :desc).pluck(:relative_position, :id)) end end diff --git a/spec/migrations/20210907211557_finalize_ci_builds_bigint_conversion_spec.rb b/spec/migrations/20210907211557_finalize_ci_builds_bigint_conversion_spec.rb new file mode 100644 index 00000000000..362b4be1bc6 --- /dev/null +++ b/spec/migrations/20210907211557_finalize_ci_builds_bigint_conversion_spec.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +require 'spec_helper' +require_migration!('finalize_ci_builds_bigint_conversion') + +RSpec.describe FinalizeCiBuildsBigintConversion, :migration, schema: 20210907182359 do + context 'with an unexpected FK fk_3f0c88d7dc' do + it 'removes the FK and migrates successfully' do + # Add the unexpected FK + subject.add_foreign_key(:ci_sources_pipelines, :ci_builds, column: :source_job_id, name: 'fk_3f0c88d7dc') + + expect { migrate! }.to change { subject.foreign_key_exists?(:ci_sources_pipelines, :ci_builds, column: :source_job_id, name: 'fk_3f0c88d7dc') }.from(true).to(false) + + # Additional check: The actually expected FK should still exist + expect(subject.foreign_key_exists?(:ci_sources_pipelines, :ci_builds, column: :source_job_id, name: 'fk_be5624bf37')).to be_truthy + end + end +end diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb index d3d5a429a91..3f5a0c364a5 100644 --- a/spec/models/issue_spec.rb +++ b/spec/models/issue_spec.rb @@ -222,17 +222,15 @@ RSpec.describe Issue do end end - describe '#order_by_position_and_priority' do + describe '#order_by_relative_position' do let(:project) { reusable_project } - let(:p1) { create(:label, title: 'P1', project: project, priority: 1) } - let(:p2) { create(:label, title: 'P2', project: project, priority: 2) } - let!(:issue1) { create(:labeled_issue, project: project, labels: [p1]) } - let!(:issue2) { create(:labeled_issue, project: project, labels: [p2]) } + let!(:issue1) { create(:issue, project: project) } + let!(:issue2) { create(:issue, project: project) } let!(:issue3) { create(:issue, project: project, relative_position: -200) } let!(:issue4) { create(:issue, project: project, relative_position: -100) } it 'returns ordered list' do - expect(project.issues.order_by_position_and_priority) + expect(project.issues.order_by_relative_position) .to match [issue3, issue4, issue1, issue2] end end diff --git a/spec/requests/api/graphql/project/issues_spec.rb b/spec/requests/api/graphql/project/issues_spec.rb index 82c207a0918..0ac6d0fbc56 100644 --- a/spec/requests/api/graphql/project/issues_spec.rb +++ b/spec/requests/api/graphql/project/issues_spec.rb @@ -233,7 +233,7 @@ RSpec.describe 'getting an issue list for a project' do let(:all_records) do [ relative_issue5.iid, relative_issue3.iid, relative_issue1.iid, - relative_issue4.iid, relative_issue2.iid + relative_issue2.iid, relative_issue4.iid ] end end diff --git a/spec/support/database/cross-join-allowlist.yml b/spec/support/database/cross-join-allowlist.yml index 52318ea2232..d8990043fa7 100644 --- a/spec/support/database/cross-join-allowlist.yml +++ b/spec/support/database/cross-join-allowlist.yml @@ -63,6 +63,7 @@ - "./spec/lib/api/entities/package_spec.rb" - "./spec/lib/gitlab/background_migration/migrate_legacy_artifacts_spec.rb" - "./spec/mailers/emails/pipelines_spec.rb" +- "./spec/migrations/20210907211557_finalize_ci_builds_bigint_conversion_spec.rb" - "./spec/migrations/cleanup_legacy_artifact_migration_spec.rb" - "./spec/migrations/migrate_protected_attribute_to_pending_builds_spec.rb" - "./spec/migrations/re_schedule_latest_pipeline_id_population_with_all_security_related_artifact_types_spec.rb" diff --git a/spec/workers/issue_placement_worker_spec.rb b/spec/workers/issue_placement_worker_spec.rb index 780790dbb1b..50b9d58a5b0 100644 --- a/spec/workers/issue_placement_worker_spec.rb +++ b/spec/workers/issue_placement_worker_spec.rb @@ -27,7 +27,7 @@ RSpec.describe IssuePlacementWorker do it 'places all issues created at most 5 minutes before this one at the end, most recent last' do expect { run_worker }.not_to change { irrelevant.reset.relative_position } - expect(project.issues.order_relative_position_asc) + expect(project.issues.order_by_relative_position) .to eq([issue_e, issue_b, issue_a, issue, issue_c, issue_f, issue_d]) expect(project.issues.where(relative_position: nil)).not_to exist end diff --git a/yarn.lock b/yarn.lock index cea91b72c52..f137af92592 100644 --- a/yarn.lock +++ b/yarn.lock @@ -974,10 +974,10 @@ resolved "https://registry.yarnpkg.com/@gitlab/tributejs/-/tributejs-1.0.0.tgz#672befa222aeffc83e7d799b0500a7a4418e59b8" integrity sha512-nmKw1+hB6MHvlmPz63yPwVs1qQkycHwsKgxpEbzmky16Y6mL4EJMk3w1b8QlOAF/AIAzjCERPhe/R4MJiohbZw== -"@gitlab/ui@32.11.1": - version "32.11.1" - resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-32.11.1.tgz#05b1587cb3df06abdebe9f06d744c5f18c90a0bb" - integrity sha512-LzqEA2aiaqN39qwqNw039Hv9abFsYZJu0RpXikx6/OKCYwVRvynja7oRMwkB2Q+xLOb7YfOoQweWUk1jo6hElw== +"@gitlab/ui@32.11.2": + version "32.11.2" + resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-32.11.2.tgz#c18456543700b84ec473eccf9871a75d416984cb" + integrity sha512-taJ7aLAt8xG2NB9Rwgve9u+BGn788wgsEe6wjx4crEEWJ3EemXr/zmTe6kzSgo+n/zjZfFBRLl0vjUWCj5ylSQ== dependencies: "@babel/standalone" "^7.0.0" bootstrap-vue "2.18.1" @@ -3819,10 +3819,10 @@ core-js-pure@^3.0.0: resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.6.5.tgz#c79e75f5e38dbc85a662d91eea52b8256d53b813" integrity sha512-lacdXOimsiD0QyNf9BC/mxivNJ/ybBGJXQFKzRekp1WTHoVUWsUHEn+2T8GJAzzIhyOuXA+gOxCVN3l+5PLPUA== -core-js@^3.18.0: - version "3.18.0" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.18.0.tgz#9af3f4a6df9ba3428a3fb1b171f1503b3f40cc49" - integrity sha512-WJeQqq6jOYgVgg4NrXKL0KLQhi0CT4ZOCvFL+3CQ5o7I6J8HkT5wd53EadMfqTDp1so/MT1J+w2ujhWcCJtN7w== +core-js@^3.18.1: + version "3.18.1" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.18.1.tgz#289d4be2ce0085d40fc1244c0b1a54c00454622f" + integrity sha512-vJlUi/7YdlCZeL6fXvWNaLUPh/id12WXj3MbkMw5uOyF0PfWPBNOCNbs53YqgrvtujLNlt9JQpruyIKkUZ+PKA== core-js@~2.3.0: version "2.3.0" |