Commit f165091c authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'master' into ce-to-ee-2018-03-27

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parents 933f2cb3 1aec54db
Please view this file on the master branch, on stable branches it's out of date. Please view this file on the master branch, on stable branches it's out of date.
## 10.6.1 (2018-03-27)
### Fixed (8 changes)
- Fix LDAP group sync permission override UI. !5003
- Hard failing a mirror no longer fails for a blocked user's personal project. !5063
- Geo - Avoid rescheduling the same project again in a backfill condition. !5069
- Mark disabled wikis as fully synced. !5104
- Fix excessive updates to file_registry when wiki is disabled. !5119
- Geo: Recovery from temporary directory doesn't work if the namespace directory doesn't exist.
- Define a chat responder for the Slack app.
- Resolve "undefined method 'log_transfer_error'".
### Added (1 change)
- Also log Geo Prometheus metrics from primary. !5058
### Other (1 change)
- Update Epic documentation to include labels.
## 10.6.0 (2018-03-22) ## 10.6.0 (2018-03-22)
### Security (2 changes) ### Security (2 changes)
......
...@@ -2,6 +2,27 @@ ...@@ -2,6 +2,27 @@
documentation](doc/development/changelog.md) for instructions on adding your own documentation](doc/development/changelog.md) for instructions on adding your own
entry. entry.
## 10.6.1 (2018-03-27)
### Security (1 change)
- Bump rails-html-sanitizer to 1.0.4.
### Fixed (3 changes)
- Prevent auto-retry AccessDenied error from stopping transition to failed. !17862
- Fix 500 error when trying to resolve non-ASCII conflicts in the editor. !17962
- Don't capture trailing punctuation when autolinking. !17965
### Performance (1 change)
- Add indexes for user activity queries. !17890
### Other (1 change)
- Add documentation for runner IP address (#44232). !17837
## 10.6.0 (2018-03-22) ## 10.6.0 (2018-03-22)
### Security (4 changes) ### Security (4 changes)
......
...@@ -11,6 +11,7 @@ module Clusters ...@@ -11,6 +11,7 @@ module Clusters
Applications::Prometheus.application_name => Applications::Prometheus, Applications::Prometheus.application_name => Applications::Prometheus,
Applications::Runner.application_name => Applications::Runner Applications::Runner.application_name => Applications::Runner
}.freeze }.freeze
DEFAULT_ENVIRONMENT = '*'.freeze
belongs_to :user belongs_to :user
...@@ -52,6 +53,7 @@ module Clusters ...@@ -52,6 +53,7 @@ module Clusters
scope :enabled, -> { where(enabled: true) } scope :enabled, -> { where(enabled: true) }
scope :disabled, -> { where(enabled: false) } scope :disabled, -> { where(enabled: false) }
scope :default_environment, -> { where(environment_scope: DEFAULT_ENVIRONMENT) }
def status_name def status_name
if provider if provider
......
module DeploymentPlatform module DeploymentPlatform
# EE would override this and utilize the extra argument # EE would override this and utilize environment argument
# rubocop:disable Gitlab/ModuleWithInstanceVariables
def deployment_platform(environment: nil) def deployment_platform(environment: nil)
@deployment_platform ||= @deployment_platform ||= {}
find_cluster_platform_kubernetes ||
find_kubernetes_service_integration || @deployment_platform[environment] ||= find_deployment_platform(environment)
build_cluster_and_deployment_platform
end end
private private
def find_cluster_platform_kubernetes def find_deployment_platform(environment)
clusters.find_by(enabled: true)&.platform_kubernetes find_cluster_platform_kubernetes(environment: environment) ||
find_kubernetes_service_integration ||
build_cluster_and_deployment_platform
end
# EE would override this and utilize environment argument
def find_cluster_platform_kubernetes(environment: nil)
clusters.enabled.default_environment
.last&.platform_kubernetes
end end
def find_kubernetes_service_integration def find_kubernetes_service_integration
......
...@@ -16,6 +16,9 @@ ...@@ -16,6 +16,9 @@
= f.label :max_attachment_size, 'Maximum attachment size (MB)', class: 'control-label col-sm-2' = f.label :max_attachment_size, 'Maximum attachment size (MB)', class: 'control-label col-sm-2'
.col-sm-10 .col-sm-10
= f.number_field :max_attachment_size, class: 'form-control' = f.number_field :max_attachment_size, class: 'form-control'
= render 'repository_size_limit_setting', form: f
.form-group .form-group
= f.label :session_expire_delay, 'Session duration (minutes)', class: 'control-label col-sm-2' = f.label :session_expire_delay, 'Session duration (minutes)', class: 'control-label col-sm-2'
.col-sm-10 .col-sm-10
...@@ -36,4 +39,14 @@ ...@@ -36,4 +39,14 @@
= f.check_box :user_default_external = f.check_box :user_default_external
Newly registered users will by default be external Newly registered users will by default be external
- if ::Gitlab.dev_env_or_com?
.form-group
= f.label :check_namespace_plan, 'Check feature availability on namespace plan', class: 'control-label col-sm-2'
.col-sm-10
.checkbox
= f.label :check_namespace_plan do
= f.check_box :check_namespace_plan
Enabling this will only make licensed EE features available to projects if the project namespace's plan
includes the feature or if the project is public.
= f.submit 'Save changes', class: 'btn btn-success' = f.submit 'Save changes', class: 'btn btn-success'
...@@ -2,6 +2,11 @@ ...@@ -2,6 +2,11 @@
= form_errors(@application_setting) = form_errors(@application_setting)
%fieldset %fieldset
.form-group
= f.label :help_text, class: 'control-label'
.col-sm-10
= f.text_area :help_text, class: 'form-control', rows: 4
.help-block Markdown enabled
.form-group .form-group
= f.label :help_page_text, class: 'control-label col-sm-2' = f.label :help_page_text, class: 'control-label col-sm-2'
.col-sm-10 .col-sm-10
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
= f.label :default_branch_protection, class: 'control-label col-sm-2' = f.label :default_branch_protection, class: 'control-label col-sm-2'
.col-sm-10 .col-sm-10
= f.select :default_branch_protection, options_for_select(Gitlab::Access.protection_options, @application_setting.default_branch_protection), {}, class: 'form-control' = f.select :default_branch_protection, options_for_select(Gitlab::Access.protection_options, @application_setting.default_branch_protection), {}, class: 'form-control'
= render partial: 'admin/application_settings/ee/project_creation_level', locals: { form: f, application_setting: @application_setting }
.form-group.visibility-level-setting .form-group.visibility-level-setting
= f.label :default_project_visibility, class: 'control-label col-sm-2' = f.label :default_project_visibility, class: 'control-label col-sm-2'
.col-sm-10 .col-sm-10
...@@ -42,6 +43,19 @@ ...@@ -42,6 +43,19 @@
and GitLab.com and GitLab.com
= link_to "(?)", help_page_path("integration/gitlab") = link_to "(?)", help_page_path("integration/gitlab")
-# EE-only
- if ldap_enabled?
.form-group
= f.label :allow_group_owners_to_manage_ldap, 'LDAP settings', class: 'control-label col-sm-2'
.col-sm-10
.checkbox
= f.label :allow_group_owners_to_manage_ldap do
= f.check_box :allow_group_owners_to_manage_ldap
Allow group owners to manage LDAP-related settings
%span.help-block
If checked, group owners can manage LDAP group links and LDAP member overrides
= link_to icon('question-circle'), help_page_path('administration/auth/ldap-ee')
.form-group .form-group
.col-sm-offset-2.col-sm-10 .col-sm-offset-2.col-sm-10
.checkbox .checkbox
......
---
title: Add documentation for runner IP address (#44232)
merge_request: 17837
author:
type: other
---
title: Fix 500 error when trying to resolve non-ASCII conflicts in the editor
merge_request: 17962
author:
type: fixed
---
title: Don't capture trailing punctuation when autolinking
merge_request: 17965
author:
type: fixed
---
title: Add indexes for user activity queries.
merge_request: 17890
author:
type: performance
---
title: Prevent auto-retry AccessDenied error from stopping transition to failed
merge_request: 17862
author:
type: fixed
---
title: Bump rails-html-sanitizer to 1.0.4
merge_request:
author:
type: security
# Geo configuration (GitLab Omnibus) # Geo configuration (GitLab Omnibus)
>**Note:** NOTE: **Note:**
This is the documentation for the Omnibus GitLab packages. For installations This is the documentation for the Omnibus GitLab packages. For installations
from source, follow the [**Geo nodes configuration for installations from source, follow the [**Geo nodes configuration for installations
from source**][configuration-source] guide. from source**][configuration-source] guide.
## Configuring a new secondary node ## Configuring a new secondary node
>**Note:** NOTE: **Note:**
This is the final step in setting up a secondary Geo node. Stages of the This is the final step in setting up a secondary Geo node. Stages of the
setup process must be completed in the documented order. setup process must be completed in the documented order.
Before attempting the steps in this stage, [complete all prior stages][setup-geo-omnibus]. Before attempting the steps in this stage, [complete all prior stages][setup-geo-omnibus].
...@@ -20,9 +20,9 @@ You are encouraged to first read through all the steps before executing them ...@@ -20,9 +20,9 @@ You are encouraged to first read through all the steps before executing them
in your testing/production environment. in your testing/production environment.
> **Notes:** > **Notes:**
- **Do not** setup any custom authentication in the secondary nodes, this will be > - **Do not** setup any custom authentication in the secondary nodes, this will be
handled by the primary node. handled by the primary node.
- Any change that requires access to the **Admin Area** needs to be done in the > - Any change that requires access to the **Admin Area** needs to be done in the
primary node, as the secondary node is a read-only replica. primary node, as the secondary node is a read-only replica.
### Step 1. Manually replicate secret GitLab values ### Step 1. Manually replicate secret GitLab values
......
# Geo configuration (source) # Geo configuration (source)
>**Note:** NOTE: **Note:**
This is the documentation for installations from source. For installations This is the documentation for installations from source. For installations
using the Omnibus GitLab packages, follow the using the Omnibus GitLab packages, follow the
[**Omnibus Geo nodes configuration**][configuration] guide. [**Omnibus Geo nodes configuration**][configuration] guide.
## Configuring a new secondary node ## Configuring a new secondary node
>**Note:** NOTE: **Note:**
This is the final step in setting up a secondary Geo node. Stages of the setup This is the final step in setting up a secondary Geo node. Stages of the setup
process must be completed in the documented order. Before attempting the steps process must be completed in the documented order. Before attempting the steps
in this stage, [complete all prior stages][setup-geo-source]. in this stage, [complete all prior stages][setup-geo-source].
...@@ -20,7 +20,7 @@ You are encouraged to first read through all the steps before executing them ...@@ -20,7 +20,7 @@ You are encouraged to first read through all the steps before executing them
in your testing/production environment. in your testing/production environment.
>**Notes:** NOTE: **Notes:**
- **Do not** setup any custom authentication in the secondary nodes, this will be - **Do not** setup any custom authentication in the secondary nodes, this will be
handled by the primary node. handled by the primary node.
- **Do not** add anything in the secondaries Geo nodes admin area - **Do not** add anything in the secondaries Geo nodes admin area
......
# Geo database replication (GitLab Omnibus) # Geo database replication (GitLab Omnibus)
>**Note:** NOTE: **Note:**
This is the documentation for the Omnibus GitLab packages. For installations This is the documentation for the Omnibus GitLab packages. For installations
from source, follow the from source, follow the
[**database replication for installations from source**][database-source] guide. [**database replication for installations from source**][database-source] guide.
>**Note:** NOTE: **Note:**
If your GitLab installation uses external PostgreSQL, the Omnibus roles If your GitLab installation uses external PostgreSQL, the Omnibus roles
will not be able to perform all necessary configuration steps. Refer to the will not be able to perform all necessary configuration steps. Refer to the
section on [External PostreSQL][external postgresql] for additional instructions. section on [External PostreSQL][external postgresql] for additional instructions.
>**Note:** NOTE: **Note:**
The stages of the setup process must be completed in the documented order. The stages of the setup process must be completed in the documented order.
Before attempting the steps in this stage, [complete all prior stages][toc]. Before attempting the steps in this stage, [complete all prior stages][toc].
...@@ -28,7 +28,7 @@ The GitLab primary node where the write operations happen will connect to ...@@ -28,7 +28,7 @@ The GitLab primary node where the write operations happen will connect to
the primary database server, and the secondary nodes which are read-only will the primary database server, and the secondary nodes which are read-only will
connect to the secondary database servers (which are also read-only). connect to the secondary database servers (which are also read-only).
>**Note:** NOTE: **Note:**
In database documentation you may see "primary" being referenced as "master" In database documentation you may see "primary" being referenced as "master"
and "secondary" as either "slave" or "standby" server (read-only). and "secondary" as either "slave" or "standby" server (read-only).
...@@ -261,7 +261,8 @@ The following guide assumes that: ...@@ -261,7 +261,8 @@ The following guide assumes that:
gitlab-ctl stop sidekiq gitlab-ctl stop sidekiq
``` ```
> **Note**: This step is important so we don't try to execute anything before the node is fully configured. NOTE: **Note**:
This step is important so we don't try to execute anything before the node is fully configured.
1. [Check TCP connectivity][rake-maintenance] to the primary's PostgreSQL server: 1. [Check TCP connectivity][rake-maintenance] to the primary's PostgreSQL server:
...@@ -269,7 +270,8 @@ The following guide assumes that: ...@@ -269,7 +270,8 @@ The following guide assumes that:
gitlab-rake gitlab:tcp_check[1.2.3.4,5432] gitlab-rake gitlab:tcp_check[1.2.3.4,5432]
``` ```
> **Note**: If this step fails, you may be using the wrong IP address, or a firewall may NOTE: **Note**:
If this step fails, you may be using the wrong IP address, or a firewall may
be preventing access to the server. Check the IP address, paying close be preventing access to the server. Check the IP address, paying close
attention to the difference between public and private addresses and ensure attention to the difference between public and private addresses and ensure
that, if a firewall is present, the secondary is permitted to connect to the that, if a firewall is present, the secondary is permitted to connect to the
...@@ -368,7 +370,7 @@ The directories used are the defaults that are set up in Omnibus. If you have ...@@ -368,7 +370,7 @@ The directories used are the defaults that are set up in Omnibus. If you have
changed any defaults or are using a source installation, configure it as you changed any defaults or are using a source installation, configure it as you
see fit replacing the directories and paths. see fit replacing the directories and paths.
>**Warning:** CAUTION: **Warning:**
Make sure to run this on the **secondary** server as it removes all PostgreSQL's Make sure to run this on the **secondary** server as it removes all PostgreSQL's
data before running `pg_basebackup`. data before running `pg_basebackup`.
...@@ -384,8 +386,8 @@ data before running `pg_basebackup`. ...@@ -384,8 +386,8 @@ data before running `pg_basebackup`.
name as shown in the commands below. name as shown in the commands below.
1. Execute the command below to start a backup/restore and begin the replication 1. Execute the command below to start a backup/restore and begin the replication
>**Warning:** Each Geo secondary must have its own unique replication slot name. CAUTION: **Warning:** Each Geo secondary must have its own unique replication slot name.
Using the same slot name between two secondaries will break PostgreSQL replication. Using the same slot name between two secondaries will break PostgreSQL replication.
```bash ```bash
gitlab-ctl replicate-geo-database --slot-name=secondary_example --host=1.2.3.4 gitlab-ctl replicate-geo-database --slot-name=secondary_example --host=1.2.3.4
......
# Geo database replication (source) # Geo database replication (source)
>**Note:** NOTE: **Note:**
This is the documentation for installations from source. For installations This is the documentation for installations from source. For installations
using the Omnibus GitLab packages, follow the using the Omnibus GitLab packages, follow the
[**database replication for Omnibus GitLab**][database] guide. [**database replication for Omnibus GitLab**][database] guide.
>**Note:** NOTE: **Note:**
The stages of the setup process must be completed in the documented order. The stages of the setup process must be completed in the documented order.
Before attempting the steps in this stage, [complete all prior stages][toc]. Before attempting the steps in this stage, [complete all prior stages][toc].
...@@ -22,7 +22,7 @@ The GitLab primary node where the write operations happen will connect to ...@@ -22,7 +22,7 @@ The GitLab primary node where the write operations happen will connect to
primary database server, and the secondary ones which are read-only will primary database server, and the secondary ones which are read-only will
connect to secondary database servers (which are read-only too). connect to secondary database servers (which are read-only too).
>**Note:** NOTE: **Note:**
In many databases documentation you will see "primary" being referenced as "master" In many databases documentation you will see "primary" being referenced as "master"
and "secondary" as either "slave" or "standby" server (read-only). and "secondary" as either "slave" or "standby" server (read-only).
...@@ -91,10 +91,11 @@ The following guide assumes that: ...@@ -91,10 +91,11 @@ The following guide assumes that:
1. Set up TLS support for the PostgreSQL primary server 1. Set up TLS support for the PostgreSQL primary server
> **Warning**: Only skip this step if you **know** that PostgreSQL traffic CAUTION: **Warning**:
> between the primary and secondary will be secured through some other Only skip this step if you **know** that PostgreSQL traffic
> means, e.g., a known-safe physical network path or a site-to-site VPN that between the primary and secondary will be secured through some other
> you have configured. means, e.g., a known-safe physical network path or a site-to-site VPN that
you have configured.
If you are replicating your database across the open Internet, it is If you are replicating your database across the open Internet, it is
**essential** that the connection is TLS-secured. Correctly configured, this **essential** that the connection is TLS-secured. Correctly configured, this
...@@ -141,6 +142,7 @@ The following guide assumes that: ...@@ -141,6 +142,7 @@ The following guide assumes that:
hot_standby = on hot_standby = on
``` ```
NOTE: **Note**:
Be sure to set `max_replication_slots` to the number of Geo secondary Be sure to set `max_replication_slots` to the number of Geo secondary
nodes that you may potentially have (at least 1). nodes that you may potentially have (at least 1).
...@@ -302,7 +304,7 @@ needed files for streaming replication. ...@@ -302,7 +304,7 @@ needed files for streaming replication.
The directories used are the defaults for Debian/Ubuntu. If you have changed The directories used are the defaults for Debian/Ubuntu. If you have changed
any defaults, configure it as you see fit replacing the directories and paths. any defaults, configure it as you see fit replacing the directories and paths.
>**Warning:** CAUTION: **Warning:**
Make sure to run this on the **secondary** server as it removes all PostgreSQL's Make sure to run this on the **secondary** server as it removes all PostgreSQL's
data before running `pg_basebackup`. data before running `pg_basebackup`.
......
...@@ -2,15 +2,12 @@ module EE ...@@ -2,15 +2,12 @@ module EE
module DeploymentPlatform module DeploymentPlatform
extend ::Gitlab::Utils::Override extend ::Gitlab::Utils::Override
override :deployment_platform override :find_cluster_platform_kubernetes
def deployment_platform(environment: nil) def find_cluster_platform_kubernetes(environment: nil)
return super unless environment && feature_available?(:multiple_clusters) return super unless environment && feature_available?(:multiple_clusters)
@deployment_platform ||= # rubocop:disable Gitlab/ModuleWithInstanceVariables clusters.enabled.on_environment(environment.name)
clusters.enabled.on_environment(environment.name) .last&.platform_kubernetes
.last&.platform_kubernetes
super # Wildcard or KubernetesService
end end
end end
end end
---
title: Resolve "undefined method 'log_transfer_error'"
merge_request:
author:
type: fixed
---
title: Fixes incorrect assignation of cluster details
merge_request: 5047
author:
type: fixed
---
title: Hard failing a mirror no longer fails for a blocked user's personal project
merge_request: 5063
author:
type: fixed
---
title: 'Geo: Recovery from temporary directory doesn''t work if the namespace directory
doesn''t exist'
merge_request:
author:
type: fixed
---
title: Define a chat responder for the Slack app
merge_request:
author:
type: fixed
---
title: Geo - Avoid rescheduling the same project again in a backfill condition
merge_request: 5069
author:
type: fixed
---
title: Update Epic documentation to include labels
merge_request:
author:
type: other
---
title: Fix LDAP group sync permission override UI
merge_request: 5003
author:
type: fixed
---
title: Mark disabled wikis as fully synced
merge_request: 5104
author:
type: fixed
---
title: Fix excessive updates to file_registry when wiki is disabled
merge_request: 5119
author:
type: fixed
---
title: Also log Geo Prometheus metrics from primary
merge_request: 5058
author:
type: added
...@@ -17,7 +17,7 @@ describe 'Project show page', :feature do ...@@ -17,7 +17,7 @@ describe 'Project show page', :feature do
it '"Kubernetes cluster" button linked to clusters page' do it '"Kubernetes cluster" button linked to clusters page' do
create(:cluster, :provided_by_gcp, projects: [project]) create(:cluster, :provided_by_gcp, projects: [project])
create(:cluster, :provided_by_gcp, projects: [project]) create(:cluster, :provided_by_gcp, :production_environment, projects: [project])
visit project_path(project) visit project_path(project)
......
...@@ -4,56 +4,56 @@ describe EE::DeploymentPlatform do ...@@ -4,56 +4,56 @@ describe EE::DeploymentPlatform do
describe '#deployment_platform' do describe '#deployment_platform' do
let(:project) { create(:project) } let(:project) { create(:project) }
context 'when environment is specified' do shared_examples 'matching environment scope' do
let(:environment) { create(:environment, project: project, name: 'review/name') } context 'when multiple clusters license is available' do
let!(:default_cluster) { create(:cluster, :provided_by_user, projects: [project], environment_scope: '*') } before do
let!(:cluster) { create(:cluster, :provided_by_user, environment_scope: 'review/*', projects: [project]) } stub_licensed_features(multiple_clusters: true)
end
subject { project.deployment_platform(environment: environment) }
shared_examples 'matching environment scope' do
context 'when multiple clusters is available' do
before do
stub_licensed_features(multiple_clusters: true)
end
it 'returns environment specific cluster' do it 'returns environment specific cluster' do
is_expected.to eq(cluster.platform_kubernetes) is_expected.to eq(cluster.platform_kubernetes)
end
end end
end
context 'when multiple clusters is unavailable' do context 'when multiple clusters licence is unavailable' do
before do before do
stub_licensed_features(multiple_clusters: false) stub_licensed_features(multiple_clusters: false)
end end
it 'returns a kubernetes platform' do it 'returns a kubernetes platform' do
is_expected.to be_kind_of(Clusters::Platforms::Kubernetes) is_expected.to be_kind_of(Clusters::Platforms::Kubernetes)
end
end end
end end
end
shared_examples 'not matching environment scope' do shared_examples 'not matching environment scope' do
context 'when multiple clusters is available' do context 'when multiple clusters license is available' do
before do before do
stub_licensed_features(multiple_clusters: true) stub_licensed_features(multiple_clusters: true)
end end
it 'returns default cluster' do it 'returns default cluster' do
is_expected.to eq(default_cluster.platform_kubernetes) is_expected.to eq(default_cluster.platform_kubernetes)
end
end end
end
context 'when multiple clusters is unavailable' do context 'when multiple clusters license is unavailable' do
before do before do
stub_licensed_features(multiple_clusters: false) stub_licensed_features(multiple_clusters: false)
end end
it 'returns a kubernetes platform' do it 'returns a kubernetes platform' do
is_expected.to be_kind_of(Clusters::Platforms::Kubernetes) is_expected.to be_kind_of(Clusters::Platforms::Kubernetes)
end
end end
end end
end
context 'when environment is specified' do
let!(:default_cluster) { create(:cluster, :provided_by_user, projects: [project], environment_scope: '*') }
let!(:cluster) { create(:cluster, :provided_by_user, environment_scope: 'review/*', projects: [project]) }
let(:environment) { create(:environment, project: project, name: 'review/name') }
subject { project.deployment_platform(environment: environment) }
context 'when environment scope is exactly matched' do context 'when environment scope is exactly matched' do
before do before do
...@@ -133,5 +133,21 @@ describe EE::DeploymentPlatform do ...@@ -133,5 +133,21 @@ describe EE::DeploymentPlatform do
end end
end end
end end
context 'with multiple clusters and multiple environments' do
let!(:cluster_1) { create(:cluster, :provided_by_user, projects: [project], environment_scope: 'staging/*') }
let!(:cluster_2) { create(:cluster, :provided_by_user, projects: [project], environment_scope: 'test/*') }
let(:environment_1) { create(:environment, project: project, name: 'staging/name') }
let(:environment_2) { create(:environment, project: project, name: 'test/name') }
before do
stub_licensed_features(multiple_clusters: true)
end
it 'should return the appropriate cluster' do
expect(project.deployment_platform(environment: environment_1)).to eq(cluster_1.platform_kubernetes)
expect(project.deployment_platform(environment: environment_2)).to eq(cluster_2.platform_kubernetes)
end
end
end end
end end
...@@ -18,7 +18,7 @@ describe Projects::ClustersController do ...@@ -18,7 +18,7 @@ describe Projects::ClustersController do
context 'when project has one or more clusters' do context 'when project has one or more clusters' do
let(:project) { create(:project) } let(:project) { create(:project) }
let!(:enabled_cluster) { create(:cluster, :provided_by_gcp, projects: [project]) } let!(:enabled_cluster) { create(:cluster, :provided_by_gcp, projects: [project]) }
let!(:disabled_cluster) { create(:cluster, :disabled, :provided_by_gcp, projects: [project]) } let!(:disabled_cluster) { create(:cluster, :disabled, :provided_by_gcp, :production_environment, projects: [project]) }
it 'lists available clusters' do it 'lists available clusters' do
go go
...@@ -32,7 +32,7 @@ describe Projects::ClustersController do ...@@ -32,7 +32,7 @@ describe Projects::ClustersController do
before do before do
allow(Clusters::Cluster).to receive(:paginates_per).and_return(1) allow(Clusters::Cluster).to receive(:paginates_per).and_return(1)
create_list(:cluster, 2, :provided_by_gcp, projects: [project]) create_list(:cluster, 2, :provided_by_gcp, :production_environment, projects: [project])
get :index, namespace_id: project.namespace, project_id: project, page: last_page get :index, namespace_id: project.namespace, project_id: project, page: last_page
end end
...@@ -420,7 +420,7 @@ describe Projects::ClustersController do ...@@ -420,7 +420,7 @@ describe Projects::ClustersController do
context 'when cluster is provided by GCP' do context 'when cluster is provided by GCP' do
context 'when cluster is created' do context 'when cluster is created' do
let!(:cluster) { create(:cluster, :provided_by_gcp, projects: [project]) } let!(:cluster) { create(:cluster, :provided_by_gcp, :production_environment, projects: [project]) }
it "destroys and redirects back to clusters list" do it "destroys and redirects back to clusters list" do
expect { go } expect { go }
...@@ -434,7 +434,7 @@ describe Projects::ClustersController do ...@@ -434,7 +434,7 @@ describe Projects::ClustersController do
end end
context 'when cluster is being created' do context 'when cluster is being created' do
let!(:cluster) { create(:cluster, :providing_by_gcp, projects: [project]) } let!(:cluster) { create(:cluster, :providing_by_gcp, :production_environment, projects: [project]) }
it "destroys and redirects back to clusters list" do it "destroys and redirects back to clusters list" do
expect { go } expect { go }
...@@ -448,7 +448,7 @@ describe Projects::ClustersController do ...@@ -448,7 +448,7 @@ describe Projects::ClustersController do
end end
context 'when cluster is provided by user' do context 'when cluster is provided by user' do
let!(:cluster) { create(:cluster, :provided_by_user, projects: [project]) } let!(:cluster) { create(:cluster, :provided_by_user, :production_environment, projects: [project]) }
it "destroys and redirects back to clusters list" do it "destroys and redirects back to clusters list" do
expect { go } expect { go }
...@@ -463,7 +463,7 @@ describe Projects::ClustersController do ...@@ -463,7 +463,7 @@ describe Projects::ClustersController do
end end
describe 'security' do describe 'security' do
set(:cluster) { create(:cluster, :provided_by_gcp, projects: [project]) } set(:cluster) { create(:cluster, :provided_by_gcp, :production_environment, projects: [project]) }
it { expect { go }.to be_allowed_for(:admin) } it { expect { go }.to be_allowed_for(:admin) }
it { expect { go }.to be_allowed_for(:owner).of(project) } it { expect { go }.to be_allowed_for(:owner).of(project) }
......
...@@ -2,7 +2,6 @@ FactoryBot.define do ...@@ -2,7 +2,6 @@ FactoryBot.define do
factory :cluster, class: Clusters::Cluster do factory :cluster, class: Clusters::Cluster do
user user
name 'test-cluster' name 'test-cluster'
sequence(:environment_scope) { |n| "production#{n}/*" }
trait :project do trait :project do
before(:create) do |cluster, evaluator| before(:create) do |cluster, evaluator|
...@@ -33,5 +32,9 @@ FactoryBot.define do ...@@ -33,5 +32,9 @@ FactoryBot.define do
trait :disabled do trait :disabled do
enabled false enabled false
end end
trait :production_environment do
sequence(:environment_scope) { |n| "production#{n}/*" }
end
end end
end end
...@@ -32,15 +32,16 @@ feature 'Admin updates settings' do ...@@ -32,15 +32,16 @@ feature 'Admin updates settings' do
expect(find('#application_setting_visibility_level_20')).not_to be_checked expect(find('#application_setting_visibility_level_20')).not_to be_checked
end end
<<<<<<< HEAD
describe 'LDAP settings' do describe 'LDAP settings' do
context 'with LDAP enabled' do context 'with LDAP enabled' do
scenario 'Change allow group owners to manage ldap' do scenario 'Change allow group owners to manage ldap' do
allow(Gitlab::Auth::LDAP::Config).to receive(:enabled?).and_return(true) allow(Gitlab::Auth::LDAP::Config).to receive(:enabled?).and_return(true)
visit admin_application_settings_path visit admin_application_settings_path
find('#application_setting_allow_group_owners_to_manage_ldap').set(false) page.within('.as-visibility-access') do
click_button 'Save' find('#application_setting_allow_group_owners_to_manage_ldap').set(false)
click_button 'Save'
end
expect(page).to have_content('Application settings saved successfully') expect(page).to have_content('Application settings saved successfully')
expect(find('#application_setting_allow_group_owners_to_manage_ldap')).not_to be_checked expect(find('#application_setting_allow_group_owners_to_manage_ldap')).not_to be_checked
...@@ -56,15 +57,6 @@ feature 'Admin updates settings' do ...@@ -56,15 +57,6 @@ feature 'Admin updates settings' do
end end
end end
scenario 'Change application settings' do
uncheck 'Gravatar enabled'
fill_in 'Home page URL', with: 'https://about.gitlab.com/'
fill_in 'Help page text', with: 'Example text'
check 'Hide marketing-related entries from help'
fill_in 'Support page URL', with: 'http://example.com/help'
uncheck 'Project export enabled'
click_button 'Save'
=======
scenario 'Change Visibility and Access Controls' do scenario 'Change Visibility and Access Controls' do
page.within('.as-visibility-access') do page.within('.as-visibility-access') do
uncheck 'Project export enabled' uncheck 'Project export enabled'
...@@ -80,7 +72,6 @@ feature 'Admin updates settings' do ...@@ -80,7 +72,6 @@ feature 'Admin updates settings' do
uncheck 'Gravatar enabled' uncheck 'Gravatar enabled'
click_button 'Save changes' click_button 'Save changes'
end end
>>>>>>> upstream/master
expect(Gitlab::CurrentSettings.gravatar_enabled).to be_falsey expect(Gitlab::CurrentSettings.gravatar_enabled).to be_falsey
expect(page).to have_content "Application settings saved successfully" expect(page).to have_content "Application settings saved successfully"
......
...@@ -6,7 +6,7 @@ describe ClustersFinder do ...@@ -6,7 +6,7 @@ describe ClustersFinder do
describe '#execute' do describe '#execute' do
let(:enabled_cluster) { create(:cluster, :provided_by_gcp, projects: [project]) } let(:enabled_cluster) { create(:cluster, :provided_by_gcp, projects: [project]) }
let(:disabled_cluster) { create(:cluster, :disabled, :provided_by_gcp, projects: [project]) } let(:disabled_cluster) { create(:cluster, :disabled, :provided_by_gcp, :production_environment, projects: [project]) }
subject { described_class.new(project, user, scope).execute } subject { described_class.new(project, user, scope).execute }
......
...@@ -378,7 +378,7 @@ describe Environment do ...@@ -378,7 +378,7 @@ describe Environment do
shared_examples 'same behavior between KubernetesService and Platform::Kubernetes' do shared_examples 'same behavior between KubernetesService and Platform::Kubernetes' do
it 'returns the terminals from the deployment service' do it 'returns the terminals from the deployment service' do
expect(project.deployment_platform) expect(project.deployment_platform(environment: environment))
.to receive(:terminals).with(environment) .to receive(:terminals).with(environment)
.and_return(:fake_terminals) .and_return(:fake_terminals)
...@@ -419,7 +419,7 @@ describe Environment do ...@@ -419,7 +419,7 @@ describe Environment do
end end
it 'returns the rollout status from the deployment service' do it 'returns the rollout status from the deployment service' do
expect(project.deployment_platform) expect(project.deployment_platform(environment: environment))
.to receive(:rollout_status).with(environment) .to receive(:rollout_status).with(environment)
.and_return(:fake_rollout_status) .and_return(:fake_rollout_status)
......
...@@ -339,7 +339,7 @@ describe ProjectPresenter do ...@@ -339,7 +339,7 @@ describe ProjectPresenter do
it 'returns link to clusters page if more than one exists' do it 'returns link to clusters page if more than one exists' do
project.add_master(user) project.add_master(user)
create(:cluster, projects: [project]) create(:cluster, :production_environment, projects: [project])
create(:cluster, projects: [project]) create(:cluster, projects: [project])
expect(presenter.kubernetes_cluster_anchor_data).to eq(OpenStruct.new(enabled: true, expect(presenter.kubernetes_cluster_anchor_data).to eq(OpenStruct.new(enabled: true,
......
...@@ -81,7 +81,7 @@ describe Clusters::CreateService do ...@@ -81,7 +81,7 @@ describe Clusters::CreateService do
end end
context 'when project has a cluster' do context 'when project has a cluster' do
let!(:cluster) { create(:cluster, :provided_by_gcp, projects: [project]) } let!(:cluster) { create(:cluster, :provided_by_gcp, :production_environment, projects: [project]) }
before do before do
allow(project).to receive(:feature_available?).and_call_original allow(project).to receive(:feature_available?).and_call_original
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment