diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-23 21:10:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-23 21:10:06 +0300 |
commit | 4a6e6c740b131b6291d553fcdab5a0612f8c099b (patch) | |
tree | c9b31140b4161e25f5395447272187e344ea9ca1 | |
parent | 228eb2ee910e2fb7f9bedf713c43a30c55cf3314 (diff) |
Add latest changes from gitlab-org/gitlab@master
59 files changed, 236 insertions, 146 deletions
diff --git a/.gitlab/issue_templates/Design Sprint.md b/.gitlab/issue_templates/Design Sprint.md index 06ef7dc9abc..7772c2d5803 100644 --- a/.gitlab/issue_templates/Design Sprint.md +++ b/.gitlab/issue_templates/Design Sprint.md @@ -1,5 +1,9 @@ <!-- Title: Design Sprint --> +This template outlines a sample set-up process, activities and deliverables for running a Remote Design Sprint. The specific activities and deliverables should be customized based on your objectives and timeline. + +Please refer to the [Remote Design Sprint Handbook page](#anchor-tag-to-handbook-page) for additional recommendations. + ## Design Sprint Focus * [ ] Have you [determined that a Design Sprint is appropriate for this project](#anchor-tag-to-handbook-page)? <!-- What is the focus of the [Design Sprint](https://about.gitlab.com/handbook/product/product-processes/#design-sprint)? What problem area will you be solving for and who is the target user? --> diff --git a/.rubocop_manual_todo.yml b/.rubocop_manual_todo.yml index 5f39d50e557..7c861ff4f25 100644 --- a/.rubocop_manual_todo.yml +++ b/.rubocop_manual_todo.yml @@ -180,74 +180,6 @@ Graphql/OldTypes: - 'ee/app/graphql/types/dast_site_profile_type.rb' - 'ee/app/graphql/types/dast_site_validation_type.rb' - 'ee/app/graphql/types/dora_metric_type.rb' - - 'ee/app/graphql/types/epic_descendant_count_type.rb' - - 'ee/app/graphql/types/epic_descendant_weight_sum_type.rb' - - 'ee/app/graphql/types/epic_health_status_type.rb' - - 'ee/app/graphql/types/epic_issue_type.rb' - - 'ee/app/graphql/types/epic_type.rb' - - 'ee/app/graphql/types/epics/negated_epic_filter_input_type.rb' - - 'ee/app/graphql/types/external_issue_type.rb' - - 'ee/app/graphql/types/geo/geo_node_type.rb' - - 'ee/app/graphql/types/geo/group_wiki_repository_registry_type.rb' - - 'ee/app/graphql/types/geo/lfs_object_registry_type.rb' - - 'ee/app/graphql/types/geo/merge_request_diff_registry_type.rb' - - 'ee/app/graphql/types/geo/package_file_registry_type.rb' - - 'ee/app/graphql/types/geo/pipeline_artifact_registry_type.rb' - - 'ee/app/graphql/types/geo/registry_type.rb' - - 'ee/app/graphql/types/geo/snippet_repository_registry_type.rb' - - 'ee/app/graphql/types/geo/terraform_state_version_registry_type.rb' - - 'ee/app/graphql/types/group_release_stats_type.rb' - - 'ee/app/graphql/types/incident_management/escalation_policy_type.rb' - - 'ee/app/graphql/types/incident_management/escalation_rule_input_type.rb' - - 'ee/app/graphql/types/incident_management/escalation_rule_type.rb' - - 'ee/app/graphql/types/incident_management/oncall_participant_type.rb' - - 'ee/app/graphql/types/incident_management/oncall_rotation_active_period_input_type.rb' - - 'ee/app/graphql/types/incident_management/oncall_rotation_active_period_type.rb' - - 'ee/app/graphql/types/incident_management/oncall_rotation_date_input_type.rb' - - 'ee/app/graphql/types/incident_management/oncall_rotation_length_input_type.rb' - - 'ee/app/graphql/types/incident_management/oncall_rotation_type.rb' - - 'ee/app/graphql/types/incident_management/oncall_schedule_type.rb' - - 'ee/app/graphql/types/incident_management/oncall_user_input_type.rb' - - 'ee/app/graphql/types/iteration_type.rb' - - 'ee/app/graphql/types/iterations/cadence_type.rb' - - 'ee/app/graphql/types/kas/agent_configuration_type.rb' - - 'ee/app/graphql/types/metric_image_type.rb' - - 'ee/app/graphql/types/network_policy_type.rb' - - 'ee/app/graphql/types/path_lock_type.rb' - - 'ee/app/graphql/types/push_rules_type.rb' - - 'ee/app/graphql/types/requirements_management/requirement_states_count_type.rb' - - 'ee/app/graphql/types/requirements_management/requirement_type.rb' - - 'ee/app/graphql/types/requirements_management/test_report_type.rb' - - 'ee/app/graphql/types/scan_execution_policy_type.rb' - - 'ee/app/graphql/types/scan_type.rb' - - 'ee/app/graphql/types/scanned_resource_type.rb' - - 'ee/app/graphql/types/security_report_summary_section_type.rb' - - 'ee/app/graphql/types/timebox_metrics_type.rb' - - 'ee/app/graphql/types/vulnerabilities_count_by_day_type.rb' - - 'ee/app/graphql/types/vulnerability/issue_link_type.rb' - - 'ee/app/graphql/types/vulnerability_details/base_type.rb' - - 'ee/app/graphql/types/vulnerability_details/boolean_type.rb' - - 'ee/app/graphql/types/vulnerability_details/code_type.rb' - - 'ee/app/graphql/types/vulnerability_details/commit_type.rb' - - 'ee/app/graphql/types/vulnerability_details/diff_type.rb' - - 'ee/app/graphql/types/vulnerability_details/file_location_type.rb' - - 'ee/app/graphql/types/vulnerability_details/int_type.rb' - - 'ee/app/graphql/types/vulnerability_details/markdown_type.rb' - - 'ee/app/graphql/types/vulnerability_details/module_location_type.rb' - - 'ee/app/graphql/types/vulnerability_details/text_type.rb' - - 'ee/app/graphql/types/vulnerability_details/url_type.rb' - - 'ee/app/graphql/types/vulnerability_identifier_type.rb' - - 'ee/app/graphql/types/vulnerability_location/container_scanning_type.rb' - - 'ee/app/graphql/types/vulnerability_location/coverage_fuzzing_type.rb' - - 'ee/app/graphql/types/vulnerability_location/dast_type.rb' - - 'ee/app/graphql/types/vulnerability_location/dependency_scanning_type.rb' - - 'ee/app/graphql/types/vulnerability_location/sast_type.rb' - - 'ee/app/graphql/types/vulnerability_location/secret_detection_type.rb' - - 'ee/app/graphql/types/vulnerability_scanner_type.rb' - - 'ee/app/graphql/types/vulnerability_type.rb' - - 'ee/app/graphql/types/vulnerable_dependency_type.rb' - - 'ee/app/graphql/types/vulnerable_package_type.rb' - - 'ee/app/graphql/types/vulnerable_projects_by_grade_type.rb' # WIP: See https://gitlab.com/gitlab-org/gitlab/-/issues/220040 Rails/SaveBang: @@ -488,7 +488,7 @@ gem 'flipper', '~> 0.21.0' gem 'flipper-active_record', '~> 0.21.0' gem 'flipper-active_support_cache_store', '~> 0.21.0' gem 'unleash', '~> 0.1.5' -gem 'gitlab-experiment', '~> 0.6.1' +gem 'gitlab-experiment', '~> 0.6.2' # Structured logging gem 'lograge', '~> 0.5' diff --git a/Gemfile.lock b/Gemfile.lock index b27a1ceef56..37333d4e595 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -208,7 +208,7 @@ GEM concord (0.1.5) adamantium (~> 0.2.0) equalizer (~> 0.0.9) - concurrent-ruby (1.1.8) + concurrent-ruby (1.1.9) connection_pool (2.2.2) contracts (0.11.0) cork (0.3.0) @@ -471,7 +471,7 @@ GEM gitlab-dangerfiles (2.2.2) danger (>= 8.3.1) danger-gitlab (>= 8.0.0) - gitlab-experiment (0.6.1) + gitlab-experiment (0.6.2) activesupport (>= 3.0) request_store (>= 1.0) scientist (~> 1.6, >= 1.6.0) @@ -1486,7 +1486,7 @@ DEPENDENCIES github-markup (~> 1.7.0) gitlab-chronic (~> 0.10.5) gitlab-dangerfiles (~> 2.2.2) - gitlab-experiment (~> 0.6.1) + gitlab-experiment (~> 0.6.2) gitlab-fog-azure-rm (~> 1.1.1) gitlab-labkit (~> 0.20.0) gitlab-license (~> 2.0) diff --git a/app/experiments/new_project_readme_content_experiment.rb b/app/experiments/new_project_readme_content_experiment.rb index f86803db093..d9f0fb3b93e 100644 --- a/app/experiments/new_project_readme_content_experiment.rb +++ b/app/experiments/new_project_readme_content_experiment.rb @@ -19,7 +19,7 @@ class NewProjectReadmeContentExperiment < ApplicationExperiment # rubocop:disabl end def redirect(to_url) - experiment_redirect_url(self, to_url) + experiment_redirect_url(self, url: to_url) end private diff --git a/config/initializers/gitlab_experiment.rb b/config/initializers/gitlab_experiment.rb index 40c706ea922..5582c642b3c 100644 --- a/config/initializers/gitlab_experiment.rb +++ b/config/initializers/gitlab_experiment.rb @@ -1,11 +1,64 @@ # frozen_string_literal: true Gitlab::Experiment.configure do |config| + # The base experiment class that will be instantiated when using the + # `experiment` DSL, is our ApplicationExperiment. If a custom experiment + # class is resolvable by the experiment name, that will be instantiated + # instead -- which can then inherit from whatever else it wants to. + # + # Custom experiment classes can be defined in /app/experiments. + # config.base_class = 'ApplicationExperiment' + + # Mount the engine and middleware at a gitlab friendly style path. + # + # The middleware currently focuses only on handling redirection logic, which + # is used for instrumenting urls in places where urls are otherwise not + # possible to instrument. Emails, and markdown content being among the top + # places where this can be useful. + # config.mount_at = '/-/experiment' + + # We use a long lived redis cache to increase the performance of experiments. + # + # Experiments can implement exclusionary and segmentation logic that can be + # expensive, and so to better handle these cases, once a variant is assigned + # to a given context, it's "sticky" to that context. This cache check is one + # of the first things in the process of variant resolution, and so if one is + # cached, no further logic is executed in resolving variant assignment. + # + # This means that there's no easy way to currently move a context from one + # variant to another. Future tooling will make this easier, but implementing + # a custom cache for your experiment may be required in edge cases. + # config.cache = Gitlab::Experiment::Cache::RedisHashStore.new( - pool: ->(&block) { Gitlab::Redis::SharedState.with { |redis| block.call(redis) } } + pool: ->(&block) { Gitlab::Redis::SharedState.with(&block) } ) + + # The middleware instruments and redirects urls, but we don't want this to be + # exploited or used to send people from a trusted site to a nefarious one. So + # we validate urls before redirecting them. + # + # This behavior doesn't make perfect sense for self managed installs either, + # so we don't think we should redirect in those cases. + # + valid_domains = %w[about.gitlab.com docs.gitlab.com gitlab.com] + config.redirect_url_validator = lambda do |url| + Gitlab.dev_env_or_com? && (url = URI.parse(url)) && valid_domains.include?(url.host) + rescue URI::InvalidURIError + false + end + + # Experiments are instrumented using an event based system by default. This + # can be overridden in your experiment by specifying a `#track` method. + # + # The basic behavior though, is to accept any details and pass them along to + # snowplow, with an included gitlab_experiment schema, that has various + # details about the experiment, like name and variant assignment. + # + # This uses the Gitlab::Tracking interface, so arbitrary event properties are + # permitted, and will be sent along using Gitlab::Tracking::StandardContext. + # config.tracking_behavior = lambda do |action, event_args| Gitlab::Tracking.event(name, action.to_s, **event_args.merge( context: (event_args[:context] || []) << SnowplowTracker::SelfDescribingJson.new( diff --git a/doc/administration/geo/disaster_recovery/background_verification.md b/doc/administration/geo/disaster_recovery/background_verification.md index f03cd64c14e..01251b01bc7 100644 --- a/doc/administration/geo/disaster_recovery/background_verification.md +++ b/doc/administration/geo/disaster_recovery/background_verification.md @@ -198,7 +198,7 @@ nodes, and comparing the output between them. In GitLab EE 12.1, Geo calculates checksums for attachments, LFS objects, and archived traces on secondary nodes after the transfer, compares it with the -stored checksums, and rejects transfers if mismatched. Please note that Geo +stored checksums, and rejects transfers if mismatched. Geo currently does not support an automatic way to verify these data if they have been synced before GitLab EE 12.1. diff --git a/doc/administration/geo/replication/configuration.md b/doc/administration/geo/replication/configuration.md index e8ffa1ae91a..7331b032c52 100644 --- a/doc/administration/geo/replication/configuration.md +++ b/doc/administration/geo/replication/configuration.md @@ -286,9 +286,9 @@ The two most obvious issues that can become apparent in the dashboard are: - You are using a custom certificate or custom CA (see the [troubleshooting document](troubleshooting.md)). - The instance is firewalled (check your firewall rules). -Please note that disabling a **secondary** node stops the synchronization process. +Disabling a **secondary** node stops the synchronization process. -Please note that if `git_data_dirs` is customized on the **primary** node for multiple +If `git_data_dirs` is customized on the **primary** node for multiple repository shards you must duplicate the same configuration on each **secondary** node. Point your users to the [Using a Geo Site guide](usage.md). diff --git a/doc/administration/postgresql/replication_and_failover.md b/doc/administration/postgresql/replication_and_failover.md index d1dd233f08b..513c4784a8f 100644 --- a/doc/administration/postgresql/replication_and_failover.md +++ b/doc/administration/postgresql/replication_and_failover.md @@ -497,7 +497,7 @@ Here is a list and description of each machine and the assigned IP: All passwords are set to `toomanysecrets`, please do not use this password or derived hashes and the `external_url` for GitLab is `http://gitlab.example.com`. -Please note that after the initial configuration, if a failover occurs, the PostgresSQL master will change to one of the available secondaries until it is failed back. +After the initial configuration, if a failover occurs, the PostgresSQL master will change to one of the available secondaries until it is failed back. #### Example recommended setup for Consul servers @@ -628,7 +628,7 @@ All passwords are set to `toomanysecrets`, please do not use this password or de The `external_url` for GitLab is `http://gitlab.example.com` -Please note that after the initial configuration, if a failover occurs, the PostgresSQL master will change to one of the available secondaries until it is failed back. +After the initial configuration, if a failover occurs, the PostgresSQL master will change to one of the available secondaries until it is failed back. #### Example minimal configuration for database servers diff --git a/doc/administration/redis/replication_and_failover.md b/doc/administration/redis/replication_and_failover.md index 37d586b1d32..850cccbf103 100644 --- a/doc/administration/redis/replication_and_failover.md +++ b/doc/administration/redis/replication_and_failover.md @@ -106,7 +106,7 @@ is not initiated. As an example, if you have `6` Redis nodes, a maximum of `3` can be simultaneously down. -Please note that there are different requirements for Sentinel nodes. +There are different requirements for Sentinel nodes. If you host them in the same Redis machines, you may need to take that restrictions into consideration when calculating the amount of nodes to be provisioned. See [Sentinel setup overview](#sentinel-setup-overview) @@ -539,7 +539,7 @@ Here is a list and description of each **machine** and the assigned **IP**: - `10.0.0.3`: Redis Replica 2 + Sentinel 3 - `10.0.0.4`: GitLab application -Please note that after the initial configuration, if a failover is initiated +After the initial configuration, if a failover is initiated by the Sentinel nodes, the Redis nodes are reconfigured and the **Primary** changes permanently (including in `redis.conf`) from one node to the other, until a new failover is initiated again. diff --git a/doc/administration/redis/replication_and_failover_external.md b/doc/administration/redis/replication_and_failover_external.md index 65ec8eb50e5..234b1aa7fb9 100644 --- a/doc/administration/redis/replication_and_failover_external.md +++ b/doc/administration/redis/replication_and_failover_external.md @@ -260,7 +260,7 @@ Here is a list and description of each **machine** and the assigned **IP**: - `10.0.0.3`: Redis Replica 2 + Sentinel 3 - `10.0.0.4`: GitLab application -Please note that after the initial configuration, if a failover is initiated +After the initial configuration, if a failover is initiated by the Sentinel nodes, the Redis nodes are reconfigured and the **Primary** changes permanently (including in `redis.conf`) from one node to the other, until a new failover is initiated again. diff --git a/doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md b/doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md index 08755dd3285..7537ccfded0 100644 --- a/doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md +++ b/doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md @@ -16,7 +16,7 @@ and your [support options](https://about.gitlab.com/support/), before attempting this information. WARNING: -Please note that some of these scripts could be damaging if not run correctly, +Some of these scripts could be damaging if not run correctly, or under the right conditions. We highly recommend running them under the guidance of a Support Engineer, or running them in a test environment with a backup of the instance ready to be restored, just in case. diff --git a/doc/api/users.md b/doc/api/users.md index 0d922487cf9..e074bd44c7a 100644 --- a/doc/api/users.md +++ b/doc/api/users.md @@ -1757,7 +1757,7 @@ Example response: ] ``` -Please note that `last_activity_at` is deprecated, please use `last_activity_on`. +`last_activity_at` is deprecated. Use `last_activity_on` instead. ## User memberships (admin only) diff --git a/doc/ci/triggers/index.md b/doc/ci/triggers/index.md index 383887bd389..880473d402d 100644 --- a/doc/ci/triggers/index.md +++ b/doc/ci/triggers/index.md @@ -205,7 +205,7 @@ file. The parameter is of the form: variables[key]=value ``` -This information is also exposed in the UI. Please note that _values_ are only viewable by Owners and Maintainers. +This information is also exposed in the UI. _Values_ are only viewable by users with the Owner and Maintainer role. ![Job variables in UI](img/trigger_variables.png) diff --git a/doc/development/audit_event_guide/index.md b/doc/development/audit_event_guide/index.md index f809293df59..65a7fa0ae90 100644 --- a/doc/development/audit_event_guide/index.md +++ b/doc/development/audit_event_guide/index.md @@ -83,7 +83,7 @@ def audit_remove(model) end ``` -Please note that this method does not support actions that are asynchronous, or +This method does not support actions that are asynchronous, or span across multiple processes (for example, background jobs). ### Using standard method call to record single event diff --git a/doc/development/avoiding_downtime_in_migrations.md b/doc/development/avoiding_downtime_in_migrations.md index 7f0f62a08bd..b844415c94e 100644 --- a/doc/development/avoiding_downtime_in_migrations.md +++ b/doc/development/avoiding_downtime_in_migrations.md @@ -47,6 +47,9 @@ Multiple columns can be ignored, too: ignore_columns %i[updated_at created_at], remove_with: '12.7', remove_after: '2020-01-22' ``` +If the model exists in CE and EE, the column has to be ignored in the CE model. If the +model only exists in EE, then it has to be added there. + We require indication of when it is safe to remove the column ignore with: - `remove_with`: set to a GitLab release typically two releases (M+2) after adding the diff --git a/doc/development/cicd/index.md b/doc/development/cicd/index.md index 091a7b5112f..a5ab0faaadd 100644 --- a/doc/development/cicd/index.md +++ b/doc/development/cicd/index.md @@ -159,7 +159,7 @@ On top of that, we have the following types of jobs: - `Ci::Bridge` ... The job to trigger a downstream pipeline. - `GenericCommitStatus` ... The job to be executed in an external CI/CD system e.g. Jenkins. -Please note that, when you use the "Job" terminology in codebase, readers would +When you use the "Job" terminology in codebase, readers would assume that the class/object is any type of above. If you specifically refer `Ci::Build` class, you should not name the object/class as "job" as this could cause some confusions. In documentation, diff --git a/doc/development/code_review.md b/doc/development/code_review.md index 8bea8f6f491..86522e571a3 100644 --- a/doc/development/code_review.md +++ b/doc/development/code_review.md @@ -125,7 +125,7 @@ with [domain expertise](#domain-experts). 1. If your merge request includes an addition of, or changes to a [Feature spec](testing_guide/testing_levels.md#frontend-feature-tests), it must be **approved by a [Quality maintainer](https://about.gitlab.com/handbook/engineering/projects/#gitlab_maintainers_qa) or [Quality reviewer](https://about.gitlab.com/handbook/engineering/projects/#gitlab_reviewers_qa)**. 1. If your merge request introduces a new service to GitLab (Puma, Sidekiq, Gitaly are examples), it must be **approved by a [product manager](https://about.gitlab.com/company/team/)**. See the [process for adding a service component to GitLab](adding_service_component.md) for details. -- (*1*): Please note that specs other than JavaScript specs are considered backend code. +- (*1*): Specs other than JavaScript specs are considered backend code. - (*2*): We encourage you to seek guidance from a database maintainer if your merge request is potentially introducing expensive queries. It is most efficient to comment on the line of code in question with the SQL queries so they can give their advice. diff --git a/doc/development/contributing/merge_request_workflow.md b/doc/development/contributing/merge_request_workflow.md index 5e7cccd8e13..534150e4d37 100644 --- a/doc/development/contributing/merge_request_workflow.md +++ b/doc/development/contributing/merge_request_workflow.md @@ -12,7 +12,7 @@ to GitLab code, tests, and documentation. The issues that are specifically suita for community contributions are listed with the [`Accepting merge requests`](issue_workflow.md#label-for-community-contributors) label, but you are free to contribute to any issue you want. -Please note that if an issue is marked for the current milestone at any time, even +If an issue is marked for the current milestone at any time, even when you are working on it, a GitLab Inc. team member may take over the merge request in order to ensure the work is finished before the release date. diff --git a/doc/development/database/constraint_naming_convention.md b/doc/development/database/constraint_naming_convention.md index debf74d3b40..3faef8aee09 100644 --- a/doc/development/database/constraint_naming_convention.md +++ b/doc/development/database/constraint_naming_convention.md @@ -9,7 +9,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w The most common option is to let Rails pick the name for database constraints and indexes or let PostgreSQL use the defaults (when applicable). However, when needing to define custom names in Rails or working in Go applications where no ORM is used, it is important to follow strict naming conventions to improve consistency and discoverability. The table below describes the naming conventions for custom PostgreSQL constraints. -Please note that the intent is not to retroactively change names in existing databases but rather ensure consistency of future changes. +The intent is not to retroactively change names in existing databases but rather ensure consistency of future changes. | Type | Syntax | Notes | Examples | |--------------------------|---------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------| diff --git a/doc/development/distributed_tracing.md b/doc/development/distributed_tracing.md index 8bd8599a0b0..f8184a562ec 100644 --- a/doc/development/distributed_tracing.md +++ b/doc/development/distributed_tracing.md @@ -101,7 +101,7 @@ trace in a hierarchical time-line. ## Using Jaeger without the GitLab Developer Kit Distributed Tracing can be enabled in non-GDK development environments as well as production or -staging environments, for troubleshooting. Please note that at this time, this functionality is +staging environments, for troubleshooting. At this time, this functionality is experimental, and not supported in production environments at present. In this first release, it is intended to be used for debugging in development environments only. diff --git a/doc/development/emails.md b/doc/development/emails.md index c1054077f9e..f99b914e2de 100644 --- a/doc/development/emails.md +++ b/doc/development/emails.md @@ -26,7 +26,7 @@ mailer.unknown_sign_in_email(user, ip, time).deliver_later To view rendered emails "sent" in your development instance, visit [`/rails/letter_opener`](http://localhost:3000/rails/letter_opener). -Please note that [S/MIME signed](../administration/smime_signing_email.md) emails +[S/MIME signed](../administration/smime_signing_email.md) emails [cannot be currently previewed](https://github.com/fgrehm/letter_opener_web/issues/96) with `letter_opener`. @@ -125,7 +125,7 @@ Examples of valid email keys: - `1234567890abcdef1234567890abcdef-unsubscribe` (unsubscribe from a conversation) - `1234567890abcdef1234567890abcdef` (reply to a conversation) -Please note that the action `-issue-` is used in GitLab as the handler for the Service Desk feature. +The action `-issue-` is used in GitLab as the handler for the Service Desk feature. ### Legacy format @@ -137,7 +137,7 @@ These are the only valid legacy formats for an email handler: - `namespace` - `namespace+action` -Please note that `path/to/project` is used in GitLab as the handler for the Service Desk feature. +In GitLab, the handler for the Service Desk feature is `path/to/project`. --- diff --git a/doc/development/fe_guide/design_anti_patterns.md b/doc/development/fe_guide/design_anti_patterns.md index 0db0e8db2c6..9e602b1ea04 100644 --- a/doc/development/fe_guide/design_anti_patterns.md +++ b/doc/development/fe_guide/design_anti_patterns.md @@ -12,7 +12,8 @@ generally be avoided. Throughout the GitLab codebase, there may be historic uses of these anti-patterns. Please [use discretion](https://about.gitlab.com/handbook/engineering/#balance-refactoring-and-velocity) when figuring out whether or not to refactor, when touching code that uses one of these legacy patterns. -**Please note:** For new features, anti-patterns are not necessarily prohibited, but it is **strongly suggested** to find another approach. +NOTE: +For new features, anti-patterns are not necessarily prohibited, but it is **strongly suggested** to find another approach. ## Shared Global Object (Anti-pattern) diff --git a/doc/development/fe_guide/design_patterns.md b/doc/development/fe_guide/design_patterns.md index c769d0767e7..03575f7e7f9 100644 --- a/doc/development/fe_guide/design_patterns.md +++ b/doc/development/fe_guide/design_patterns.md @@ -9,7 +9,8 @@ info: To determine the technical writer assigned to the Stage/Group associated w The following design patterns are suggested approaches for solving common problems. Use discretion when evaluating if a certain pattern makes sense in your situation. Just because it is a pattern, doesn't mean it is a good one for your problem. -**Please note:** When adding a design pattern to this document, be sure to clearly state the **problem it solves**. +NOTE: +When adding a design pattern to this document, be sure to clearly state the **problem it solves**. ## TBD diff --git a/doc/development/fe_guide/graphql.md b/doc/development/fe_guide/graphql.md index 7fa9e957f56..3b49601f027 100644 --- a/doc/development/fe_guide/graphql.md +++ b/doc/development/fe_guide/graphql.md @@ -110,7 +110,7 @@ Default client accepts two parameters: `resolvers` and `config`. If you are make multiple queries to the same Apollo client object you might encounter the following error: "Store error: the application attempted to write an object with no provided ID but the store already contains an ID of SomeEntity". [This error only should occur when you have made a query with an ID field for a portion, then made another that returns what would be the same object, but is missing the ID field.](https://github.com/apollographql/apollo-client/issues/2510#issue-271829009) -Please note this is being tracked in [this issue](https://gitlab.com/gitlab-org/gitlab/-/issues/326101) and the documentation will be updated when this issue is resolved. +This is being tracked in [this issue](https://gitlab.com/gitlab-org/gitlab/-/issues/326101) and the documentation will be updated when this issue is resolved. ## GraphQL Queries diff --git a/doc/development/fe_guide/troubleshooting.md b/doc/development/fe_guide/troubleshooting.md index 028184e0397..14943cca3ac 100644 --- a/doc/development/fe_guide/troubleshooting.md +++ b/doc/development/fe_guide/troubleshooting.md @@ -38,7 +38,7 @@ See [this video](https://youtu.be/-BkEhghP-kM) for an in-depth overview and inve + expect(wrapper.findComponent(ChildComponent).props()).toMatchObject(...); ``` -Please note that `toMatchObject` actually changes the nature of the assertion and won't fail if some items are **missing** from the expectation. +`toMatchObject` actually changes the nature of the assertion and won't fail if some items are **missing** from the expectation. ### Script issues diff --git a/doc/development/github_importer.md b/doc/development/github_importer.md index a733d6881fa..91df33e6d95 100644 --- a/doc/development/github_importer.md +++ b/doc/development/github_importer.md @@ -69,7 +69,23 @@ don't need to perform this work in parallel. This worker imports all pull requests. For every pull request a job for the `Gitlab::GithubImport::ImportPullRequestWorker` worker is scheduled. -### 5. Stage::ImportIssuesAndDiffNotesWorker +### 5. Stage::ImportPullRequestsMergedByWorker + +This worker imports the pull requests' _merged-by_ user information. The [_List pull +requests_](https://docs.github.com/en/rest/reference/pulls#list-pull-requests) +API doesn't provide this information. Therefore, this stage must fetch each merged pull request +individually to import this information. A +`Gitlab::GithubImport::ImportPullRequestMergedByWorker` job is scheduled for each fetched pull +request. + +### 6. Stage::ImportPullRequestsReviewsWorker + +This worker imports the pull requests' reviews. For each pull request, this worker: + +- Fetches all the pages of reviews. +- Schedules a `Gitlab::GithubImport::ImportPullRequestReviewWorker` job for each fetched review. + +### 7. Stage::ImportIssuesAndDiffNotesWorker This worker imports all issues and pull request comments. For every issue, we schedule a job for the `Gitlab::GithubImport::ImportIssueWorker` worker. For @@ -85,7 +101,7 @@ label links in the same worker removes the need for performing a separate crawl through the API data, reducing the number of API calls necessary to import a project. -### 6. Stage::ImportNotesWorker +### 8. Stage::ImportNotesWorker This worker imports regular comments for both issues and pull requests. For every comment, we schedule a job for the @@ -96,7 +112,7 @@ returns comments for both issues and pull requests. This means we have to wait for all issues and pull requests to be imported before we can import regular comments. -### 7. Stage::FinishImportWorker +### 9. Stage::FinishImportWorker This worker completes the import process by performing some housekeeping (such as flushing any caches) and by marking the import as completed. diff --git a/doc/development/i18n/proofreader.md b/doc/development/i18n/proofreader.md index 6e3b32e18df..68ab6399cb8 100644 --- a/doc/development/i18n/proofreader.md +++ b/doc/development/i18n/proofreader.md @@ -80,6 +80,7 @@ are very appreciative of the work done by translators and proofreaders! - Chang-Ho Cha - [GitLab](https://gitlab.com/changho-cha), [CrowdIn](https://crowdin.com/profile/zzazang) - Ji Hun Oh - [GitLab](https://gitlab.com/Baw-Appie), [CrowdIn](https://crowdin.com/profile/BawAppie) - Jeongwhan Choi - [GitLab](https://gitlab.com/jeongwhanchoi), [CrowdIn](https://crowdin.com/profile/jeongwhanchoi) + - Sunjung Park - [GitLab](https://gitlab.com/sunjungp), [CrowdIn](https://crowdin.com/profile/sunjungp) - Mongolian - Proofreaders needed. - Norwegian Bokmal diff --git a/doc/development/service_ping/index.md b/doc/development/service_ping/index.md index 8df67889dac..82b2386a8e6 100644 --- a/doc/development/service_ping/index.md +++ b/doc/development/service_ping/index.md @@ -1028,6 +1028,19 @@ Add the metric in one of the top level keys - `counts_monthly`: for counters that have data for the most recent 28 days. - `counts`: for counters that have data for all time. +#### How to get a metric name suggestion + +The metric YAML generator can suggest a metric name for you. To generate a metric name suggestion, +first instrument the metric at the provided `key_path`, generate the metrics YAML definition, then +return to the instrumentation and update it. + +1. Add the metric instrumentation within `lib/gitlab/usage_data.rb` inside one + of the [top level keys](index.md#1-naming-and-placing-the-metrics) using any name you choose. +1. Run the [metrics YAML generator](metrics_dictionary.md#metrics-definition-and-validation). +1. Use the metric name suggestion to select a suitable metric name. +1. Update the instrumentation you created in the first step and change the metric name to the suggested name. +1. Update the metric's YAML definition with the correct `key_path`. + ### 2. Use your Rails console to manually test counters ```ruby diff --git a/doc/development/service_ping/review_guidelines.md b/doc/development/service_ping/review_guidelines.md index 0b8f10b0ade..1f2f355832c 100644 --- a/doc/development/service_ping/review_guidelines.md +++ b/doc/development/service_ping/review_guidelines.md @@ -51,6 +51,8 @@ any of the following Service Ping files: - Perform a first-pass review on the merge request and suggest improvements to the author. - Check the [metrics location](index.md#1-naming-and-placing-the-metrics) in the Service Ping JSON payload. +- Suggest that the author checks the [naming suggestion](index.md#how-to-get-a-metric-name-suggestion) while + generating the metric's YAML definition. - Add the `~database` label and ask for a [database review](../database_review.md) for metrics that are based on Database. - For tracking using Redis HLL (HyperLogLog): diff --git a/doc/development/testing_guide/end_to_end/index.md b/doc/development/testing_guide/end_to_end/index.md index eca649b73a5..f4b01c64385 100644 --- a/doc/development/testing_guide/end_to_end/index.md +++ b/doc/development/testing_guide/end_to_end/index.md @@ -91,7 +91,7 @@ subgraph "`gitlab-org/gitlab-qa-mirror` pipeline" 1. The result of the [`gitlab-org/gitlab-qa-mirror` pipeline](https://gitlab.com/gitlab-org/gitlab-qa-mirror) is being propagated upstream (through polling from upstream pipelines), through [`gitlab-org/build/omnibus-gitlab-mirror`](https://gitlab.com/gitlab-org/build/omnibus-gitlab-mirror), back to the [`gitlab-org/gitlab`](https://gitlab.com/gitlab-org/gitlab) merge request. -Please note, we plan to [add more specific information](https://gitlab.com/gitlab-org/quality/team-tasks/-/issues/156) +We plan to [add more specific information](https://gitlab.com/gitlab-org/quality/team-tasks/-/issues/156) about the tests included in each job/scenario that runs in `gitlab-org/gitlab-qa-mirror`. NOTE: diff --git a/doc/development/testing_guide/end_to_end/running_tests_that_require_special_setup.md b/doc/development/testing_guide/end_to_end/running_tests_that_require_special_setup.md index f200d6c682a..46a3053c267 100644 --- a/doc/development/testing_guide/end_to_end/running_tests_that_require_special_setup.md +++ b/doc/development/testing_guide/end_to_end/running_tests_that_require_special_setup.md @@ -432,7 +432,7 @@ To run the LDAP tests on your local with TLS enabled, follow these steps: `127.0.0.1 gitlab.test` - You can then run tests against GitLab in a Docker container on `https://gitlab.test`. Please note that the TLS certificate [checked into the GitLab-QA repository](https://gitlab.com/gitlab-org/gitlab-qa/-/tree/9ffb9ad3be847a9054967d792d6772a74220fb42/tls_certificates/gitlab) is configured for this domain. + You can then run tests against GitLab in a Docker container on `https://gitlab.test`. The TLS certificate [checked into the GitLab-QA repository](https://gitlab.com/gitlab-org/gitlab-qa/-/tree/9ffb9ad3be847a9054967d792d6772a74220fb42/tls_certificates/gitlab) is configured for this domain. 1. Run the OpenLDAP container with TLS enabled. Change the path to [`gitlab-qa/fixtures/ldap`](https://gitlab.com/gitlab-org/gitlab-qa/-/tree/9ffb9ad3be847a9054967d792d6772a74220fb42/fixtures/ldap) directory to your local checkout path: ```shell diff --git a/doc/integration/elasticsearch.md b/doc/integration/elasticsearch.md index 23ca57cb8b8..20b66411a7e 100644 --- a/doc/integration/elasticsearch.md +++ b/doc/integration/elasticsearch.md @@ -238,7 +238,7 @@ The following Elasticsearch settings are available: | `Password` | The password of your Elasticsearch instance. | | `Number of Elasticsearch shards` | Elasticsearch indexes are split into multiple shards for performance reasons. In general, you should use at least 5 shards, and indexes with tens of millions of documents need to have more shards ([see below](#guidance-on-choosing-optimal-cluster-configuration)). Changes to this value do not take effect until the index is recreated. You can read more about tradeoffs in the [Elasticsearch documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/scalability.html). | | `Number of Elasticsearch replicas` | Each Elasticsearch shard can have a number of replicas. These are a complete copy of the shard, and can provide increased query performance or resilience against hardware failure. Increasing this value will greatly increase total disk space required by the index. | -| `Limit namespaces and projects that can be indexed` | Enabling this will allow you to select namespaces and projects to index. All other namespaces and projects will use database search instead. Please note that if you enable this option but do not select any namespaces or projects, none will be indexed. [Read more below](#limiting-namespaces-and-projects). +| `Limit namespaces and projects that can be indexed` | Enabling this will allow you to select namespaces and projects to index. All other namespaces and projects will use database search instead. If you enable this option but do not select any namespaces or projects, none will be indexed. [Read more below](#limiting-namespaces-and-projects). | `Using AWS hosted Elasticsearch with IAM credentials` | Sign your Elasticsearch requests using [AWS IAM authorization](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html), [AWS EC2 Instance Profile Credentials](https://docs.aws.amazon.com/codedeploy/latest/userguide/getting-started-create-iam-instance-profile.html#getting-started-create-iam-instance-profile-cli), or [AWS ECS Tasks Credentials](https://docs.aws.amazon.com/AmazonECS/latest/userguide/task-iam-roles.html). Please refer to [Identity and Access Management in Amazon Elasticsearch Service](https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-ac.html) for details of AWS hosted Elasticsearch domain access policy configuration. | | `AWS Region` | The AWS region in which your Elasticsearch service is located. | | `AWS Access Key` | The AWS access key. | @@ -567,7 +567,7 @@ For basic guidance on choosing a cluster configuration you may refer to [Elastic ### Advanced Search integration settings guidance -- The `Number of Elasticsearch shards` setting usually corresponds with the number of CPUs available in your cluster. For example, if you have a 3-node cluster with 4 cores each, this means you will benefit from having at least 3*4=12 shards in the cluster. Please note, it's only possible to change the shards number by using [Split index API](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-split-index.html) or by reindexing to a different index with a changed number of shards. +- The `Number of Elasticsearch shards` setting usually corresponds with the number of CPUs available in your cluster. For example, if you have a 3-node cluster with 4 cores each, this means you will benefit from having at least 3*4=12 shards in the cluster. It's only possible to change the shards number by using [Split index API](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-split-index.html) or by reindexing to a different index with a changed number of shards. - The `Number of Elasticsearch replicas` setting should most of the time be equal to `1` (each shard will have 1 replica). Using `0` is not recommended, because losing one node will corrupt the index. ### Indexing large instances diff --git a/doc/integration/saml.md b/doc/integration/saml.md index 8e34f115072..ee3e2f574c7 100644 --- a/doc/integration/saml.md +++ b/doc/integration/saml.md @@ -707,7 +707,7 @@ Examples: - [Auth0](https://auth0.com/docs/protocols/saml-protocol/configure-auth0-as-saml-identity-provider) - [PingOne by Ping Identity](https://docs.pingidentity.com/bundle/pingone/page/xsh1564020480660-1.html) -Please note that GitLab provides the following setup notes for guidance only. +GitLab provides the following setup notes for guidance only. If you have any questions on configuring the SAML app, please contact your provider's support. ### Okta setup notes diff --git a/doc/user/admin_area/moderate_users.md b/doc/user/admin_area/moderate_users.md index 1e3f5863acd..25d2d2f24ea 100644 --- a/doc/user/admin_area/moderate_users.md +++ b/doc/user/admin_area/moderate_users.md @@ -144,7 +144,7 @@ A user can be deactivated from the Admin Area. To do this: 1. Select the **{settings}** **User administration** dropdown. 1. Select **Deactivate**. -Please note that for the deactivation option to be visible to an admin, the user: +For the deactivation option to be visible to an admin, the user: - Must be currently active. - Must not have signed in, or have any activity, in the last 90 days. diff --git a/doc/user/application_security/index.md b/doc/user/application_security/index.md index 616d2f8c790..3b0725021ef 100644 --- a/doc/user/application_security/index.md +++ b/doc/user/application_security/index.md @@ -114,7 +114,7 @@ rules: If you add the security scanning jobs as described in [Security scanning with Auto DevOps](#security-scanning-with-auto-devops) or [Security scanning without Auto DevOps](#security-scanning-without-auto-devops) to your `.gitlab-ci.yml` each added [security scanning tool](#security-scanning-tools) behave as described below. -For each compatible analyzer, a job is created in the `test`, `dast` or `fuzz` stage of your pipeline and runs on the next new branch pipeline. Features such as the [Security Dashboard](security_dashboard/index.md), [Vulnerability Report](vulnerability_report/index.md), and [Dependency List](dependency_list/index.md) that rely on this scan data only show results from pipelines on the default branch. Please note that one tool may use many analyzers. +For each compatible analyzer, a job is created in the `test`, `dast` or `fuzz` stage of your pipeline and runs on the next new branch pipeline. Features such as the [Security Dashboard](security_dashboard/index.md), [Vulnerability Report](vulnerability_report/index.md), and [Dependency List](dependency_list/index.md) that rely on this scan data only show results from pipelines on the default branch. One tool might use many analyzers. Our language and package manager specific jobs attempt to assess which analyzer(s) they should run for your project so that you can do less configuration. diff --git a/doc/user/application_security/offline_deployments/index.md b/doc/user/application_security/offline_deployments/index.md index d87da15b4b0..64de53fe51f 100644 --- a/doc/user/application_security/offline_deployments/index.md +++ b/doc/user/application_security/offline_deployments/index.md @@ -61,7 +61,7 @@ mirroring the packages inside your own offline network. Once a vulnerability is found, you can interact with it. Read more on how to [address the vulnerabilities](../vulnerabilities/index.md). -Please note that in some cases the reported vulnerabilities provide metadata that can contain +In some cases the reported vulnerabilities provide metadata that can contain external links exposed in the UI. These links might not be accessible within an offline environment. ### Resolving vulnerabilities diff --git a/doc/user/group/saml_sso/index.md b/doc/user/group/saml_sso/index.md index c3b57018154..66a961cefb8 100644 --- a/doc/user/group/saml_sso/index.md +++ b/doc/user/group/saml_sso/index.md @@ -91,7 +91,7 @@ After you set up your identity provider to work with GitLab, you must configure ![Group SAML Settings for GitLab.com](img/group_saml_settings_v13_12.png) NOTE: -Please note that the certificate [fingerprint algorithm](../../../integration/saml.md#notes-on-configuring-your-identity-provider) must be in SHA1. When configuring the identity provider, use a secure signature algorithm. +The certificate [fingerprint algorithm](../../../integration/saml.md#notes-on-configuring-your-identity-provider) must be in SHA1. When configuring the identity provider, use a secure signature algorithm. ### SSO enforcement @@ -128,15 +128,15 @@ When [configuring your identity provider](#configuring-your-identity-provider), For providers not listed below, you can refer to the [instance SAML notes on configuring an identity provider](../../../integration/saml.md#notes-on-configuring-your-identity-provider) for additional guidance on information your identity provider may require. -Please note that GitLab provides the following for guidance only. +GitLab provides the following information for guidance only. If you have any questions on configuring the SAML app, please contact your provider's support. ### Azure setup notes -Please follow the Azure documentation on [configuring single sign-on to applications](https://docs.microsoft.com/en-us/azure/active-directory/manage-apps/view-applications-portal) with the notes below for consideration. +Follow the Azure documentation on [configuring single sign-on to applications](https://docs.microsoft.com/en-us/azure/active-directory/manage-apps/view-applications-portal) with the notes below for consideration. <i class="fa fa-youtube-play youtube" aria-hidden="true"></i> -For a demo of the Azure SAML setup including SCIM, see [SCIM Provisioning on Azure Using SAML SSO for Groups Demo](https://youtu.be/24-ZxmTeEBU). Please note that the video is outdated in regard to +For a demo of the Azure SAML setup including SCIM, see [SCIM Provisioning on Azure Using SAML SSO for Groups Demo](https://youtu.be/24-ZxmTeEBU). The video is outdated in regard to objectID mapping and the [SCIM documentation should be followed](scim_setup.md#azure-configuration-steps). | GitLab Setting | Azure Field | diff --git a/doc/user/group/settings/import_export.md b/doc/user/group/settings/import_export.md index 5f732bee03f..4ed781b82cb 100644 --- a/doc/user/group/settings/import_export.md +++ b/doc/user/group/settings/import_export.md @@ -138,4 +138,4 @@ To help avoid abuse, by default, users are rate limited to: | Download export | 1 download per group per minute | | Import | 6 groups per minute | -Please note that GitLab.com may have [different settings](../../gitlab_com/index.md#importexport) from the defaults. +GitLab.com may have [different settings](../../gitlab_com/index.md#importexport) from the defaults. diff --git a/doc/user/project/highlighting.md b/doc/user/project/highlighting.md index aa8cf4549e2..a9e87e8ea94 100644 --- a/doc/user/project/highlighting.md +++ b/doc/user/project/highlighting.md @@ -44,7 +44,7 @@ To disable highlighting entirely, use `gitlab-language=text`. Lots more fun shen /other-file gitlab-language=text?token=Error ``` -Please note that these configurations only take effect when the `.gitattributes` +These configurations only take effect when the `.gitattributes` file is in your [default branch](repository/branches/default.md). NOTE: diff --git a/doc/user/project/integrations/bamboo.md b/doc/user/project/integrations/bamboo.md index 1eb8a8c60e0..64a11ac3532 100644 --- a/doc/user/project/integrations/bamboo.md +++ b/doc/user/project/integrations/bamboo.md @@ -55,7 +55,7 @@ service in GitLab. 1. If necessary, enter username and password for a Bamboo user that has access to trigger the build plan. Leave these fields blank if you do not require authentication. -1. Save or optionally click **Test Settings**. Please note that **Test Settings** +1. Save or optionally click **Test Settings**. **Test Settings** actually triggers a build in Bamboo. ## Troubleshooting diff --git a/doc/user/project/settings/import_export.md b/doc/user/project/settings/import_export.md index d5fdb86c9b0..32f7fee0287 100644 --- a/doc/user/project/settings/import_export.md +++ b/doc/user/project/settings/import_export.md @@ -209,4 +209,4 @@ To help avoid abuse, by default, users are rate limited to: | Download export | 1 download per group per minute | | Import | 6 projects per minute | -Please note that GitLab.com may have [different settings](../../gitlab_com/index.md#importexport) from the defaults. +GitLab.com may have [different settings](../../gitlab_com/index.md#importexport) from the defaults. diff --git a/doc/user/project/web_ide/index.md b/doc/user/project/web_ide/index.md index 80490887c4a..59773c625c5 100644 --- a/doc/user/project/web_ide/index.md +++ b/doc/user/project/web_ide/index.md @@ -454,7 +454,7 @@ when: The Web IDE has a few limitations: -- Interactive Terminals is in a beta phase and continues to be improved in upcoming releases. In the meantime, please note that the user is limited to having only one +- Interactive Terminals is in a beta phase and continues to be improved in upcoming releases. In the meantime, the user is limited to having only one active terminal at a time. - LFS files can be rendered and displayed but they cannot be updated and committed using the Web IDE. If an LFS file is modified and pushed to the repository, the LFS pointer in the repository is overwritten with the modified LFS file content. diff --git a/lib/gitlab/ci/ansi2html.rb b/lib/gitlab/ci/ansi2html.rb index 97988d8aa13..ef936581c10 100644 --- a/lib/gitlab/ci/ansi2html.rb +++ b/lib/gitlab/ci/ansi2html.rb @@ -33,6 +33,8 @@ module Gitlab Result = Struct.new(:html, :state, :append, :truncated, :offset, :size, :total, keyword_init: true) # rubocop:disable Lint/StructNewOverride class Converter + include EncodingHelper + def on_0(_) reset end @@ -256,6 +258,7 @@ module Gitlab start_offset = @offset stream.each_line do |line| + line = encode_utf8_no_detect(line) s = StringScanner.new(line) until s.eos? diff --git a/lib/gitlab/ci/ansi2json/line.rb b/lib/gitlab/ci/ansi2json/line.rb index 40bd101d0f8..e48080993ab 100644 --- a/lib/gitlab/ci/ansi2json/line.rb +++ b/lib/gitlab/ci/ansi2json/line.rb @@ -9,6 +9,8 @@ module Gitlab # Line::Segment is a portion of a line that has its own style # and text. Multiple segments make the line content. class Segment + include EncodingHelper + attr_accessor :text, :style def initialize(style:) @@ -21,19 +23,15 @@ module Gitlab end def to_h - { text: encode_text(text) }.tap do |result| + # Without forcing the encoding to UTF-8 and then replacing + # invalid UTF-8 sequences we can get an error when serializing + # the Hash to JSON. + # Encoding::UndefinedConversionError: + # "\xE2" from ASCII-8BIT to UTF-8 + { text: encode_utf8_no_detect(text) }.tap do |result| result[:style] = style.to_s if style.set? end end - - # Without forcing the encoding to UTF-8 and then dropping - # invalid UTF-8 sequences we can get an error when serializing - # the Hash to JSON. - # Encoding::UndefinedConversionError: - # "\xE2" from ASCII-8BIT to UTF-8 - def encode_text(text) - text.force_encoding(Encoding::UTF_8).encode(Encoding::UTF_8, invalid: :replace, undef: :replace) - end end attr_reader :offset, :sections, :segments, :current_segment, diff --git a/lib/gitlab/encoding_helper.rb b/lib/gitlab/encoding_helper.rb index 8ee53d0de28..50e7631d983 100644 --- a/lib/gitlab/encoding_helper.rb +++ b/lib/gitlab/encoding_helper.rb @@ -64,6 +64,15 @@ module Gitlab detect && detect[:type] == :binary end + # This is like encode_utf8 except we skip autodetection of the encoding. We + # assume the data must be interpreted as UTF-8. + def encode_utf8_no_detect(message) + message = force_encode_utf8(message) + return message if message.valid_encoding? + + message.encode(Encoding::UTF_8, invalid: :replace, undef: :replace) + end + def encode_utf8(message, replace: "") message = force_encode_utf8(message) return message if message.valid_encoding? diff --git a/lib/gitlab/graphql/copy_field_description.rb b/lib/gitlab/graphql/copy_field_description.rb index edd73083ff2..ed2273bc91a 100644 --- a/lib/gitlab/graphql/copy_field_description.rb +++ b/lib/gitlab/graphql/copy_field_description.rb @@ -11,7 +11,7 @@ module Gitlab # are always identical to the corresponding query field descriptions. # # E.g.: - # argument :name, GraphQL::STRING_TYPE, description: copy_field_description(Types::UserType, :name) + # argument :name, GraphQL::Types::String, description: copy_field_description(Types::UserType, :name) def copy_field_description(type, field_name) type.fields[field_name.to_s.camelize(:lower)].description end diff --git a/lib/gitlab/graphql/markdown_field.rb b/lib/gitlab/graphql/markdown_field.rb index 0b5bde8d8d9..6188d860aba 100644 --- a/lib/gitlab/graphql/markdown_field.rb +++ b/lib/gitlab/graphql/markdown_field.rb @@ -19,7 +19,7 @@ module Gitlab # Adding complexity to rendered notes since that could cause queries. kwargs[:complexity] ||= 5 - field name, GraphQL::STRING_TYPE, **kwargs + field name, GraphQL::Types::String, **kwargs define_method resolver_method do # We need to `dup` the context so the MarkdownHelper doesn't modify it diff --git a/rubocop/cop/graphql/descriptions.rb b/rubocop/cop/graphql/descriptions.rb index 520e34dcd16..a93ebf20e1b 100644 --- a/rubocop/cop/graphql/descriptions.rb +++ b/rubocop/cop/graphql/descriptions.rb @@ -7,16 +7,16 @@ # # # bad # class AwfulType -# field :some_field, GraphQL::STRING_TYPE +# field :some_field, GraphQL::Types::String # end # # class TerribleType -# argument :some_argument, GraphQL::STRING_TYPE +# argument :some_argument, GraphQL::Types::String # end # # class UngoodType # field :some_argument, -# GraphQL::STRING_TYPE, +# GraphQL::Types::String, # description: "A description that does not end in a period" # end # @@ -27,11 +27,11 @@ # # good # class GreatType # argument :some_field, -# GraphQL::STRING_TYPE, +# GraphQL::Types::String, # description: "Well described - a superb description." # # field :some_field, -# GraphQL::STRING_TYPE, +# GraphQL::Types::String, # description: "A thorough and compelling description." # end # diff --git a/rubocop/cop/graphql/id_type.rb b/rubocop/cop/graphql/id_type.rb index 0d2fb6ad852..ba973242efa 100644 --- a/rubocop/cop/graphql/id_type.rb +++ b/rubocop/cop/graphql/id_type.rb @@ -4,12 +4,12 @@ module RuboCop module Cop module Graphql class IDType < RuboCop::Cop::Cop - MSG = 'Do not use GraphQL::ID_TYPE, use a specific GlobalIDType instead' + MSG = 'Do not use GraphQL::Types::ID, use a specific GlobalIDType instead' WHITELISTED_ARGUMENTS = %i[iid full_path project_path group_path target_project_path namespace_path].freeze def_node_search :graphql_id_type?, <<~PATTERN - (send nil? :argument (_ #does_not_match?) (const (const nil? :GraphQL) :ID_TYPE) ...) + (send nil? :argument (_ #does_not_match?) (const (const (const nil? :GraphQL) :Types) :ID) ...) PATTERN def on_send(node) diff --git a/rubocop/cop/graphql/json_type.rb b/rubocop/cop/graphql/json_type.rb index a8c38358535..8518a771cbd 100644 --- a/rubocop/cop/graphql/json_type.rb +++ b/rubocop/cop/graphql/json_type.rb @@ -12,7 +12,7 @@ # # # good # class GreatClass -# field :some_field, GraphQL::STRING_TYPE +# field :some_field, GraphQL::Types::String # end module RuboCop diff --git a/rubocop/cop/graphql/resolver_type.rb b/rubocop/cop/graphql/resolver_type.rb index 1209c5dbc6b..e9fa768fd3e 100644 --- a/rubocop/cop/graphql/resolver_type.rb +++ b/rubocop/cop/graphql/resolver_type.rb @@ -7,7 +7,7 @@ # # bad # module Resolvers # class NoTypeResolver < BaseResolver -# field :some_field, GraphQL::STRING_TYPE +# field :some_field, GraphQL::Types::String # end # end # @@ -16,7 +16,7 @@ # class WithTypeResolver < BaseResolver # type MyType, null: true # -# field :some_field, GraphQL::STRING_TYPE +# field :some_field, GraphQL::Types::String # end # end diff --git a/spec/deprecation_toolkit_env.rb b/spec/deprecation_toolkit_env.rb index 8e06dcb8c75..37ff7bafc54 100644 --- a/spec/deprecation_toolkit_env.rb +++ b/spec/deprecation_toolkit_env.rb @@ -57,6 +57,7 @@ module DeprecationToolkitEnv %w[ asciidoctor-2.0.12/lib/asciidoctor/extensions.rb gitlab-labkit-0.20.0/lib/labkit/correlation/grpc/client_interceptor.rb + actionpack-6.1.3.2/lib/action_dispatch/routing/route_set.rb ] end diff --git a/spec/experiments/application_experiment_spec.rb b/spec/experiments/application_experiment_spec.rb index 9c03910cf66..4966e508f7e 100644 --- a/spec/experiments/application_experiment_spec.rb +++ b/spec/experiments/application_experiment_spec.rb @@ -209,6 +209,35 @@ RSpec.describe ApplicationExperiment, :experiment do end end + describe "#process_redirect_url" do + using RSpec::Parameterized::TableSyntax + + where(:url, :processed_url) do + 'https://about.gitlab.com/' | 'https://about.gitlab.com/' + 'https://gitlab.com/' | 'https://gitlab.com/' + 'http://docs.gitlab.com' | 'http://docs.gitlab.com' + 'https://docs.gitlab.com/some/path?foo=bar' | 'https://docs.gitlab.com/some/path?foo=bar' + 'http://badgitlab.com' | nil + 'https://gitlab.com.nefarious.net' | nil + 'https://unknown.gitlab.com' | nil + "https://badplace.com\nhttps://gitlab.com" | nil + 'https://gitlabbcom' | nil + 'https://gitlabbcom/' | nil + end + + with_them do + it "returns the url or nil if invalid" do + allow(Gitlab).to receive(:dev_env_or_com?).and_return(true) + expect(subject.process_redirect_url(url)).to eq(processed_url) + end + + it "considers all urls invalid when not on dev or com" do + allow(Gitlab).to receive(:dev_env_or_com?).and_return(false) + expect(subject.process_redirect_url(url)).to be_nil + end + end + end + context "when resolving variants" do it "uses the default value as specified in the yaml" do expect(Feature).to receive(:enabled?).with('namespaced_stub', subject, type: :experiment, default_enabled: :yaml) diff --git a/spec/experiments/new_project_readme_content_experiment_spec.rb b/spec/experiments/new_project_readme_content_experiment_spec.rb index 92a883078df..f76b8a1ded1 100644 --- a/spec/experiments/new_project_readme_content_experiment_spec.rb +++ b/spec/experiments/new_project_readme_content_experiment_spec.rb @@ -30,7 +30,9 @@ RSpec.describe NewProjectReadmeContentExperiment, :experiment do end it "renders redirect URLs" do - expect(markdown).to include(Rails.application.routes.url_helpers.experiment_redirect_url(subject, initial_url)) + expect(markdown).to include( + Rails.application.routes.url_helpers.experiment_redirect_url(subject, url: initial_url) + ) end end end diff --git a/spec/lib/gitlab/ci/ansi2html_spec.rb b/spec/lib/gitlab/ci/ansi2html_spec.rb index bf1f2bae7da..27c2b005a93 100644 --- a/spec/lib/gitlab/ci/ansi2html_spec.rb +++ b/spec/lib/gitlab/ci/ansi2html_spec.rb @@ -150,6 +150,10 @@ RSpec.describe Gitlab::Ci::Ansi2html do expect(convert_html("\r\n")).to eq('<span><br/></span>') end + it 'replaces invalid UTF-8 data' do + expect(convert_html("UTF-8 dashes here: āāā\nš¤š¤š¤š¤\xF0\x9F\x90\n")).to eq("<span>UTF-8 dashes here: āāā<br/>š¤š¤š¤š¤ļæ½<br/></span>") + end + describe "incremental update" do shared_examples 'stateable converter' do let(:pass1_stream) { StringIO.new(pre_text) } diff --git a/spec/lib/gitlab/encoding_helper_spec.rb b/spec/lib/gitlab/encoding_helper_spec.rb index cf0d1577314..268ac5dcc21 100644 --- a/spec/lib/gitlab/encoding_helper_spec.rb +++ b/spec/lib/gitlab/encoding_helper_spec.rb @@ -3,6 +3,8 @@ require "spec_helper" RSpec.describe Gitlab::EncodingHelper do + using RSpec::Parameterized::TableSyntax + let(:ext_class) { Class.new { extend Gitlab::EncodingHelper } } let(:binary_string) { File.read(Rails.root + "spec/fixtures/dk.png") } @@ -90,6 +92,22 @@ RSpec.describe Gitlab::EncodingHelper do end end + describe '#encode_utf8_no_detect' do + where(:input, :expected) do + "abcd" | "abcd" + "Ē²Ē²Ē²" | "Ē²Ē²Ē²" + "\xC7\xB2\xC7Ē²Ē²Ē²" | "Ē²ļæ½Ē²Ē²Ē²" + "š¤š¤š¤š¤\xF0\x9F\x90" | "š¤š¤š¤š¤ļæ½" + end + + with_them do + it 'drops invalid UTF-8' do + expect(ext_class.encode_utf8_no_detect(input.dup.force_encoding(Encoding::ASCII_8BIT))).to eq(expected) + expect(ext_class.encode_utf8_no_detect(input)).to eq(expected) + end + end + end + describe '#encode_utf8' do [ ["nil", nil, nil], diff --git a/spec/lib/gitlab/graphql/markdown_field_spec.rb b/spec/lib/gitlab/graphql/markdown_field_spec.rb index 44ca23f547c..a3fb0bbbed8 100644 --- a/spec/lib/gitlab/graphql/markdown_field_spec.rb +++ b/spec/lib/gitlab/graphql/markdown_field_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Gitlab::Graphql::MarkdownField do expect(field.name).to eq('testHtml') expect(field.description).to eq('The GitLab Flavored Markdown rendering of `hello`') - expect(field.type).to eq(GraphQL::STRING_TYPE) + expect(field.type).to eq(GraphQL::Types::String) expect(field.to_graphql.complexity).to eq(5) end diff --git a/spec/rubocop/cop/graphql/id_type_spec.rb b/spec/rubocop/cop/graphql/id_type_spec.rb index a566488b118..771e4e32dd2 100644 --- a/spec/rubocop/cop/graphql/id_type_spec.rb +++ b/spec/rubocop/cop/graphql/id_type_spec.rb @@ -7,10 +7,10 @@ require_relative '../../../../rubocop/cop/graphql/id_type' RSpec.describe RuboCop::Cop::Graphql::IDType do subject(:cop) { described_class.new } - it 'adds an offense when GraphQL::ID_TYPE is used as a param to #argument' do + it 'adds an offense when GraphQL::Types::ID is used as a param to #argument' do expect_offense(<<~TYPE) - argument :some_arg, GraphQL::ID_TYPE, some: other, params: do_not_matter - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Do not use GraphQL::ID_TYPE, use a specific GlobalIDType instead + argument :some_arg, GraphQL::Types::ID, some: other, params: do_not_matter + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Do not use GraphQL::Types::ID, use a specific GlobalIDType instead TYPE end @@ -18,7 +18,7 @@ RSpec.describe RuboCop::Cop::Graphql::IDType do RuboCop::Cop::Graphql::IDType::WHITELISTED_ARGUMENTS.each do |arg| it "does not add an offense for calls to #argument with #{arg} as argument name" do expect_no_offenses(<<~TYPE.strip) - argument #{arg}, GraphQL::ID_TYPE, some: other, params: do_not_matter + argument #{arg}, GraphQL::Types::ID, some: other, params: do_not_matter TYPE end end |