Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-03-07 15:22:51 +00:00
parent e8e22b384c
commit 14184b159d
36 changed files with 494 additions and 335 deletions

View file

@ -1 +1 @@
0c6d84c43c48e6f0703ffaef8cb4b7bdc2e94bd8
a928ebb0951f52bfccbfc2e67543abe8bc3f3963

View file

@ -315,9 +315,7 @@ export default {
<gl-dropdown-item v-if="hasMissingBoards" class="no-pointer-events">
{{
s__(
'IssueBoards|Some of your boards are hidden, activate a license to see them again.',
)
s__('IssueBoards|Some of your boards are hidden, add a license to see them again.')
}}
</gl-dropdown-item>
</div>

View file

@ -295,13 +295,6 @@ export default {
return enableSquashBeforeMerge;
},
shouldShowMergeControls() {
if (this.glFeatures.restructuredMrWidget) {
return this.restructuredWidgetShowMergeButtons;
}
return this.isMergeAllowed || this.isAutoMergeAvailable;
},
shouldShowSquashEdit() {
return this.squashBeforeMerge && this.shouldShowSquashBeforeMerge;
},

View file

@ -22,6 +22,13 @@ export default {
this.mr.preventMerge,
);
},
shouldShowMergeControls() {
if (this.glFeatures.restructuredMrWidget) {
return this.restructuredWidgetShowMergeButtons;
}
return this.isMergeAllowed || this.isAutoMergeAvailable;
},
mergeDisabledText() {
if (this.pipeline?.status === PIPELINE_SKIPPED_STATUS) {
return MERGE_DISABLED_SKIPPED_PIPELINE_TEXT;

View file

@ -14,6 +14,7 @@ class Clusters::ClustersController < Clusters::BaseController
before_action :authorize_create_cluster!, only: [:new, :authorize_aws_role]
before_action :authorize_update_cluster!, only: [:update]
before_action :update_applications_status, only: [:cluster_status]
before_action :ensure_feature_enabled!, except: :index
helper_method :token_in_session
@ -172,7 +173,17 @@ class Clusters::ClustersController < Clusters::BaseController
private
def certificate_based_clusters_enabled?
Feature.enabled?(:certificate_based_clusters, clusterable, default_enabled: :yaml, type: :ops)
end
def ensure_feature_enabled!
render_404 unless certificate_based_clusters_enabled?
end
def cluster_list
return [] unless certificate_based_clusters_enabled?
finder = ClusterAncestorsFinder.new(clusterable.subject, current_user)
clusters = finder.execute

View file

@ -7,7 +7,7 @@ class ProfilesController < Profiles::ApplicationController
before_action :user
before_action :authorize_change_username!, only: :update_username
before_action only: :update_username do
check_rate_limit!(:profile_update_username, scope: current_user) if Feature.enabled?(:rate_limit_profile_update_username, default_enabled: :yaml)
check_rate_limit!(:profile_update_username, scope: current_user)
end
skip_before_action :require_email, only: [:show, :update]
before_action do

View file

@ -18,6 +18,28 @@ module ApplicationHelper
end
end
def dispensable_render(...)
render(...)
rescue StandardError => error
if Feature.enabled?(:dispensable_render, default_enabled: :yaml)
Gitlab::ErrorTracking.track_and_raise_for_dev_exception(error)
nil
else
raise error
end
end
def dispensable_render_if_exists(...)
render_if_exists(...)
rescue StandardError => error
if Feature.enabled?(:dispensable_render, default_enabled: :yaml)
Gitlab::ErrorTracking.track_and_raise_for_dev_exception(error)
nil
else
raise error
end
end
def partial_exists?(partial)
lookup_context.exists?(partial, [], true)
end

View file

@ -461,11 +461,16 @@ class Environment < ApplicationRecord
# See https://en.wikipedia.org/wiki/Deployment_environment for industry standard deployment environments
def guess_tier
case name
when %r{dev|review|trunk}i then self.class.tiers[:development]
when %r{test|qc}i then self.class.tiers[:testing]
when %r{st(a|)g|mod(e|)l|pre|demo}i then self.class.tiers[:staging]
when %r{pr(o|)d|live}i then self.class.tiers[:production]
else self.class.tiers[:other]
when /(dev|review|trunk)/i
self.class.tiers[:development]
when /(test|tst|int|ac(ce|)pt|qa|qc|control|quality)/i
self.class.tiers[:testing]
when /(st(a|)g|mod(e|)l|pre|demo)/i
self.class.tiers[:staging]
when /(pr(o|)d|live)/i
self.class.tiers[:production]
else
self.class.tiers[:other]
end
end
end

View file

@ -3,23 +3,23 @@
= render "layouts/nav/sidebar/#{nav}"
.content-wrapper.content-wrapper-margin{ class: "#{@content_wrapper_class}" }
.mobile-overlay
= render_if_exists 'layouts/header/verification_reminder'
= dispensable_render_if_exists 'layouts/header/verification_reminder'
.alert-wrapper.gl-force-block-formatting-context
= render 'shared/outdated_browser'
= render_if_exists "layouts/header/licensed_user_count_threshold"
= render_if_exists "layouts/header/token_expiry_notification"
= render "layouts/broadcast"
= render "layouts/header/read_only_banner"
= render "layouts/header/registration_enabled_callout"
= render "layouts/nav/classification_level_banner"
= dispensable_render 'shared/outdated_browser'
= dispensable_render_if_exists "layouts/header/licensed_user_count_threshold"
= dispensable_render_if_exists "layouts/header/token_expiry_notification"
= dispensable_render "layouts/broadcast"
= dispensable_render "layouts/header/read_only_banner"
= dispensable_render "layouts/header/registration_enabled_callout"
= dispensable_render "layouts/nav/classification_level_banner"
= yield :flash_message
= render "shared/service_ping_consent"
= dispensable_render "shared/service_ping_consent"
= render_two_factor_auth_recovery_settings_check
= render_if_exists "layouts/header/ee_subscribable_banner"
= render_if_exists "layouts/header/seats_count_alert"
= render_if_exists "shared/namespace_storage_limit_alert"
= render_if_exists "shared/namespace_user_cap_reached_alert"
= render_if_exists "shared/new_user_signups_cap_reached_alert"
= dispensable_render_if_exists "layouts/header/ee_subscribable_banner"
= dispensable_render_if_exists "layouts/header/seats_count_alert"
= dispensable_render_if_exists "shared/namespace_storage_limit_alert"
= dispensable_render_if_exists "shared/namespace_user_cap_reached_alert"
= dispensable_render_if_exists "shared/new_user_signups_cap_reached_alert"
= yield :page_level_alert
= yield :group_invite_members_banner
- unless @hide_breadcrumbs

View file

@ -1,8 +1,8 @@
---
name: prometheus_initializer_refactor
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/81133
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/353446
name: dispensable_render
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/81546
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/354337
milestone: '14.9'
type: development
group: group::memory
group: group::activation
default_enabled: true

View file

@ -1,8 +0,0 @@
---
name: rate_limit_profile_update_username
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/77221
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/349132
milestone: '14.7'
type: development
group: group::optimize
default_enabled: false

View file

@ -1,7 +1,5 @@
# frozen_string_literal: true
return if Feature.feature_flags_available? && Feature.enabled?(:prometheus_initializer_refactor, default_enabled: :yaml)
# Keep separate directories for separate processes
def prometheus_default_multiproc_dir
return unless Rails.env.development? || Rails.env.test?
@ -18,8 +16,6 @@ end
::Prometheus::Client.configure do |config|
config.logger = Gitlab::AppLogger
config.initial_mmap_file_size = 4 * 1024
config.multiprocess_files_dir = ENV['prometheus_multiproc_dir'] || prometheus_default_multiproc_dir
config.pid_provider = ::Prometheus::PidProvider.method(:worker_id)
@ -30,6 +26,10 @@ Gitlab::Application.configure do |config|
config.middleware.insert_after(Labkit::Middleware::Rack, Gitlab::Metrics::RequestsRackMiddleware)
end
# Any actions beyond this check should only execute outside of tests, when running in an application
# context (i.e. not in the Rails console or rspec) and when users have enabled metrics.
return if Rails.env.test? || !Gitlab::Runtime.application? || !Gitlab::Metrics.prometheus_metrics_enabled?
if Gitlab::Runtime.sidekiq? && (!ENV['SIDEKIQ_WORKER_ID'] || ENV['SIDEKIQ_WORKER_ID'] == '0')
# The single worker outside of a sidekiq-cluster, or the first worker (sidekiq_0)
# in a cluster of processes, is responsible for serving health checks.
@ -48,55 +48,56 @@ if Gitlab::Runtime.sidekiq? && (!ENV['SIDEKIQ_WORKER_ID'] || ENV['SIDEKIQ_WORKER
end
end
if !Rails.env.test? && Gitlab::Metrics.prometheus_metrics_enabled?
Gitlab::Cluster::LifecycleEvents.on_master_start do
# When running Puma in a Single mode, `on_master_start` and `on_worker_start` are the same.
# Thus, we order these events to run `reinitialize_on_pid_change` with `force: true` first.
Gitlab::Cluster::LifecycleEvents.on_master_start do
::Prometheus::Client.reinitialize_on_pid_change(force: true)
::Prometheus::Client.reinitialize_on_pid_change(force: true)
if Gitlab::Runtime.puma?
Gitlab::Metrics::Samplers::PumaSampler.instance.start
end
Gitlab::Metrics.gauge(:deployments, 'GitLab Version', {}, :max).set({ version: Gitlab::VERSION, revision: Gitlab.revision }, 1)
Gitlab::Metrics.gauge(:deployments, 'GitLab Version', {}, :max).set({ version: Gitlab::VERSION, revision: Gitlab.revision }, 1)
if Gitlab::Runtime.puma?
Gitlab::Metrics::RequestsRackMiddleware.initialize_metrics
if Gitlab::Runtime.puma?
Gitlab::Metrics::RequestsRackMiddleware.initialize_metrics
end
Gitlab::Metrics::Samplers::PumaSampler.instance.start
Gitlab::Ci::Parsers.instrument!
rescue IOError => e
Gitlab::ErrorTracking.track_exception(e)
Gitlab::Metrics.error_detected!
end
Gitlab::Cluster::LifecycleEvents.on_worker_start do
defined?(::Prometheus::Client.reinitialize_on_pid_change) && ::Prometheus::Client.reinitialize_on_pid_change
logger = Gitlab::AppLogger
Gitlab::Metrics::Samplers::RubySampler.initialize_instance(logger: logger).start
Gitlab::Metrics::Samplers::DatabaseSampler.initialize_instance(logger: logger).start
Gitlab::Metrics::Samplers::ThreadsSampler.initialize_instance(logger: logger).start
if Gitlab::Runtime.puma?
Gitlab::Metrics::Samplers::ActionCableSampler.instance(logger: logger).start
end
if Gitlab.ee? && Gitlab::Runtime.sidekiq?
Gitlab::Metrics::Samplers::GlobalSearchSampler.instance(logger: logger).start
end
Gitlab::Ci::Parsers.instrument!
rescue IOError => e
Gitlab::ErrorTracking.track_exception(e)
Gitlab::Metrics.error_detected!
end
end
if Gitlab::Runtime.puma?
Gitlab::Cluster::LifecycleEvents.on_master_start do
# Starts a metrics server to export metrics from the Puma primary.
Gitlab::Metrics::Exporter::WebExporter.instance.start
end
Gitlab::Ci::Parsers.instrument!
rescue IOError => e
Gitlab::ErrorTracking.track_exception(e)
Gitlab::Metrics.error_detected!
end
Gitlab::Cluster::LifecycleEvents.on_worker_start do
defined?(::Prometheus::Client.reinitialize_on_pid_change) && ::Prometheus::Client.reinitialize_on_pid_change
logger = Gitlab::AppLogger
Gitlab::Metrics::Samplers::RubySampler.initialize_instance(logger: logger).start
Gitlab::Metrics::Samplers::DatabaseSampler.initialize_instance(logger: logger).start
Gitlab::Metrics::Samplers::ThreadsSampler.initialize_instance(logger: logger).start
if Gitlab::Runtime.puma?
# Since we are running a metrics server on the Puma primary, we would inherit
# this thread after forking into workers, so we need to explicitly stop it here.
# NOTE: This will not be necessary anymore after moving to an external server
# process via https://gitlab.com/gitlab-org/gitlab/-/issues/350548
Gitlab::Metrics::Exporter::WebExporter.instance.stop
Gitlab::Metrics::Samplers::ActionCableSampler.instance(logger: logger).start
end
if Gitlab.ee? && Gitlab::Runtime.sidekiq?
Gitlab::Metrics::Samplers::GlobalSearchSampler.instance(logger: logger).start
end
Gitlab::Ci::Parsers.instrument!
rescue IOError => e
Gitlab::ErrorTracking.track_exception(e)
Gitlab::Metrics.error_detected!
end
if Gitlab::Runtime.puma?
Gitlab::Cluster::LifecycleEvents.on_before_graceful_shutdown do
# We need to ensure that before we re-exec or shutdown server
# we do stop the exporter
@ -111,12 +112,4 @@ if Gitlab::Runtime.puma?
# but it should not be needed
Gitlab::Metrics::Exporter::WebExporter.instance.stop
end
Gitlab::Cluster::LifecycleEvents.on_worker_start do
# The `#close_on_exec=` takes effect only on `execve`
# but this does not happen for Ruby fork
#
# This does stop server, as it is running on master.
Gitlab::Metrics::Exporter::WebExporter.instance.stop
end
end

View file

@ -1,117 +0,0 @@
# frozen_string_literal: true
return unless Feature.feature_flags_available? && Feature.enabled?(:prometheus_initializer_refactor, default_enabled: :yaml)
# Keep separate directories for separate processes
def prometheus_default_multiproc_dir
return unless Rails.env.development? || Rails.env.test?
if Gitlab::Runtime.sidekiq?
Rails.root.join('tmp/prometheus_multiproc_dir/sidekiq')
elsif Gitlab::Runtime.puma?
Rails.root.join('tmp/prometheus_multiproc_dir/puma')
else
Rails.root.join('tmp/prometheus_multiproc_dir')
end
end
::Prometheus::Client.configure do |config|
config.logger = Gitlab::AppLogger
config.multiprocess_files_dir = ENV['prometheus_multiproc_dir'] || prometheus_default_multiproc_dir
config.pid_provider = ::Prometheus::PidProvider.method(:worker_id)
end
Gitlab::Application.configure do |config|
# 0 should be Sentry to catch errors in this middleware
config.middleware.insert_after(Labkit::Middleware::Rack, Gitlab::Metrics::RequestsRackMiddleware)
end
# Any actions beyond this check should only execute outside of tests, when running in an application
# context (i.e. not in the Rails console or rspec) and when users have enabled metrics.
return if Rails.env.test? || !Gitlab::Runtime.application? || !Gitlab::Metrics.prometheus_metrics_enabled?
if Gitlab::Runtime.sidekiq? && (!ENV['SIDEKIQ_WORKER_ID'] || ENV['SIDEKIQ_WORKER_ID'] == '0')
# The single worker outside of a sidekiq-cluster, or the first worker (sidekiq_0)
# in a cluster of processes, is responsible for serving health checks.
#
# Do not clean the metrics directory here - the supervisor script should
# have already taken care of that.
Sidekiq.configure_server do |config|
config.on(:startup) do
# In https://gitlab.com/gitlab-org/gitlab/-/issues/345804 we are looking to
# only serve health-checks from a worker process; for backwards compatibility
# we still go through the metrics exporter server, but start to configure it
# with the new settings keys.
exporter_settings = Settings.monitoring.sidekiq_health_checks
Gitlab::Metrics::Exporter::SidekiqExporter.instance(exporter_settings).start
end
end
end
Gitlab::Cluster::LifecycleEvents.on_master_start do
# When running Puma in a Single mode, `on_master_start` and `on_worker_start` are the same.
# Thus, we order these events to run `reinitialize_on_pid_change` with `force: true` first.
::Prometheus::Client.reinitialize_on_pid_change(force: true)
Gitlab::Metrics.gauge(:deployments, 'GitLab Version', {}, :max).set({ version: Gitlab::VERSION, revision: Gitlab.revision }, 1)
if Gitlab::Runtime.puma?
Gitlab::Metrics::RequestsRackMiddleware.initialize_metrics
Gitlab::Metrics::Samplers::PumaSampler.instance.start
# Starts a metrics server to export metrics from the Puma primary.
Gitlab::Metrics::Exporter::WebExporter.instance.start
end
Gitlab::Ci::Parsers.instrument!
rescue IOError => e
Gitlab::ErrorTracking.track_exception(e)
Gitlab::Metrics.error_detected!
end
Gitlab::Cluster::LifecycleEvents.on_worker_start do
defined?(::Prometheus::Client.reinitialize_on_pid_change) && ::Prometheus::Client.reinitialize_on_pid_change
logger = Gitlab::AppLogger
Gitlab::Metrics::Samplers::RubySampler.initialize_instance(logger: logger).start
Gitlab::Metrics::Samplers::DatabaseSampler.initialize_instance(logger: logger).start
Gitlab::Metrics::Samplers::ThreadsSampler.initialize_instance(logger: logger).start
if Gitlab::Runtime.puma?
# Since we are running a metrics server on the Puma primary, we would inherit
# this thread after forking into workers, so we need to explicitly stop it here.
# NOTE: This will not be necessary anymore after moving to an external server
# process via https://gitlab.com/gitlab-org/gitlab/-/issues/350548
Gitlab::Metrics::Exporter::WebExporter.instance.stop
Gitlab::Metrics::Samplers::ActionCableSampler.instance(logger: logger).start
end
if Gitlab.ee? && Gitlab::Runtime.sidekiq?
Gitlab::Metrics::Samplers::GlobalSearchSampler.instance(logger: logger).start
end
Gitlab::Ci::Parsers.instrument!
rescue IOError => e
Gitlab::ErrorTracking.track_exception(e)
Gitlab::Metrics.error_detected!
end
if Gitlab::Runtime.puma?
Gitlab::Cluster::LifecycleEvents.on_before_graceful_shutdown do
# We need to ensure that before we re-exec or shutdown server
# we do stop the exporter
Gitlab::Metrics::Exporter::WebExporter.instance.stop
end
Gitlab::Cluster::LifecycleEvents.on_before_master_restart do
# We need to ensure that before we re-exec server
# we do stop the exporter
#
# We do it again, for being extra safe,
# but it should not be needed
Gitlab::Metrics::Exporter::WebExporter.instance.stop
end
end

View file

@ -268,7 +268,7 @@ sudo gitlab-rake gitlab:geo:check
GitLab Geo is available ... no
Try fixing it:
Upload a new license that includes the GitLab Geo feature
Add a new license that includes the GitLab Geo feature
For more information see:
https://about.gitlab.com/features/gitlab-geo/
GitLab Geo is enabled ... Exception: PG::UndefinedTable: ERROR: relation "geo_nodes" does not exist

View file

@ -20,7 +20,7 @@ The steps below should be followed in the order they appear. **Make sure the Git
If you installed GitLab using the Omnibus packages (highly recommended):
1. [Install GitLab Enterprise Edition](https://about.gitlab.com/install/) on the nodes that will serve as the **secondary** site. Do not create an account or log in to the new **secondary** site.
1. [Upload the GitLab License](../../../user/admin_area/license.md) on the **primary** site to unlock Geo. The license must be for [GitLab Premium](https://about.gitlab.com/pricing/) or higher.
1. [Add the GitLab License](../../../user/admin_area/license.md) on the **primary** site to unlock Geo. The license must be for [GitLab Premium](https://about.gitlab.com/pricing/) or higher.
1. [Set up the database replication](database.md) (`primary (read-write) <-> secondary (read-only)` topology).
1. [Configure fast lookup of authorized SSH keys in the database](../../operations/fast_ssh_key_lookup.md). This step is required and needs to be done on **both** the **primary** and **secondary** sites.
1. [Configure GitLab](../replication/configuration.md) to set the **primary** and **secondary** sites.

View file

@ -35,7 +35,7 @@ Learn how to install, configure, update, and maintain your GitLab instance.
- [Installing GitLab on Amazon Web Services (AWS)](../install/aws/index.md): Set up GitLab on Amazon AWS.
- [Geo](geo/index.md): Replicate your GitLab instance to other geographic locations as a read-only fully operational version.
- [Disaster Recovery](geo/disaster_recovery/index.md): Quickly fail-over to a different site with minimal effort in a disaster situation.
- [Add License](../user/admin_area/license.md): Upload a license at install time to unlock features that are in paid tiers of GitLab.
- [Add License](../user/admin_area/license.md): Add a license at install time to unlock features that are in paid tiers of GitLab.
### Configuring GitLab
@ -68,7 +68,7 @@ Learn how to install, configure, update, and maintain your GitLab instance.
- [Elasticsearch](../integration/elasticsearch.md): Enable Elasticsearch to
empower Advanced Search. Use when you deal with a huge amount of data.
- [External Classification Policy Authorization](../user/admin_area/settings/external_authorization.md)
- [Upload a license](../user/admin_area/license.md): Upload a license to unlock
- [Add a license](../user/admin_area/license.md): Add a license to unlock
features that are in paid tiers of GitLab.
- [Admin Area](../user/admin_area/index.md): for self-managed instance-wide
configuration and maintenance.

View file

@ -21,7 +21,7 @@ blocks to an HTML image tag, with the source pointing to the PlantUML instance.
diagram delimiters `@startuml`/`@enduml` aren't required, as these are replaced
by the `plantuml` block:
- **Markdown**
- **Markdown** files with the extension `.md`:
````markdown
```plantuml
@ -30,7 +30,10 @@ by the `plantuml` block:
```
````
- **AsciiDoc**
For additional acceptable extensions, review the
[`languages.yaml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/vendor/languages.yml#L3174) file.
- **AsciiDoc** files with the extension `.asciidoc`, `.adoc`, or `.asc`:
```plaintext
[plantuml, format="png", id="myDiagram", width="200px"]

View file

@ -9730,7 +9730,7 @@ Represents the current license.
| <a id="currentlicensecreatedat"></a>`createdAt` | [`Date`](#date) | Date when the license was added. |
| <a id="currentlicenseemail"></a>`email` | [`String`](#string) | Email of the licensee. |
| <a id="currentlicenseexpiresat"></a>`expiresAt` | [`Date`](#date) | Date when the license expires. |
| <a id="currentlicenseid"></a>`id` | [`ID!`](#id) | ID of the license. |
| <a id="currentlicenseid"></a>`id` | [`ID!`](#id) | ID of the license extracted from the license data. |
| <a id="currentlicenselastsync"></a>`lastSync` | [`Time`](#time) | Date when the license was last synced. |
| <a id="currentlicensemaximumusercount"></a>`maximumUserCount` | [`Int`](#int) | Highest number of billable users on the system during the term of the current license. |
| <a id="currentlicensename"></a>`name` | [`String`](#string) | Name of the licensee. |
@ -12250,7 +12250,7 @@ Represents an entry from the Cloud License history.
| <a id="licensehistoryentrycreatedat"></a>`createdAt` | [`Date`](#date) | Date when the license was added. |
| <a id="licensehistoryentryemail"></a>`email` | [`String`](#string) | Email of the licensee. |
| <a id="licensehistoryentryexpiresat"></a>`expiresAt` | [`Date`](#date) | Date when the license expires. |
| <a id="licensehistoryentryid"></a>`id` | [`ID!`](#id) | ID of the license. |
| <a id="licensehistoryentryid"></a>`id` | [`ID!`](#id) | ID of the license extracted from the license data. |
| <a id="licensehistoryentryname"></a>`name` | [`String`](#string) | Name of the licensee. |
| <a id="licensehistoryentryplan"></a>`plan` | [`String!`](#string) | Name of the subscription plan. |
| <a id="licensehistoryentrystartsat"></a>`startsAt` | [`Date`](#date) | Date when the license started. |

View file

@ -827,7 +827,7 @@ to request additional material:
Geo is the solution for widely distributed development teams.
- [Omnibus GitLab](https://docs.gitlab.com/omnibus/) - Everything you need to know
about administering your GitLab instance.
- [Upload a license](../../user/admin_area/license.md):
- [Add a license](../../user/admin_area/license.md):
Activate all GitLab Enterprise Edition functionality with a license.
- [Pricing](https://about.gitlab.com/pricing/): Pricing for the different tiers.

View file

@ -50,7 +50,7 @@ installation.
## License
- [Upload a license](../user/admin_area/license.md) or [start a free trial](https://about.gitlab.com/free-trial/):
- [Add a license](../user/admin_area/license.md) or [start a free trial](https://about.gitlab.com/free-trial/):
Activate all GitLab Enterprise Edition functionality with a license.
- [Pricing](https://about.gitlab.com/pricing/): Pricing for the different tiers.

View file

@ -153,13 +153,13 @@ See the [quarterly subscription reconciliation section](../quarterly_reconciliat
### How cloud licensing works
#### Activate your license
#### Add your license
1. When you purchase a GitLab self-managed plan, an activation code is generated.
This activation code is sent to the email address associated with the Customers Portal account.
1. In GitLab, on the top bar, select **Menu > Admin**.
1. On the left sidebar, select **Subscription** and paste the activation code in the text field.
1. Select **Activate**.
1. Select **Add license**.
The page displays the details of the subscription.
@ -256,7 +256,7 @@ To subscribe to GitLab through a GitLab self-managed installation:
1. Go to the [Customers Portal](https://customers.gitlab.com/) and purchase a GitLab self-managed plan.
1. After purchase, a license file is sent to the email address associated to the Customers Portal account,
which must be [uploaded to your GitLab instance](../../user/admin_area/license.md#upload-your-license).
which must be [add to your GitLab instance](../../user/admin_area/license.md#activate-gitlab-ee-with-a-license-file-or-key).
NOTE:
If you're purchasing a subscription for an existing **Free** GitLab self-managed
@ -380,7 +380,7 @@ To add seats to a subscription:
The following items are emailed to you:
- A payment receipt. You can also access this information in the Customers Portal under [**View invoices**](https://customers.gitlab.com/receipts).
- A new license. [Upload this license](../../user/admin_area/license.md#upload-your-license) to your instance to use it.
- A new license. [Add this license](../../user/admin_area/license.md#activate-gitlab-ee-with-an-activation-code) to your instance to use it.
### Renew a subscription
@ -400,8 +400,8 @@ You can hover your mouse on the **Renew** button to see the date when it will be
1. In the first box, enter the total number of user licenses you'll need for the upcoming year. Be sure this number is at least **equal to, or greater than** the number of billable users in the system at the time of performing the renewal.
1. Enter the number of [users over license](#users-over-license) in the second box for the user overage incurred in your previous subscription term.
1. Review your renewal details and complete the payment process.
1. A license for the renewal term is available for download on the [Manage Purchases](https://customers.gitlab.com/subscriptions) page on the relevant subscription card. Select **Copy license to clipboard** or **Download license** to get a copy.
1. [Upload](../../user/admin_area/license.md#upload-your-license) your new license to your instance.
1. An activation code for the renewal term is available on the [Manage Purchases](https://customers.gitlab.com/subscriptions) page on the relevant subscription card. Select **Copy activation code** to get a copy.
1. [Add your new license](../../user/admin_area/license.md#activate-gitlab-ee-with-an-activation-code) to your instance.
An invoice is generated for the renewal and available for viewing or download on the [View invoices](https://customers.gitlab.com/receipts) page. If you have difficulty during the renewal process, contact our [support team](https://support.gitlab.com/hc/en-us/requests/new?ticket_form_id=360000071293) for assistance.
@ -421,10 +421,10 @@ The following is emailed to you:
- A payment receipt. You can also access this information in the Customers Portal under
[**View invoices**](https://customers.gitlab.com/receipts).
- A new license.
- A new activation code for your license.
[Upload the new license](../../user/admin_area/license.md#upload-your-license) to your instance.
The new tier takes effect when the new license is uploaded.
[Add the new license](../../user/admin_area/license.md#activate-gitlab-ee-with-an-activation-code) to your instance.
The new tier takes effect when the new license is activated.
## Add or change the contacts for your subscription
@ -447,7 +447,7 @@ an expiration message is displayed to all administrators.
For GitLab self-managed instances, you have a 14-day grace period
before this occurs.
- To resume functionality, upload a new license.
- To resume functionality, acticate a new license.
- To fall back to Free features, delete the expired license.
## Contact Support

View file

@ -15,6 +15,7 @@ and running quickly.
| Topic | Description | Good for beginners |
|-------|-------------|--------------------|
| <i class="fa fa-youtube-play youtube" aria-hidden="true"></i> [Introduction to GitLab](https://youtu.be/_4SmIyQ5eis?t=90) (59m 51s) | Walk through recommended processes and example workflows for using GitLab. | **{star}** |
| [GitLab 101](https://gitlab.edcast.com/pathways/copy-of-gitlab-certification) | Learn the basics of GitLab in this certification course. | **{star}** |
| <i class="fa fa-youtube-play youtube" aria-hidden="true"></i> [Use GitLab for DevOps](https://www.youtube.com/watch?v=7q9Y1Cv-ib0) (12m 34s) | Use GitLab through the entire DevOps lifecycle, from planning to monitoring. | **{star}** |
| [Use Markdown at GitLab](../user/markdown.md) | GitLab Flavored Markdown (GFM) is used in many areas of GitLab, for example, in merge requests. | **{star}** |

View file

@ -91,8 +91,8 @@ The steps can be summed up to:
sudo gitlab-ctl reconfigure
```
1. Now go to the GitLab admin panel of your server (`/admin/license/new`) and
upload your license file.
1. Now go to the GitLab admin panel of your server (`/admin/subscription`) and
[add your license](../../user/admin_area/license.md#activate-gitlab-ee-with-an-activation-code).
1. After you confirm that GitLab is working as expected, you may remove the old
Community Edition repository:

View file

@ -30,7 +30,7 @@ The Admin Area is made up of the following sections:
| **{hook}** System Hooks | Configure [system hooks](../../system_hooks/system_hooks.md) for many events. |
| **{applications}** Applications | Create system [OAuth applications](../../integration/oauth_provider.md) for integrations with other services. |
| **{slight-frown}** Abuse Reports | Manage [abuse reports](review_abuse_reports.md) submitted by your users. |
| **{license}** License | Upload, display, and remove [licenses](license.md). |
| **{license}** License | Add, display, and remove [licenses](license.md). |
| **{cloud-gear}** Kubernetes | Create and manage instance-level [Kubernetes clusters](../instance/clusters/index.md). |
| **{push-rules}** Push rules | Configure pre-defined Git [push rules](../project/repository/push_rules.md) for projects. Also, configure [merge requests approvers rules](merge_requests_approvals.md). |
| **{location-dot}** Geo | Configure and maintain [Geo nodes](geo_nodes.md). |

View file

@ -39,26 +39,24 @@ To activate your instance with an activation code:
1. On the left sidebar, select **Subscription**.
1. Enter the activation code in **Activation code**.
1. Read and accept the terms of service.
1. Select **Activate**.
1. Select **Add license**.
## Activate GitLab EE with a license file
## Activate GitLab EE with a license file or key
If you receive a license file from GitLab (for example, for a trial), you can
upload it to your instance or add it during installation. The license file is
a base64-encoded ASCII text file with a `.gitlab-license` extension.
## Upload your license
The first time you sign in to your GitLab instance, a note with a
link to the **Upload license** page should be displayed.
link to the **Add license** page should be displayed.
Otherwise, to upload your license:
Otherwise, to add your license:
1. Sign in to GitLab as an administrator.
1. On the top bar, select **Menu > Admin**.
1. On the left sidebar, select **Settings > General**.
1. In the **License file** area, select **Upload a license**.
1. Upload a license:
1. In the **License file** area, select **Add a license**.
1. Add a license:
- For a file, either:
- Select **Upload `.gitlab-license` file**, then **Choose File** and
select the license file from your local machine.
@ -66,7 +64,7 @@ Otherwise, to upload your license:
- For plain text, select **Enter license key** and paste the contents in
**License key**.
1. Select the **Terms of Service** checkbox.
1. Select **Upload License**.
1. Select **Add license**.
## Add your license during installation
@ -91,7 +89,7 @@ You can import a license file when you install GitLab.
WARNING:
These methods only add a license at the time of installation. To renew or upgrade
a license, upload the license in the **Admin Area** in the web user interface.
a license, add the license in the **Admin Area** in the web user interface.
## What happens when your license expires
@ -103,13 +101,13 @@ and issue creation. Your instance becomes read-only and
an expiration message displays to all administrators. You have a 14-day grace period
before this occurs.
To resume functionality, [upload a new license](#upload-your-license).
To resume functionality, [activate a new license](#activate-gitlab-ee-with-an-activation-code).
To go back to Free features, [delete all expired licenses](#remove-a-license-file).
To go back to Free features, [delete all expired licenses](#remove-a-license).
## Remove a license file
## Remove a license
To remove a license file from a self-managed instance:
To remove a license from a self-managed instance:
1. On the top bar, select **Menu > Admin**.
1. On the left sidebar, select **Subscription**.
@ -124,17 +122,17 @@ To view your license details:
1. On the top bar, select **Menu > Admin**.
1. On the left sidebar, select **Subscription**.
You can upload and view more than one license, but only the latest license in
You can add and view more than one license, but only the latest license in
the current date range is the active license.
When you upload a future-dated license, it doesn't take effect until its applicable date.
When you add a future-dated license, it doesn't take effect until its applicable date.
You can view all active subscriptions in the **Subscription history** table.
You can also [export](../../subscriptions/self_managed/index.md) your license usage information to a CSV file.
NOTE:
In GitLab 13.6 and earlier, a banner about an expiring license may continue to display
when you upload a new license. This happens when the start date of the new license
when you add a new license. This happens when the start date of the new license
is in the future and the expiring one is still active.
The banner disappears after the new license becomes active.
@ -142,18 +140,18 @@ The banner disappears after the new license becomes active.
### No Subscription area in the Admin Area
You cannot upload your license because there is no **Subscription** area.
You cannot add your license because there is no **Subscription** area.
This issue might occur if:
- You're running GitLab Community Edition. Before you upload your license, you
- You're running GitLab Community Edition. Before you add your license, you
must [upgrade to Enterprise Edition](../../update/index.md#community-to-enterprise-edition).
- You're using GitLab.com. You cannot upload a self-managed license to GitLab.com.
- You're using GitLab.com. You cannot add a self-managed license to GitLab.com.
To use paid features on GitLab.com, [purchase a separate subscription](../../subscriptions/gitlab_com/index.md).
### Users exceed license limit upon renewal
GitLab displays a message prompting you to purchase
additional users. This issue occurs if you upload a license that does not have enough
additional users. This issue occurs if you add a license that does not have enough
users to cover the number of users in your instance.
To fix this issue, purchase additional seats to cover those users.
@ -167,8 +165,8 @@ rules apply:
- If the users over license are more than 10% of the users in the license file,
you cannot apply the license without purchasing more users.
For example, if you purchase a license for 100 users, you can have 110 users when you activate
your license. However, if you have 111 users, you must purchase more users before you can activate
For example, if you purchase a license for 100 users, you can have 110 users when you add
your license. However, if you have 111 users, you must purchase more users before you can add
the license.
### Cannot activate instance due to connectivity error
@ -177,7 +175,7 @@ In GitLab 14.1 and later, to activate your subscription with an activation code,
your GitLab instance must be connected to the internet.
If you have an offline or airgapped environment,
[upload a license file](license.md#activate-gitlab-ee-with-a-license-file) instead.
[activate GitLab EE with a license file or key](license.md#activate-gitlab-ee-with-a-license-file-or-key) instead.
If you have questions or need assistance activating your instance,
[contact GitLab Support](https://about.gitlab.com/support/#contact-support).

View file

@ -20,18 +20,7 @@ module Atlassian
end
def type
case environment.name
when /\A(.*[^a-z0-9])?(staging|stage|stg|preprod|pre-prod|model|internal)([^a-z0-9].*)?\z/i
'staging'
when /\A(.*[^a-z0-9])?(prod|production|prd|live)([^a-z0-9].*)?\z/i
'production'
when /\A(.*[^a-z0-9])?(test|testing|tests|tst|integration|integ|intg|int|acceptance|accept|acpt|qa|qc|control|quality)([^a-z0-9].*)?\z/i
'testing'
when /\A(.*[^a-z0-9])?(dev|review|development)([^a-z0-9].*)?\z/i
'development'
else
'unmapped'
end
environment.tier == 'other' ? 'unmapped' : environment.tier
end
end
end

View file

@ -777,6 +777,9 @@ msgstr ""
msgid "%{linkStart}Learn more.%{linkEnd}"
msgstr ""
msgid "%{link_start}Add a license%{link_end} that you have received from GitLab Inc."
msgstr ""
msgid "%{link_start}Learn more%{link_end} about roles."
msgstr ""
@ -786,9 +789,6 @@ msgstr ""
msgid "%{link_start}Start the title with %{draft_snippet}%{link_end} to prevent a merge request draft from merging before it's ready."
msgstr ""
msgid "%{link_start}Upload a license%{link_end} file or enter the license key you have received from GitLab Inc."
msgstr ""
msgid "%{link_start}What information does GitLab Inc. collect?%{link_end}"
msgstr ""
@ -2043,6 +2043,9 @@ msgstr ""
msgid "Add LICENSE"
msgstr ""
msgid "Add License"
msgstr ""
msgid "Add New Site"
msgstr ""
@ -20461,7 +20464,7 @@ msgstr ""
msgid "IssueBoards|No matching boards found"
msgstr ""
msgid "IssueBoards|Some of your boards are hidden, activate a license to see them again."
msgid "IssueBoards|Some of your boards are hidden, add a license to see them again."
msgstr ""
msgid "IssueBoards|Switch board"
@ -35354,10 +35357,10 @@ msgstr ""
msgid "Subscription successfully deleted."
msgstr ""
msgid "SubscriptionBanner|Export license usage file"
msgid "SubscriptionBanner|Add new license"
msgstr ""
msgid "SubscriptionBanner|Upload new license"
msgid "SubscriptionBanner|Export license usage file"
msgstr ""
msgid "SubscriptionEmail|%{doc_link_start}Please reach out if you have questions%{doc_link_end}, and we'll be happy to assist."
@ -35738,9 +35741,6 @@ msgstr ""
msgid "SuperSonics|To activate your subscription, connect to GitLab servers through the %{linkStart}Cloud Licensing%{linkEnd} service, a hassle-free way to manage your subscription."
msgstr ""
msgid "SuperSonics|Upload a license file"
msgstr ""
msgid "SuperSonics|Users in subscription"
msgstr ""
@ -38443,7 +38443,7 @@ msgstr ""
msgid "To receive alerts from manually configured Prometheus services, add the following URL and Authorization key to your Prometheus webhook config file. Learn more about %{linkStart}configuring Prometheus%{linkEnd} to send alerts to GitLab."
msgstr ""
msgid "To renew, export your license usage file and email it to %{renewal_service_email}. A new license will be emailed to the email address registered in the %{customers_dot}. You can upload this license to your instance."
msgid "To renew, export your license usage file and email it to %{renewal_service_email}. A new license will be emailed to the email address registered in the %{customers_dot}. You can add this license to your instance."
msgstr ""
msgid "To resolve this, try to:"
@ -39469,9 +39469,6 @@ msgstr ""
msgid "Upload File"
msgstr ""
msgid "Upload License"
msgstr ""
msgid "Upload New File"
msgstr ""
@ -39490,9 +39487,6 @@ msgstr ""
msgid "Upload image"
msgstr ""
msgid "Upload license"
msgstr ""
msgid "Upload new file"
msgstr ""
@ -42284,10 +42278,10 @@ msgstr ""
msgid "You have insufficient permissions to view shifts for this rotation"
msgstr ""
msgid "You have more active users than are allowed by your license. Before %{date} GitLab must reconcile your subscription. To complete this process, export your license usage file and email it to %{renewal_service_email}. A new license will be emailed to the email address registered in the %{customers_dot}. You can upload this license to your instance."
msgid "You have more active users than are allowed by your license. Before %{date} GitLab must reconcile your subscription. To complete this process, export your license usage file and email it to %{renewal_service_email}. A new license will be emailed to the email address registered in the %{customers_dot}. You can add this license to your instance."
msgstr ""
msgid "You have more active users than are allowed by your license. GitLab must now reconcile your subscription. To complete this process, export your license usage file and email it to %{renewal_service_email}. A new license will be emailed to the email address registered in the %{customers_dot}. You can upload this license to your instance."
msgid "You have more active users than are allowed by your license. GitLab must now reconcile your subscription. To complete this process, export your license usage file and email it to %{renewal_service_email}. A new license will be emailed to the email address registered in the %{customers_dot}. You can add this license to your instance."
msgstr ""
msgid "You have no permissions"
@ -42773,7 +42767,7 @@ msgstr ""
msgid "Your subscription has %{remaining_seats_count} out of %{total_seats_count} seats remaining. Even if you reach the number of seats in your subscription, you can continue to add users, and GitLab will bill you for the overage."
msgstr ""
msgid "Your subscription is now expired. To renew, export your license usage file and email it to %{renewal_service_email}. A new license will be emailed to the email address registered in the %{customers_dot}. You can upload this license to your instance. To use Free tier, remove your current license."
msgid "Your subscription is now expired. To renew, export your license usage file and email it to %{renewal_service_email}. A new license will be emailed to the email address registered in the %{customers_dot}. You can add this license to your instance. To use Free tier, remove your current license."
msgstr ""
msgid "Your subscription will expire in %{remaining_days} day."

View file

@ -2,7 +2,7 @@
module QA
RSpec.describe 'Manage', :github, :requires_admin, :reliable do
describe 'Project import' do
describe 'Project import', issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/353583' do
let!(:api_client) { Runtime::API::Client.as_admin }
let!(:group) { Resource::Group.fabricate_via_api! { |resource| resource.api_client = api_client } }
let!(:user) do
@ -17,7 +17,7 @@ module QA
project.name = 'imported-project'
project.group = group
project.github_personal_access_token = Runtime::Env.github_access_token
project.github_repository_path = 'gitlab-qa-github/test-project'
project.github_repository_path = 'gitlab-qa-github/import-test'
project.api_client = api_client
end
end
@ -50,26 +50,27 @@ module QA
def verify_status_data
stats = imported_project.project_import_status.dig(:stats, :imported)
expect(stats).to eq(
label: 10,
expect(stats).to include(
# issue: 2,
label: 9,
milestone: 1,
issue: 2,
note: 2,
note: 3,
pull_request: 1,
pull_request_review: 2,
diff_note: 2
pull_request_review: 1,
diff_note: 1,
release: 1
)
end
def verify_repository_import
expect(imported_project.api_response).to include(
description: 'A new repo for test',
description: 'Project for github import test',
import_error: nil
)
end
def verify_commits_import
expect(imported_project.commits.length).to eq(20)
expect(imported_project.commits.length).to eq(2)
end
def verify_labels_import
@ -77,7 +78,6 @@ module QA
expect(labels).to include(
{ name: 'bug', color: '#d73a4a' },
{ name: 'custom new label', color: '#fc8f91' },
{ name: 'documentation', color: '#0075ca' },
{ name: 'duplicate', color: '#cfd3d7' },
{ name: 'enhancement', color: '#a2eeef' },
@ -94,10 +94,10 @@ module QA
expect(issues.length).to eq(1)
expect(issues.first).to include(
title: 'This is a sample issue',
description: "*Created by: gitlab-qa-github*\n\nThis is a sample first comment",
labels: ['custom new label', 'good first issue', 'help wanted'],
user_notes_count: 1
title: 'Test issue',
description: "*Created by: gitlab-qa-github*\n\nTest issue description",
labels: ['good first issue', 'help wanted', 'question'],
user_notes_count: 2
)
end
@ -105,7 +105,7 @@ module QA
milestones = imported_project.milestones
expect(milestones.length).to eq(1)
expect(milestones.first).to include(title: 'v1.0', description: nil, state: 'active')
expect(milestones.first).to include(title: '0.0.1', description: nil, state: 'active')
end
def verify_wikis_import
@ -126,20 +126,20 @@ module QA
expect(merge_requests.length).to eq(1)
expect(merge_request.api_resource).to include(
title: 'Improve readme',
title: 'Test pull request',
state: 'opened',
target_branch: 'main',
source_branch: 'improve-readme',
labels: %w[bug documentation],
source_branch: 'gitlab-qa-github-patch-1',
labels: %w[documentation],
description: <<~DSC.strip
*Created by: gitlab-qa-github*\n\nThis improves the README file a bit.\r\n\r\nTODO:\r\n\r\n \r\n\r\n- [ ] Do foo\r\n- [ ] Make bar\r\n - [ ] Think about baz
*Created by: gitlab-qa-github*\n\nTest pull request body
DSC
)
expect(mr_comments).to eq(
expect(mr_comments).to match_array(
[
"*Created by: gitlab-qa-github*\n\n[PR comment by @sliaquat] Nice work! ",
"*Created by: gitlab-qa-github*\n\n[Single diff comment] Nice addition",
"*Created by: gitlab-qa-github*\n\n[Single diff comment] Good riddance"
"*Created by: gitlab-qa-github*\n\n**Review:** Commented\n\nGood but needs some improvement",
"*Created by: gitlab-qa-github*\n\n```suggestion:-0+0\nProject for GitHub import test to GitLab\r\n```",
"*Created by: gitlab-qa-github*\n\nSome test PR comment"
]
)
end

View file

@ -3,7 +3,7 @@
module QA
RSpec.describe 'Manage', :github, :requires_admin do
describe 'Project import' do
let(:github_repo) { 'gitlab-qa-github/test-project' }
let(:github_repo) { 'gitlab-qa-github/import-test' }
let(:api_client) { Runtime::API::Client.as_admin }
let(:group) { Resource::Group.fabricate_via_api! { |resource| resource.api_client = api_client } }
let(:user) do
@ -55,7 +55,7 @@ module QA
Page::Project::Show.perform do |project|
aggregate_failures do
expect(project).to have_content(imported_project.name)
expect(project).to have_content('This test project is used for automated GitHub import by GitLab QA.')
expect(project).to have_content('Project for github import test')
end
end
end

View file

@ -27,6 +27,10 @@ RSpec.describe Admin::ClustersController do
create(:cluster, :disabled, :provided_by_gcp, :production_environment, :instance)
end
include_examples ':certificate_based_clusters feature flag index responses' do
let(:subject) { get_index }
end
it 'lists available clusters and displays html' do
get_index
@ -105,6 +109,10 @@ RSpec.describe Admin::ClustersController do
get :new, params: { provider: provider }
end
include_examples ':certificate_based_clusters feature flag controller responses' do
let(:subject) { go }
end
describe 'functionality for new cluster' do
context 'when omniauth has been configured' do
let(:key) { 'secret-key' }
@ -226,6 +234,10 @@ RSpec.describe Admin::ClustersController do
post :create_gcp, params: params
end
include_examples ':certificate_based_clusters feature flag controller responses' do
let(:subject) { post_create_gcp }
end
describe 'functionality' do
context 'when access token is valid' do
before do
@ -318,6 +330,10 @@ RSpec.describe Admin::ClustersController do
post :create_aws, params: params
end
include_examples ':certificate_based_clusters feature flag controller responses' do
let(:subject) { post_create_aws }
end
it 'creates a new cluster' do
expect(ClusterProvisionWorker).to receive(:perform_async)
expect { post_create_aws }.to change { Clusters::Cluster.count }
@ -375,6 +391,10 @@ RSpec.describe Admin::ClustersController do
post :create_user, params: params
end
include_examples ':certificate_based_clusters feature flag controller responses' do
let(:subject) { post_create_user }
end
describe 'functionality' do
context 'when creates a cluster' do
it 'creates a new cluster' do
@ -445,6 +465,10 @@ RSpec.describe Admin::ClustersController do
post :authorize_aws_role, params: params
end
include_examples ':certificate_based_clusters feature flag controller responses' do
let(:subject) { go }
end
before do
allow(Clusters::Aws::FetchCredentialsService).to receive(:new)
.and_return(double(execute: double))
@ -495,6 +519,10 @@ RSpec.describe Admin::ClustersController do
delete :clear_cache, params: { id: cluster }
end
include_examples ':certificate_based_clusters feature flag controller responses' do
let(:subject) { go }
end
it 'deletes the namespaces associated with the cluster' do
expect { go }.to change { Clusters::KubernetesNamespace.count }
@ -520,6 +548,10 @@ RSpec.describe Admin::ClustersController do
format: :json
end
include_examples ':certificate_based_clusters feature flag controller responses' do
let(:subject) { get_cluster_status }
end
describe 'functionality' do
it 'responds with matching schema' do
get_cluster_status
@ -555,6 +587,10 @@ RSpec.describe Admin::ClustersController do
}
end
include_examples ':certificate_based_clusters feature flag controller responses' do
let(:subject) { get_show }
end
describe 'functionality' do
render_views
@ -603,6 +639,10 @@ RSpec.describe Admin::ClustersController do
}
end
include_examples ':certificate_based_clusters feature flag controller responses' do
let(:subject) { put_update }
end
it 'updates and redirects back to show page' do
put_update
@ -694,6 +734,10 @@ RSpec.describe Admin::ClustersController do
}
end
include_examples ':certificate_based_clusters feature flag controller responses' do
let(:subject) { delete_destroy }
end
describe 'functionality' do
context 'when cluster is provided by GCP' do
context 'when cluster is created' do

View file

@ -32,6 +32,10 @@ RSpec.describe Groups::ClustersController do
create(:cluster, :disabled, :provided_by_gcp, :production_environment, cluster_type: :group_type, groups: [group])
end
include_examples ':certificate_based_clusters feature flag index responses' do
let(:subject) { go }
end
it 'lists available clusters and renders html' do
go
@ -116,6 +120,10 @@ RSpec.describe Groups::ClustersController do
get :new, params: { group_id: group, provider: provider }
end
include_examples ':certificate_based_clusters feature flag controller responses' do
let(:subject) { go }
end
describe 'functionality for new cluster' do
context 'when omniauth has been configured' do
let(:key) { 'secret-key' }
@ -255,6 +263,10 @@ RSpec.describe Groups::ClustersController do
post :create_gcp, params: params.merge(group_id: group)
end
include_examples ':certificate_based_clusters feature flag controller responses' do
let(:subject) { go }
end
describe 'functionality' do
context 'when access token is valid' do
before do
@ -349,6 +361,10 @@ RSpec.describe Groups::ClustersController do
post :create_user, params: params.merge(group_id: group)
end
include_examples ':certificate_based_clusters feature flag controller responses' do
let(:subject) { go }
end
describe 'functionality' do
context 'when creates a cluster' do
it 'creates a new cluster' do
@ -457,6 +473,10 @@ RSpec.describe Groups::ClustersController do
post :create_aws, params: params.merge(group_id: group)
end
include_examples ':certificate_based_clusters feature flag controller responses' do
let(:subject) { post_create_aws }
end
it 'creates a new cluster' do
expect(ClusterProvisionWorker).to receive(:perform_async)
expect { post_create_aws }.to change { Clusters::Cluster.count }
@ -519,6 +539,10 @@ RSpec.describe Groups::ClustersController do
post :authorize_aws_role, params: params.merge(group_id: group)
end
include_examples ':certificate_based_clusters feature flag controller responses' do
let(:subject) { go }
end
before do
allow(Clusters::Aws::FetchCredentialsService).to receive(:new)
.and_return(double(execute: double))
@ -579,6 +603,10 @@ RSpec.describe Groups::ClustersController do
}
end
include_examples ':certificate_based_clusters feature flag controller responses' do
let(:subject) { go }
end
it 'deletes the namespaces associated with the cluster' do
expect { go }.to change { Clusters::KubernetesNamespace.count }
@ -611,6 +639,10 @@ RSpec.describe Groups::ClustersController do
format: :json
end
include_examples ':certificate_based_clusters feature flag controller responses' do
let(:subject) { go }
end
describe 'functionality' do
it 'responds with matching schema' do
go
@ -651,6 +683,10 @@ RSpec.describe Groups::ClustersController do
}
end
include_examples ':certificate_based_clusters feature flag controller responses' do
let(:subject) { go }
end
describe 'functionality' do
render_views
@ -705,6 +741,10 @@ RSpec.describe Groups::ClustersController do
}
end
include_examples ':certificate_based_clusters feature flag controller responses' do
let(:subject) { go }
end
it 'updates and redirects back to show page' do
go
@ -802,6 +842,10 @@ RSpec.describe Groups::ClustersController do
}
end
include_examples ':certificate_based_clusters feature flag controller responses' do
let(:subject) { go }
end
describe 'functionality' do
context 'when cluster is provided by GCP' do
context 'when cluster is created' do

View file

@ -26,6 +26,10 @@ RSpec.describe Projects::ClustersController do
let!(:enabled_cluster) { create(:cluster, :provided_by_gcp, projects: [project]) }
let!(:disabled_cluster) { create(:cluster, :disabled, :provided_by_gcp, :production_environment, projects: [project]) }
include_examples ':certificate_based_clusters feature flag index responses' do
let(:subject) { go }
end
it 'lists available clusters and renders html' do
go
@ -118,6 +122,10 @@ RSpec.describe Projects::ClustersController do
}
end
include_examples ':certificate_based_clusters feature flag controller responses' do
let(:subject) { go }
end
describe 'functionality for new cluster' do
context 'when omniauth has been configured' do
let(:key) { 'secret-key' }
@ -264,6 +272,10 @@ RSpec.describe Projects::ClustersController do
post :create_gcp, params: params.merge(namespace_id: project.namespace, project_id: project)
end
include_examples ':certificate_based_clusters feature flag controller responses' do
let(:subject) { go }
end
describe 'functionality' do
context 'when access token is valid' do
before do
@ -360,6 +372,10 @@ RSpec.describe Projects::ClustersController do
post :create_user, params: params.merge(namespace_id: project.namespace, project_id: project)
end
include_examples ':certificate_based_clusters feature flag controller responses' do
let(:subject) { go }
end
describe 'functionality' do
context 'when creates a cluster' do
it 'creates a new cluster' do
@ -477,6 +493,10 @@ RSpec.describe Projects::ClustersController do
post :create_aws, params: params.merge(namespace_id: project.namespace, project_id: project)
end
include_examples ':certificate_based_clusters feature flag controller responses' do
let(:subject) { post_create_aws }
end
it 'creates a new cluster' do
expect(ClusterProvisionWorker).to receive(:perform_async)
expect { post_create_aws }.to change { Clusters::Cluster.count }
@ -548,6 +568,10 @@ RSpec.describe Projects::ClustersController do
.and_return(double(execute: double))
end
include_examples ':certificate_based_clusters feature flag controller responses' do
let(:subject) { go }
end
it 'updates the associated role with the supplied ARN' do
go
@ -603,6 +627,10 @@ RSpec.describe Projects::ClustersController do
}
end
include_examples ':certificate_based_clusters feature flag controller responses' do
let(:subject) { go }
end
it 'deletes the namespaces associated with the cluster' do
expect { go }.to change { Clusters::KubernetesNamespace.count }
@ -640,6 +668,10 @@ RSpec.describe Projects::ClustersController do
format: :json
end
include_examples ':certificate_based_clusters feature flag controller responses' do
let(:subject) { go }
end
describe 'functionality' do
it "responds with matching schema" do
go
@ -685,6 +717,10 @@ RSpec.describe Projects::ClustersController do
}
end
include_examples ':certificate_based_clusters feature flag controller responses' do
let(:subject) { go }
end
describe 'functionality' do
render_views
@ -749,6 +785,10 @@ RSpec.describe Projects::ClustersController do
}
end
include_examples ':certificate_based_clusters feature flag controller responses' do
let(:subject) { go }
end
it "updates and redirects back to show page" do
go
@ -842,6 +882,10 @@ RSpec.describe Projects::ClustersController do
}
end
include_examples ':certificate_based_clusters feature flag controller responses' do
let(:subject) { go }
end
describe 'functionality' do
context 'when cluster is provided by GCP' do
context 'when cluster is created' do

View file

@ -517,4 +517,112 @@ RSpec.describe ApplicationHelper do
end
end
end
describe '#dispensable_render' do
context 'when an error occurs in the template to be rendered' do
before do
allow(helper).to receive(:render).and_raise
end
it 'calls `track_and_raise_for_dev_exception`' do
expect(Gitlab::ErrorTracking).to receive(:track_and_raise_for_dev_exception)
helper.dispensable_render
end
context 'for development environment' do
before do
stub_rails_env('development')
end
it 'raises an error' do
expect { helper.dispensable_render }.to raise_error(StandardError)
end
end
context 'for production environments' do
before do
stub_rails_env('production')
end
it 'returns nil' do
expect(helper.dispensable_render).to be_nil
end
context 'when the feature flag is disabled' do
before do
stub_feature_flags(dispensable_render: false)
end
it 'raises an error' do
expect { helper.dispensable_render }.to raise_error(StandardError)
end
end
end
end
context 'when no error occurs in the template to be rendered' do
before do
allow(helper).to receive(:render).and_return('foo')
end
it 'does not track or raise and returns the rendered content' do
expect(Gitlab::ErrorTracking).not_to receive(:track_and_raise_for_dev_exception)
expect(helper.dispensable_render).to eq('foo')
end
end
end
describe '#dispensable_render_if_exists' do
context 'when an error occurs in the template to be rendered' do
before do
allow(helper).to receive(:render_if_exists).and_raise
end
it 'calls `track_and_raise_for_dev_exception`' do
expect(Gitlab::ErrorTracking).to receive(:track_and_raise_for_dev_exception)
helper.dispensable_render_if_exists
end
context 'for development environment' do
before do
stub_rails_env('development')
end
it 'raises an error' do
expect { helper.dispensable_render_if_exists }.to raise_error(StandardError)
end
end
context 'for production environments' do
before do
stub_rails_env('production')
end
it 'returns nil' do
expect(helper.dispensable_render_if_exists).to be_nil
end
context 'when the feature flag is disabled' do
before do
stub_feature_flags(dispensable_render: false)
end
it 'raises an error' do
expect { helper.dispensable_render_if_exists }.to raise_error(StandardError)
end
end
end
end
context 'when no error occurs in the template to be rendered' do
before do
allow(helper).to receive(:render_if_exists).and_return('foo')
end
it 'does not track or raise' do
expect(Gitlab::ErrorTracking).not_to receive(:track_and_raise_for_dev_exception)
expect(helper.dispensable_render_if_exists).to eq('foo')
end
end
end
end

View file

@ -45,33 +45,18 @@ RSpec.describe Atlassian::JiraConnect::Serializers::DeploymentEntity do
describe 'environment type' do
using RSpec::Parameterized::TableSyntax
where(:env_name, :env_type) do
'PRODUCTION' | 'production'
'prod' | 'production'
'prod-east-2' | 'production'
'us-prod-east' | 'production'
'fe-production' | 'production'
'test' | 'testing'
'qa-env-2' | 'testing'
'staging' | 'staging'
'pre-prod' | 'staging'
'blue-kit-stage' | 'staging'
'pre-prod' | 'staging'
'dev' | 'development'
'review/app' | 'development'
'something-else' | 'unmapped'
'store-produce' | 'unmapped'
'unproductive' | 'unmapped'
where(:tier, :env_type) do
'other' | 'unmapped'
end
with_them do
before do
environment.update!(name: env_name)
subject.environment.update!(tier: tier)
end
let(:exposed_type) { subject.send(:environment_entity).send(:type) }
it 'has the correct environment type' do
it 'has the same type as the environment tier' do
expect(exposed_type).to eq(env_type)
end
end

View file

@ -282,6 +282,13 @@ RSpec.describe Environment, :use_clean_rails_memory_store_caching do
'DEV' | described_class.tiers[:development]
'development' | described_class.tiers[:development]
'trunk' | described_class.tiers[:development]
'dev' | described_class.tiers[:development]
'review/app' | described_class.tiers[:development]
'PRODUCTION' | described_class.tiers[:production]
'prod' | described_class.tiers[:production]
'prod-east-2' | described_class.tiers[:production]
'us-prod-east' | described_class.tiers[:production]
'fe-production' | described_class.tiers[:production]
'test' | described_class.tiers[:testing]
'TEST' | described_class.tiers[:testing]
'testing' | described_class.tiers[:testing]
@ -290,6 +297,7 @@ RSpec.describe Environment, :use_clean_rails_memory_store_caching do
'production-test' | described_class.tiers[:testing]
'test-production' | described_class.tiers[:testing]
'QC' | described_class.tiers[:testing]
'qa-env-2' | described_class.tiers[:testing]
'gstg' | described_class.tiers[:staging]
'staging' | described_class.tiers[:staging]
'stage' | described_class.tiers[:staging]
@ -298,6 +306,10 @@ RSpec.describe Environment, :use_clean_rails_memory_store_caching do
'Pre-production' | described_class.tiers[:staging]
'pre' | described_class.tiers[:staging]
'Demo' | described_class.tiers[:staging]
'staging' | described_class.tiers[:staging]
'pre-prod' | described_class.tiers[:staging]
'blue-kit-stage' | described_class.tiers[:staging]
'pre-prod' | described_class.tiers[:staging]
'gprd' | described_class.tiers[:production]
'gprd-cny' | described_class.tiers[:production]
'production' | described_class.tiers[:production]
@ -307,6 +319,8 @@ RSpec.describe Environment, :use_clean_rails_memory_store_caching do
'production/eu' | described_class.tiers[:production]
'PRODUCTION/EU' | described_class.tiers[:production]
'productioneu' | described_class.tiers[:production]
'store-produce' | described_class.tiers[:production]
'unproductive' | described_class.tiers[:production]
'production/www.gitlab.com' | described_class.tiers[:production]
'prod' | described_class.tiers[:production]
'PROD' | described_class.tiers[:production]
@ -314,6 +328,7 @@ RSpec.describe Environment, :use_clean_rails_memory_store_caching do
'canary' | described_class.tiers[:other]
'other' | described_class.tiers[:other]
'EXP' | described_class.tiers[:other]
'something-else' | described_class.tiers[:other]
end
with_them do

View file

@ -27,3 +27,33 @@ RSpec.shared_examples 'GET new cluster shared examples' do
end
end
end
RSpec.shared_examples ':certificate_based_clusters feature flag index responses' do
context 'feature flag is disabled' do
before do
stub_feature_flags(certificate_based_clusters: false)
end
it 'does not list any clusters' do
subject
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:index)
expect(assigns(:clusters)).to be_empty
end
end
end
RSpec.shared_examples ':certificate_based_clusters feature flag controller responses' do
context 'feature flag is disabled' do
before do
stub_feature_flags(certificate_based_clusters: false)
end
it 'responds with :not_found' do
subject
expect(response).to have_gitlab_http_status(:not_found)
end
end
end