diff options
35 files changed, 159 insertions, 84 deletions
diff --git a/app/helpers/version_check_helper.rb b/app/helpers/version_check_helper.rb index 6f94c241914..f8d7264d4cc 100644 --- a/app/helpers/version_check_helper.rb +++ b/app/helpers/version_check_helper.rb @@ -19,7 +19,7 @@ module VersionCheckHelper end def source_host_url - Gitlab::COM_URL + Gitlab::Saas.com_url end def source_code_group diff --git a/app/views/notify/ssh_key_expired_email.html.haml b/app/views/notify/ssh_key_expired_email.html.haml index 651bdac7acb..79a09b74683 100644 --- a/app/views/notify/ssh_key_expired_email.html.haml +++ b/app/views/notify/ssh_key_expired_email.html.haml @@ -1,7 +1,7 @@ %p = _('Hi %{username}!') % { username: sanitize_name(@user.name) } %p - = _('Your SSH keys with the following fingerprints have expired. Expired SSH keys will not be usable in future versions of GitLab:') + = _('SSH keys with the following fingerprints have expired and can no longer be used:') %table %tbody - @fingerprints.each do |fingerprint| diff --git a/app/views/notify/ssh_key_expired_email.text.erb b/app/views/notify/ssh_key_expired_email.text.erb index aa6e79d59b8..0eb0859e4b9 100644 --- a/app/views/notify/ssh_key_expired_email.text.erb +++ b/app/views/notify/ssh_key_expired_email.text.erb @@ -1,6 +1,6 @@ <%= _('Hi %{username}!') % { username: sanitize_name(@user.name) } %> -<%= _('Your SSH keys with the following fingerprints have expired. Expired SSH keys will not be usable in future versions of GitLab:') %> +<%= _('SSH keys with the following fingerprints have expired and can no longer be used:') %> <% @fingerprints.each do |fingerprint| %> - <%= fingerprint %> diff --git a/app/views/notify/ssh_key_expiring_soon.text.erb b/app/views/notify/ssh_key_expiring_soon.text.erb index ff6feb87662..372c55ecb87 100644 --- a/app/views/notify/ssh_key_expiring_soon.text.erb +++ b/app/views/notify/ssh_key_expiring_soon.text.erb @@ -1,6 +1,6 @@ <%= _('Hi %{username}!') % { username: sanitize_name(@user.name) } %> -<%= _('Your SSH keys with the following fingerprints are scheduled to expire soon. Expired SSH keys will not be usable in future versions of GitLab:') %> +<%= _('SSH keys with the following fingerprints are scheduled to expire soon. Expired SSH keys can not be used:') %> <% @fingerprints.each do |fingerprint| %> - <%= fingerprint %> diff --git a/app/views/notify/ssh_key_expiring_soon_email.html.haml b/app/views/notify/ssh_key_expiring_soon_email.html.haml index 924165ecf3d..cd4ee23e3db 100644 --- a/app/views/notify/ssh_key_expiring_soon_email.html.haml +++ b/app/views/notify/ssh_key_expiring_soon_email.html.haml @@ -1,7 +1,7 @@ %p = _('Hi %{username}!') % { username: sanitize_name(@user.name) } %p - = _('Your SSH keys with the following fingerprints are scheduled to expire soon. Expired SSH keys will not be usable in future versions of GitLab:') + = _('SSH keys with the following fingerprints are scheduled to expire soon. Expired SSH keys can not be used:') %table %tbody - @fingerprints.each do |fingerprint| diff --git a/db/migrate/20210531070452_default_enforce_ssh_key_expiration.rb b/db/migrate/20210531070452_default_enforce_ssh_key_expiration.rb new file mode 100644 index 00000000000..8ddbb528962 --- /dev/null +++ b/db/migrate/20210531070452_default_enforce_ssh_key_expiration.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class DefaultEnforceSshKeyExpiration < ActiveRecord::Migration[6.0] + def change + change_column_default(:application_settings, :enforce_ssh_key_expiration, from: false, to: true) + end +end diff --git a/db/migrate/20210531071107_enable_enforce_ssh_key_expiration.rb b/db/migrate/20210531071107_enable_enforce_ssh_key_expiration.rb new file mode 100644 index 00000000000..d5a97b6e761 --- /dev/null +++ b/db/migrate/20210531071107_enable_enforce_ssh_key_expiration.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class EnableEnforceSshKeyExpiration < ActiveRecord::Migration[6.0] + class ApplicationSetting < ActiveRecord::Base + self.table_name = 'application_settings' + end + + def up + ApplicationSetting.reset_column_information + + ApplicationSetting.where.not(enforce_ssh_key_expiration: false).each do |application_setting| + application_setting.update!(enforce_ssh_key_expiration: true) + end + end +end diff --git a/db/schema_migrations/20210531070452 b/db/schema_migrations/20210531070452 new file mode 100644 index 00000000000..51a023a544c --- /dev/null +++ b/db/schema_migrations/20210531070452 @@ -0,0 +1 @@ +e569b99998d9c670af17ec747e37726671601ba06fa97da83373649adb3aab31
\ No newline at end of file diff --git a/db/schema_migrations/20210531071107 b/db/schema_migrations/20210531071107 new file mode 100644 index 00000000000..f855e0990e1 --- /dev/null +++ b/db/schema_migrations/20210531071107 @@ -0,0 +1 @@ +38dcfcd162a3b49a9b16b45b2f9818275807bf419880729b5c552bccb0d4dc9e
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 80382f68c22..56b6dcd0a24 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -9488,7 +9488,7 @@ CREATE TABLE application_settings ( rate_limiting_response_text text, invisible_captcha_enabled boolean DEFAULT false NOT NULL, container_registry_cleanup_tags_service_max_list_size integer DEFAULT 200 NOT NULL, - enforce_ssh_key_expiration boolean DEFAULT false NOT NULL, + enforce_ssh_key_expiration boolean DEFAULT true NOT NULL, git_two_factor_session_expiry integer DEFAULT 15 NOT NULL, keep_latest_artifact boolean DEFAULT true NOT NULL, notes_create_limit integer DEFAULT 300 NOT NULL, diff --git a/doc/user/admin_area/settings/account_and_limit_settings.md b/doc/user/admin_area/settings/account_and_limit_settings.md index dce2bc990d8..651f65c49d4 100644 --- a/doc/user/admin_area/settings/account_and_limit_settings.md +++ b/doc/user/admin_area/settings/account_and_limit_settings.md @@ -38,7 +38,7 @@ When you [add files to a repository](../../project/repository/web_editor.md#crea through the web UI, the maximum **attachment** size is the limiting factor, because the [web server](../../../development/architecture.md#components) must receive the file before GitLab can generate the commit. -Use [Git LFS](../../../topics/git/lfs/index.md) to add large files to a repository. +Use [Git LFS](../../../topics/git/lfs/index.md) to add large files to a repository. ## Max import size @@ -189,22 +189,18 @@ Once a lifetime for personal access tokens is set, GitLab: ## Enforce SSH key expiration **(ULTIMATE SELF)** -> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/250480) in GitLab 13.9. +> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/250480) in GitLab 13.9. +> - [Enabled by default](https://gitlab.com/gitlab-org/gitlab/-/issues/320970) in GitLab 14.0. -By default, expired SSH keys **can still be used**. +By default, expired SSH keys **are not usable**. -WARNING: -Allowing use of expired SSH keys by default is deprecated and scheduled to change in GitLab 14.0. - -To prevent the use of expired SSH keys: +To allow the use of expired SSH keys: 1. Navigate to **Admin Area > Settings > General**. 1. Expand the **Account and limit** section. -1. Select the **Enforce SSH key expiration** checkbox. - -Enforcing SSH key expiration immediately disables all expired SSH keys. +1. Uncheck the **Enforce SSH key expiration** checkbox. -For more information, see the following issue on [SSH key expiration](https://gitlab.com/gitlab-org/gitlab/-/issues/320970). +Disabling SSH key expiration immediately enables all expired SSH keys. ## Do not enforce Personal Access Token expiration **(ULTIMATE SELF)** diff --git a/doc/user/admin_area/settings/floc.md b/doc/user/admin_area/settings/floc.md index e1d10727341..31a626478ed 100644 --- a/doc/user/admin_area/settings/floc.md +++ b/doc/user/admin_area/settings/floc.md @@ -22,7 +22,8 @@ Permissions-Policy: interest-cohort=() To enable it: -1. Go to the Admin Area (**{admin}**) and select **Settings > General**. +1. On the top bar, select **Menu >** **{admin}** **Admin**. +1. In the left sidebar, select **Settings > General**. 1. Expand **Federated Learning of Cohorts**. 1. Check the box. 1. Click **Save changes**. diff --git a/doc/user/admin_area/settings/help_page.md b/doc/user/admin_area/settings/help_page.md index 5739c3e4f10..d7c96c295f6 100644 --- a/doc/user/admin_area/settings/help_page.md +++ b/doc/user/admin_area/settings/help_page.md @@ -16,7 +16,8 @@ to go for help. You can customize and display this information on the GitLab ser You can add a help message, which is shown on the GitLab `/help` page (e.g., <https://gitlab.com/help>) in a new section at the top of the `/help` page: -1. Navigate to **Admin Area > Settings > Preferences**, then expand **Help page**. +1. On the top bar, select **Menu >** **{admin}** **Admin**. +1. In the left sidebar, select **Settings > Preferences**, then expand **Help page**. 1. Under **Help page text**, fill in the information you wish to display on `/help`. 1. Save your changes. You can now see the message on `/help`. @@ -25,7 +26,8 @@ You can add a help message, which is shown on the GitLab `/help` page (e.g., You can add a help message, which is shown on the GitLab login page in a new section titled `Need Help?`, located below the login page message: -1. Navigate to **Admin Area > Settings > Preferences**, then expand **Help page**. +1. On the top bar, select **Menu >** **{admin}** **Admin**. +1. In the left sidebar, select **Settings > Preferences**, then expand **Help page**. 1. Under **Help text**, fill in the information you wish to display on the login page. ![help message on login page](img/help_page_help_text_v12_3.png) diff --git a/doc/user/admin_area/settings/img/custom_sign_in_page_v13_6.png b/doc/user/admin_area/settings/img/custom_sign_in_page_v13_6.png Binary files differdeleted file mode 100644 index 5eb2134187a..00000000000 --- a/doc/user/admin_area/settings/img/custom_sign_in_page_v13_6.png +++ /dev/null diff --git a/doc/user/admin_area/settings/rate_limits_on_raw_endpoints.md b/doc/user/admin_area/settings/rate_limits_on_raw_endpoints.md index a9b23b3dc50..24b69ba74c7 100644 --- a/doc/user/admin_area/settings/rate_limits_on_raw_endpoints.md +++ b/doc/user/admin_area/settings/rate_limits_on_raw_endpoints.md @@ -9,8 +9,11 @@ type: reference > [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/30829) in GitLab 12.2. -This setting allows you to rate limit the requests to raw endpoints, defaults to `300` requests per minute. -It can be modified in **Admin Area > Settings > Network > Performance Optimization**. +This setting defaults to `300` requests per minute, and allows you to rate limit the requests to raw endpoints: + +1. On the top bar, select **Menu >** **{admin}** **Admin**. +1. In the left sidebar, select **Settings > Network**. +1. Expand **Performance optimization**. For example, requests over `300` per minute to `https://gitlab.com/gitlab-org/gitlab-foss/raw/master/app/controllers/application_controller.rb` are blocked. Access to the raw file is released after 1 minute. diff --git a/doc/user/admin_area/settings/sign_in_restrictions.md b/doc/user/admin_area/settings/sign_in_restrictions.md index 81c847d4b4f..ecd259a345c 100644 --- a/doc/user/admin_area/settings/sign_in_restrictions.md +++ b/doc/user/admin_area/settings/sign_in_restrictions.md @@ -13,7 +13,8 @@ You can use **Sign-in restrictions** to customize authentication restrictions fo To access sign-in restriction settings: -1. Navigate to the **Admin Area > Settings > General**. +1. On the top bar, select **Menu >** **{admin}** **Admin**. +1. In the left sidebar, select **Settings > General**. 1. Expand the **Sign-in restrictions** section. ## Password authentication enabled @@ -78,7 +79,7 @@ If necessary, you can disable **Admin Mode** as an administrator by using one of ```ruby ::Gitlab::CurrentSettings.update!(admin_mode: false) ``` - + ## Two-factor authentication When this feature is enabled, all users must use the [two-factor authentication](../../profile/account/two_factor_authentication.md). @@ -114,13 +115,14 @@ For example, if you include the following information in the noted text box: ```markdown # Custom sign-in text -To access this text box, navigate to Admin Area > Settings > General, and expand the "Sign-in restrictions" section. +To access this text box: + +1. On the top bar, select **Menu > Admin**. +1. In the left sidebar, select **Settings > General**, and expand the **Sign-in restrictions** section. ``` Your users see the **Custom sign-in text** when they navigate to the sign-in screen for your -GitLab instance: - -![Sign-in page](img/custom_sign_in_page_v13_6.png) +GitLab instance. <!-- ## Troubleshooting diff --git a/doc/user/admin_area/settings/sign_up_restrictions.md b/doc/user/admin_area/settings/sign_up_restrictions.md index 0078db286a8..1098c7060f8 100644 --- a/doc/user/admin_area/settings/sign_up_restrictions.md +++ b/doc/user/admin_area/settings/sign_up_restrictions.md @@ -22,7 +22,8 @@ you do not expect public users to sign up for an account. To disable sign ups: -1. Go to **Admin Area > Settings > General** and expand **Sign-up restrictions**. +1. On the top bar, select **Menu >** **{admin}** **Admin**. +1. In the left sidebar, select **Settings > General**, and expand **Sign-up restrictions**. 1. Clear the **Sign-up enabled** checkbox, then select **Save changes**. ## Require administrator approval for new sign ups @@ -34,7 +35,8 @@ When this setting is enabled, any user visiting your GitLab domain and signing u To require administrator approval for new sign ups: -1. Go to **Admin Area > Settings > General** and expand **Sign-up restrictions**. +1. On the top bar, select **Menu >** **{admin}** **Admin**. +1. In the left sidebar, select **Settings > General**, and expand **Sign-up restrictions**. 1. Select the **Require admin approval for new sign-ups** checkbox, then select **Save changes**. In [GitLab 13.7 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/273258), if an administrator disables this setting, the users in pending approval state are @@ -47,7 +49,8 @@ their email address before they are allowed to sign in. To enforce confirmation of the email address used for new sign ups: -1. Go to **Admin Area > Settings > General** and expand **Sign-up restrictions**. +1. On the top bar, select **Menu >** **{admin}** **Admin**. +1. In the left sidebar, select **Settings > General**, and expand **Sign-up restrictions**. 1. Select the **Enable email restrictions for sign ups** checkbox, then select **Save changes**. ## User cap **(FREE SELF)** @@ -64,7 +67,8 @@ user cap, the users in pending approval state are automatically approved in a ba ### Set the user cap number -1. Go to **Admin Area > Settings > General**. +1. On the top bar, select **Menu >** **{admin}** **Admin**. +1. In the left sidebar, select **Settings > General**. 1. Expand **Sign-up restrictions**. 1. Enter a number in **User cap**. 1. Select **Save changes**. @@ -73,7 +77,8 @@ New user sign ups are subject to the user cap restriction. ## Remove the user cap -1. Go to **Admin Area > Settings > General**. +1. On the top bar, select **Menu >** **{admin}** **Admin**. +1. In the left sidebar, select **Settings > General**. 1. Expand **Sign-up restrictions**. 1. Remove the number from **User cap**. 1. Select **Save changes**. @@ -130,7 +135,8 @@ reduce the risk of malicious users creating spam accounts with disposable email To create an email domain allowlist or denylist: -1. Go to **Admin Area > Settings > General** and expand **Sign-up restrictions**. +1. On the top bar, select **Menu >** **{admin}** **Admin**. +1. In the left sidebar, select **Settings > General**, and expand **Sign-up restrictions**. 1. For the allowlist, you must enter the list manually. For the denylist, you can enter the list manually or upload a `.txt` file that contains list entries. diff --git a/doc/user/admin_area/settings/terms.md b/doc/user/admin_area/settings/terms.md index 3e0636ef7ac..46e85ffc9c0 100644 --- a/doc/user/admin_area/settings/terms.md +++ b/doc/user/admin_area/settings/terms.md @@ -7,7 +7,7 @@ type: reference # Enforce accepting Terms of Service **(FREE SELF)** -An admin can enforce acceptance of a terms of service and privacy policy. When this option is enabled, new and existing users must accept the terms. +An administrator can enforce acceptance of a terms of service and privacy policy. When this option is enabled, new and existing users must accept the terms. If configured, the Terms of Service page can be viewed via `https://your-instance.com/-/users/terms` at anytime. @@ -16,7 +16,8 @@ If configured, the Terms of Service page can be viewed via `https://your-instanc To enforce acceptance of a Terms of Service and Privacy Policy: 1. Log in to the GitLab instance as an admin user. -1. Go to **Admin Area > Settings > General**. +1. On the top bar, select **Menu >** **{admin}** **Admin**. +1. In the left sidebar, select **Settings > General**. 1. Expand the **Terms of Service and Privacy Policy** section. 1. Check the **Require all users to accept Terms of Service and Privacy Policy when they access GitLab.** checkbox. diff --git a/doc/user/admin_area/settings/third_party_offers.md b/doc/user/admin_area/settings/third_party_offers.md index 59845a8d0d8..e7fa8b1dc40 100644 --- a/doc/user/admin_area/settings/third_party_offers.md +++ b/doc/user/admin_area/settings/third_party_offers.md @@ -13,7 +13,11 @@ Within GitLab, we inform users of available third-party offers they might find v to enhance the development of their projects. An example is the Google Cloud Platform free credit for using [Google Kubernetes Engine](https://cloud.google.com/kubernetes-engine/). -The display of third-party offers can be toggled in the **Admin Area > Settings** page. +To toggle the display of third-party offers: + +1. On the top bar, select **Menu >** **{admin}** **Admin**. +1. In the left sidebar, select **Settings**, and expand **Third party offers**. +1. Select **Do not display offers from third parties within GitLab**. <!-- ## Troubleshooting diff --git a/doc/user/admin_area/settings/usage_statistics.md b/doc/user/admin_area/settings/usage_statistics.md index ada44115cec..b5a7ce318ff 100644 --- a/doc/user/admin_area/settings/usage_statistics.md +++ b/doc/user/admin_area/settings/usage_statistics.md @@ -10,8 +10,12 @@ type: reference GitLab Inc. periodically collects information about your instance in order to perform various actions. -All statistics are opt-out. You can enable/disable them in the -**Admin Area > Settings > Metrics and profiling** section **Usage statistics**. +All statistics are opt-out. To enable or disable them: + +1. On the top bar, select **Menu >** **{admin}** **Admin**. +1. In the left sidebar, select **Settings > Metrics and profiling**, and expand **Usage statistics**. +1. Enable or disable **Version check** and **Usage ping**. +1. Select **Save changes**. ## Network configuration @@ -40,8 +44,12 @@ This information is used, among other things, to identify to which versions patches must be backported, making sure active GitLab instances remain secure. -If you disable version check, this information isn't collected. Enable or -disable the version check in **Admin Area > Settings > Metrics and profiling > Usage statistics**. +If you disable version check, this information isn't collected. To enable or disable it: + +1. On the top bar, select **Menu >** **{admin}** **Admin**. +1. In the left sidebar, select **Settings > Metrics and profiling**, and expand **Usage statistics**. +1. Enable or disable **Version check**. +1. Select **Save changes**. ### Request flow example diff --git a/doc/user/admin_area/settings/user_and_ip_rate_limits.md b/doc/user/admin_area/settings/user_and_ip_rate_limits.md index 9e64dd59a74..fdeda0cf451 100644 --- a/doc/user/admin_area/settings/user_and_ip_rate_limits.md +++ b/doc/user/admin_area/settings/user_and_ip_rate_limits.md @@ -11,20 +11,21 @@ Rate limiting is a common technique used to improve the security and durability of a web application. For more details, see [Rate limits](../../../security/rate_limits.md). -The following limits can be enforced in **Admin Area > Settings > Network > User and -IP rate limits**: +The following limits are disabled by default: - Unauthenticated requests - Authenticated API requests - Authenticated web requests -These limits are disabled by default. +To enforce any or all of them: -NOTE: -By default, all Git operations are first tried unauthenticated. Because of this, HTTP Git operations -may trigger the rate limits configured for unauthenticated requests. +1. On the top bar, select **Menu >** **{admin}** **Admin**. +1. In the left sidebar, select **Settings > Network**, and expand **User and IP rate limits**: + ![user-and-ip-rate-limits](img/user_and_ip_rate_limits.png) -![user-and-ip-rate-limits](img/user_and_ip_rate_limits.png) + NOTE: + By default, all Git operations are first tried unauthenticated. Because of this, HTTP Git operations + may trigger the rate limits configured for unauthenticated requests. ## Response text diff --git a/doc/user/instance/clusters/index.md b/doc/user/instance/clusters/index.md index 33366c658d7..24fabbc5a42 100644 --- a/doc/user/instance/clusters/index.md +++ b/doc/user/instance/clusters/index.md @@ -14,7 +14,10 @@ instance-level Kubernetes clusters allow you to connect a Kubernetes cluster to the GitLab instance, which enables you to use the same cluster across multiple projects. -The instance level Kubernetes clusters can be found in the top menu by navigating to your instance's **{admin}** **Admin Area > Kubernetes**. +To view the instance level Kubernetes clusters: + +1. On the top bar, select **Menu >** **{admin}** **Admin**. +1. In the left sidebar, select **Kubernetes**. ## Cluster precedence diff --git a/lib/bulk_imports/clients/graphql.rb b/lib/bulk_imports/clients/graphql.rb index b067431aeae..ca549c4be14 100644 --- a/lib/bulk_imports/clients/graphql.rb +++ b/lib/bulk_imports/clients/graphql.rb @@ -25,7 +25,7 @@ module BulkImports delegate :query, :parse, :execute, to: :client - def initialize(url: Gitlab::COM_URL, token: nil) + def initialize(url: Gitlab::Saas.com_url, token: nil) @url = Gitlab::Utils.append_path(url, '/api/graphql') @token = token @client = Graphlient::Client.new( diff --git a/lib/gitlab.rb b/lib/gitlab.rb index 86bb2f662e5..d93d7acbaad 100644 --- a/lib/gitlab.rb +++ b/lib/gitlab.rb @@ -39,17 +39,14 @@ module Gitlab end end - COM_URL = 'https://gitlab.com' - STAGING_COM_URL = 'https://staging.gitlab.com' APP_DIRS_PATTERN = %r{^/?(app|config|ee|lib|spec|\(\w*\))}.freeze - SUBDOMAIN_REGEX = %r{\Ahttps://[a-z0-9]+\.gitlab\.com\z}.freeze VERSION = File.read(root.join("VERSION")).strip.freeze INSTALLATION_TYPE = File.read(root.join("INSTALLATION_TYPE")).strip.freeze HTTP_PROXY_ENV_VARS = %w(http_proxy https_proxy HTTP_PROXY HTTPS_PROXY).freeze def self.com? # Check `gl_subdomain?` as well to keep parity with gitlab.com - Gitlab.config.gitlab.url == COM_URL || gl_subdomain? + Gitlab.config.gitlab.url == Gitlab::Saas.com_url || gl_subdomain? end def self.com @@ -57,7 +54,7 @@ module Gitlab end def self.staging? - Gitlab.config.gitlab.url == STAGING_COM_URL + Gitlab.config.gitlab.url == Gitlab::Saas.staging_com_url end def self.canary? @@ -73,11 +70,11 @@ module Gitlab end def self.org? - Gitlab.config.gitlab.url == 'https://dev.gitlab.org' + Gitlab.config.gitlab.url == Gitlab::Saas.dev_url end def self.gl_subdomain? - SUBDOMAIN_REGEX === Gitlab.config.gitlab.url + Gitlab::Saas.subdomain_regex === Gitlab.config.gitlab.url end def self.dev_env_org_or_com? diff --git a/lib/gitlab/email/message/in_product_marketing/experience.rb b/lib/gitlab/email/message/in_product_marketing/experience.rb index 440c1029c09..4156a737517 100644 --- a/lib/gitlab/email/message/in_product_marketing/experience.rb +++ b/lib/gitlab/email/message/in_product_marketing/experience.rb @@ -43,7 +43,7 @@ module Gitlab survey_id: EASE_SCORE_SURVEY_ID } - "#{Gitlab::COM_URL}/-/survey_responses?#{params.to_query}" + "#{Gitlab::Saas.com_url}/-/survey_responses?#{params.to_query}" end def feedback_ratings(rating) diff --git a/lib/gitlab/saas.rb b/lib/gitlab/saas.rb new file mode 100644 index 00000000000..8d9d8415cb1 --- /dev/null +++ b/lib/gitlab/saas.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +# This module is used to return various SaaS related configurations +# which may be overridden in other variants of GitLab + +module Gitlab + module Saas + def self.com_url + 'https://gitlab.com' + end + + def self.staging_com_url + 'https://staging.gitlab.com' + end + + def self.subdomain_regex + %r{\Ahttps://[a-z0-9]+\.gitlab\.com\z}.freeze + end + + def self.dev_url + 'https://dev.gitlab.org' + end + end +end + +Gitlab::Saas.prepend_mod diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 68b4708d2b7..12b52556a72 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -28342,6 +28342,12 @@ msgstr "" msgid "SSH keys allow you to establish a secure connection between your computer and GitLab." msgstr "" +msgid "SSH keys with the following fingerprints are scheduled to expire soon. Expired SSH keys can not be used:" +msgstr "" + +msgid "SSH keys with the following fingerprints have expired and can no longer be used:" +msgstr "" + msgid "SSH public key" msgstr "" @@ -37638,12 +37644,6 @@ msgstr "" msgid "Your SSH keys (%{count})" msgstr "" -msgid "Your SSH keys with the following fingerprints are scheduled to expire soon. Expired SSH keys will not be usable in future versions of GitLab:" -msgstr "" - -msgid "Your SSH keys with the following fingerprints have expired. Expired SSH keys will not be usable in future versions of GitLab:" -msgstr "" - msgid "Your To-Do List" msgstr "" diff --git a/spec/graphql/mutations/design_management/upload_spec.rb b/spec/graphql/mutations/design_management/upload_spec.rb index ada88b7652c..1e585e55be4 100644 --- a/spec/graphql/mutations/design_management/upload_spec.rb +++ b/spec/graphql/mutations/design_management/upload_spec.rb @@ -105,7 +105,7 @@ RSpec.describe Mutations::DesignManagement::Upload do context "with a valid design" do it "returns the updated designs" do - expect(resolve[:errors]).to eq [] + expect(resolve[:errors]).to be_empty expect(resolve[:designs].map(&:filename)).to contain_exactly("dk.png") end end diff --git a/spec/graphql/resolvers/boards_resolver_spec.rb b/spec/graphql/resolvers/boards_resolver_spec.rb index 221e905f441..07d0902d3ba 100644 --- a/spec/graphql/resolvers/boards_resolver_spec.rb +++ b/spec/graphql/resolvers/boards_resolver_spec.rb @@ -9,7 +9,7 @@ RSpec.describe Resolvers::BoardsResolver do shared_examples_for 'group and project boards resolver' do it 'does not create a default board' do - expect(resolve_boards).to eq [] + expect(resolve_boards).to be_empty end it 'calls Boards::BoardsFinder' do diff --git a/spec/lib/gitlab/tracking/standard_context_spec.rb b/spec/lib/gitlab/tracking/standard_context_spec.rb index 289818266bd..a0fb6a270a5 100644 --- a/spec/lib/gitlab/tracking/standard_context_spec.rb +++ b/spec/lib/gitlab/tracking/standard_context_spec.rb @@ -22,7 +22,7 @@ RSpec.describe Gitlab::Tracking::StandardContext do context 'staging' do before do - stub_config_setting(url: 'https://staging.gitlab.com') + stub_config_setting(url: Gitlab::Saas.staging_com_url) end include_examples 'contains environment', 'staging' @@ -30,7 +30,7 @@ RSpec.describe Gitlab::Tracking::StandardContext do context 'production' do before do - stub_config_setting(url: 'https://gitlab.com') + stub_config_setting(url: Gitlab::Saas.com_url) end include_examples 'contains environment', 'production' @@ -38,7 +38,7 @@ RSpec.describe Gitlab::Tracking::StandardContext do context 'org' do before do - stub_config_setting(url: 'https://dev.gitlab.org') + stub_config_setting(url: Gitlab::Saas.dev_url) end include_examples 'contains environment', 'org' diff --git a/spec/lib/gitlab_spec.rb b/spec/lib/gitlab_spec.rb index 4df00eaa439..869eaf26772 100644 --- a/spec/lib/gitlab_spec.rb +++ b/spec/lib/gitlab_spec.rb @@ -70,20 +70,21 @@ RSpec.describe Gitlab do end describe '.com?' do - it 'is true when on GitLab.com' do - stub_config_setting(url: 'https://gitlab.com') + it "is true when on #{Gitlab::Saas.com_url}" do + stub_config_setting(url: Gitlab::Saas.com_url) expect(described_class.com?).to eq true end - it 'is true when on staging' do - stub_config_setting(url: 'https://staging.gitlab.com') + it "is true when on #{Gitlab::Saas.staging_com_url}" do + stub_config_setting(url: Gitlab::Saas.staging_com_url) expect(described_class.com?).to eq true end it 'is true when on other gitlab subdomain' do - stub_config_setting(url: 'https://example.gitlab.com') + url_with_subdomain = Gitlab::Saas.com_url.gsub('https://', 'https://example.') + stub_config_setting(url: url_with_subdomain) expect(described_class.com?).to eq true end @@ -118,14 +119,14 @@ RSpec.describe Gitlab do describe '.staging?' do subject { described_class.staging? } - it 'is false when on GitLab.com' do - stub_config_setting(url: 'https://gitlab.com') + it "is false when on #{Gitlab::Saas.com_url}" do + stub_config_setting(url: Gitlab::Saas.com_url) expect(subject).to eq false end - it 'is true when on staging' do - stub_config_setting(url: 'https://staging.gitlab.com') + it "is true when on #{Gitlab::Saas.staging_com_url}" do + stub_config_setting(url: Gitlab::Saas.staging_com_url) expect(subject).to eq true end diff --git a/spec/mailers/emails/profile_spec.rb b/spec/mailers/emails/profile_spec.rb index 9b5633a9f90..365ca892bb1 100644 --- a/spec/mailers/emails/profile_spec.rb +++ b/spec/mailers/emails/profile_spec.rb @@ -264,7 +264,7 @@ RSpec.describe Emails::Profile do include_examples 'valid use case' it_behaves_like 'has the correct subject', /Your SSH key has expired/ - it_behaves_like 'has the correct body text', /Your SSH keys with the following fingerprints have expired/ + it_behaves_like 'has the correct body text', /SSH keys with the following fingerprints have expired/ end context 'when invalid' do @@ -291,7 +291,7 @@ RSpec.describe Emails::Profile do include_examples 'valid use case' it_behaves_like 'has the correct subject', /Your SSH key is expiring soon/ - it_behaves_like 'has the correct body text', /Your SSH keys with the following fingerprints are scheduled to expire soon/ + it_behaves_like 'has the correct body text', /SSH keys with the following fingerprints are scheduled to expire soon/ end context 'when invalid' do diff --git a/spec/models/concerns/awardable_spec.rb b/spec/models/concerns/awardable_spec.rb index b5b3772ecb6..b80b6ec95e2 100644 --- a/spec/models/concerns/awardable_spec.rb +++ b/spec/models/concerns/awardable_spec.rb @@ -108,7 +108,7 @@ RSpec.describe Awardable do it "doesn't include unused thumbs buttons when disabled in project" do issue_without_downvote.project.show_default_award_emojis = false - expect(issue_without_downvote.grouped_awards.keys.sort).to eq [] + expect(issue_without_downvote.grouped_awards.keys.sort).to be_empty end it "includes unused thumbs buttons when enabled in project" do @@ -118,7 +118,7 @@ RSpec.describe Awardable do end it "doesn't include unused thumbs buttons in summary" do - expect(issue_without_downvote.grouped_awards(with_thumbs: false).keys).to eq [] + expect(issue_without_downvote.grouped_awards(with_thumbs: false).keys).to be_empty end it "includes used thumbs buttons when disabled in project" do diff --git a/spec/models/snippet_spec.rb b/spec/models/snippet_spec.rb index 41991821922..06e9899c0bd 100644 --- a/spec/models/snippet_spec.rb +++ b/spec/models/snippet_spec.rb @@ -750,7 +750,7 @@ RSpec.describe Snippet do end it 'returns an empty array' do - expect(subject).to eq [] + expect(subject).to be_empty end end end diff --git a/spec/support/shared_examples/requests/api/resource_label_events_api_shared_examples.rb b/spec/support/shared_examples/requests/api/resource_label_events_api_shared_examples.rb index 675b6c5cef6..2ac78131e08 100644 --- a/spec/support/shared_examples/requests/api/resource_label_events_api_shared_examples.rb +++ b/spec/support/shared_examples/requests/api/resource_label_events_api_shared_examples.rb @@ -48,7 +48,7 @@ RSpec.shared_examples 'resource_label_events API' do |parent_type, eventable_typ get api("/#{parent_type}/#{parent.id}/#{eventable_type}/#{eventable[id_name]}/resource_label_events", user) expect(json_response).to be_an Array - expect(json_response).to eq [] + expect(json_response).to be_empty end end end |