Commit c384315a authored by GitLab Bot's avatar GitLab Bot

Add latest changes from gitlab-org/gitlab@master

parent e1e017dd
......@@ -3,7 +3,7 @@
class InstanceStatistics::ConversationalDevelopmentIndexController < InstanceStatistics::ApplicationController
# rubocop: disable CodeReuse/ActiveRecord
def index
@metric = ConversationalDevelopmentIndex::Metric.order(:created_at).last&.present
@metric = DevOpsScore::Metric.order(:created_at).last&.present
end
# rubocop: enable CodeReuse/ActiveRecord
end
# frozen_string_literal: true
module ConversationalDevelopmentIndexHelper
module DevOpsScoreHelper
def score_level(score)
if score < 33.33
'low'
......
# frozen_string_literal: true
module ConversationalDevelopmentIndex
module DevOpsScore
class Card
attr_accessor :metric, :title, :description, :feature, :blog, :docs
......
# frozen_string_literal: true
module ConversationalDevelopmentIndex
module DevOpsScore
class IdeaToProductionStep
attr_accessor :metric, :title, :features
......
# frozen_string_literal: true
module ConversationalDevelopmentIndex
module DevOpsScore
class Metric < ApplicationRecord
include Presentable
......
# frozen_string_literal: true
module ConversationalDevelopmentIndex
module DevOpsScore
class MetricPresenter < Gitlab::View::Presenter::Simple
def cards
[
......
......@@ -38,7 +38,7 @@ class SubmitUsagePingService
def store_metrics(response)
return unless response['conv_index'].present?
ConversationalDevelopmentIndex::Metric.create!(
DevOpsScore::Metric.create!(
response['conv_index'].slice(*METRICS)
)
end
......
---
title: CI template for installing cluster applications
merge_request: 20822
author:
type: added
---
title: Move operations project routes under - scope
merge_request: 20456
author:
type: deprecated
---
title: Add e2e qa test for email delivery
merge_request: 20675
author: Diego Louzán
type: other
......@@ -209,6 +209,55 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
get :production
end
end
concerns :clusterable
namespace :serverless do
scope :functions do
get '/:environment_id/:id', to: 'functions#show'
get '/:environment_id/:id/metrics', to: 'functions#metrics', as: :metrics
end
resources :functions, only: [:index]
end
resources :environments, except: [:destroy] do
member do
post :stop
get :terminal
get :metrics
get :additional_metrics
get :metrics_dashboard
get '/terminal.ws/authorize', to: 'environments#terminal_websocket_authorize', constraints: { format: nil }
get '/prometheus/api/v1/*proxy_path', to: 'environments/prometheus_api#proxy', as: :prometheus_api
end
collection do
get :metrics, action: :metrics_redirect
get :folder, path: 'folders/*id', constraints: { format: /(html|json)/ }
get :search
end
resources :deployments, only: [:index] do
member do
get :metrics
get :additional_metrics
end
end
end
resources :error_tracking, only: [:index], controller: :error_tracking do
collection do
get ':issue_id/details',
to: 'error_tracking#details',
as: 'details'
get ':issue_id/stack_trace',
to: 'error_tracking#stack_trace',
as: 'stack_trace'
post :list_projects
end
end
end
# End of the /-/ scope.
......@@ -373,43 +422,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end
end
concerns :clusterable
resources :environments, except: [:destroy] do
member do
post :stop
get :terminal
get :metrics
get :additional_metrics
get :metrics_dashboard
get '/terminal.ws/authorize', to: 'environments#terminal_websocket_authorize', constraints: { format: nil }
get '/prometheus/api/v1/*proxy_path', to: 'environments/prometheus_api#proxy', as: :prometheus_api
end
collection do
get :metrics, action: :metrics_redirect
get :folder, path: 'folders/*id', constraints: { format: /(html|json)/ }
get :search
end
resources :deployments, only: [:index] do
member do
get :metrics
get :additional_metrics
end
end
end
namespace :serverless do
scope :functions do
get '/:environment_id/:id', to: 'functions#show'
get '/:environment_id/:id/metrics', to: 'functions#metrics', as: :metrics
end
resources :functions, only: [:index]
end
draw :legacy_builds
resources :hooks, only: [:index, :create, :edit, :update, :destroy], constraints: { id: /\d+/ } do
......@@ -507,18 +519,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end
end
resources :error_tracking, only: [:index], controller: :error_tracking do
collection do
get ':issue_id/details',
to: 'error_tracking#details',
as: 'details'
get ':issue_id/stack_trace',
to: 'error_tracking#stack_trace',
as: 'stack_trace'
post :list_projects
end
end
scope :usage_ping, controller: :usage_ping do
post :web_ide_clientside_preview
end
......@@ -540,7 +540,9 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
:project_members, :deploy_keys, :deploy_tokens,
:labels, :milestones, :services, :boards, :releases,
:forks, :group_links, :import, :avatar, :mirror,
:cycle_analytics, :mattermost, :variables, :triggers)
:cycle_analytics, :mattermost, :variables, :triggers,
:environments, :protected_environments, :error_tracking,
:serverless, :clusters, :audit_events)
end
# rubocop: disable Cop/PutProjectRoutesUnderScope
......
Gitlab::Seeder.quiet do
conversational_development_index_metric = ConversationalDevelopmentIndex::Metric.new(
dev_ops_score_metric = DevOpsScore::Metric.new(
leader_issues: 10.2,
instance_issues: 3.2,
......@@ -31,10 +31,10 @@ Gitlab::Seeder.quiet do
instance_service_desk_issues: 15.1
)
if conversational_development_index_metric.save
if dev_ops_score_metric.save
print '.'
else
puts conversational_development_index_metric.errors.full_messages
puts dev_ops_score_metric.errors.full_messages
print 'F'
end
end
......@@ -4,12 +4,18 @@ type: reference
# Smartcard authentication **(PREMIUM ONLY)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/33669) in GitLab 12.6,
if a user has a pre-existing username and password, they can still use that to log
in by default. However, this can be disabled.
GitLab supports authentication using smartcards.
## Existing password authentication
> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/33669) in GitLab 12.6.
By default, existing users can continue to log in with a username and password when smartcard
authentication is enabled.
To force existing users to use only smartcard authentication,
[disable username and password authentication](../../user/admin_area/settings/sign_in_restrictions.md#password-authentication-enabled).
## Authentication methods
GitLab supports two authentication methods:
......@@ -88,10 +94,7 @@ Certificate:
### Authentication against an LDAP server
> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/7693) in
[GitLab Premium](https://about.gitlab.com/pricing/) 11.8 as an experimental
feature. Smartcard authentication against an LDAP server may change or be
removed completely in future releases.
> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/7693) in [GitLab Premium](https://about.gitlab.com/pricing/) 11.8 as an experimental feature. Smartcard authentication against an LDAP server may change or be removed completely in future releases.
GitLab implements a standard way of certificate matching following
[RFC4523](https://tools.ietf.org/html/rfc4523). It uses the
......
......@@ -78,7 +78,7 @@ document.addEventListener('DOMContentLoaded', () => new Vue({
render(createElement) {
return createElement('my-component', {
props: {
endpoint: this.isLoading,
endpoint: this.endpoint,
},
});
},
......
......@@ -429,6 +429,69 @@ administrator to run following command within a Rails console:
Feature.enable(:enable_cluster_application_crossplane)
```
## Install using GitLab CI (alpha)
> [Introduced](https://gitlab.com/gitlab-org/gitlab/merge_requests/20822) in GitLab 12.6.
CAUTION: **Warning:**
This is an _alpha_ feature, and it is subject to change at any time without
prior notice.
This alternative method allows users to install GitLab-managed
applications using GitLab CI. It also allows customization of the
install using Helm `values.yaml` files.
Supported applications:
- [Ingress](#install-ingress-using-gitlab-ci)
### Usage
To install applications using GitLab CI:
1. Connect the cluster to a [cluster management project](management_project.md).
1. In that project, add a `.gitlab-ci.yml` file with the following content:
```yaml
include:
- template: Managed-Cluster-Applications.gitlab-ci.yml
```
1. Add a `.gitlab/managed-apps/config.yaml` file to define which
applications you would like to install. Define the `installed` key as
`true` to install the application and `false` to uninstall the
application. For example, to install Ingress:
```yaml
ingress:
installed: true
```
1. Optionally, define `.gitlab/managed-apps/<application>/values.yaml` file to
customize values for the installed application.
A GitLab CI pipeline will then run on the `master` branch to install the
applications you have configured.
### Install Ingress using GitLab CI
To install ingress, define the `.gitlab/managed-apps/config.yaml` file
with:
```yaml
ingress:
installed: true
```
Ingress will then be installed into the `gitlab-managed-apps` namespace
of your cluster.
You can customize the installation of Ingress by defining
`.gitlab/managed-apps/ingress/values.yaml` file in your cluster
management project. Refer to the
[chart](https://github.com/helm/charts/tree/master/stable/nginx-ingress)
for the available configuration options.
## Upgrading applications
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/24789) in GitLab 11.8.
......
......@@ -481,7 +481,7 @@ It is possible to display metrics charts within [GitLab Flavored Markdown](../..
NOTE: **Note:**
Requires [Kubernetes](prometheus_library/kubernetes.md) metrics.
To display a metric chart, include a link of the form `https://<root_url>/<project>/environments/<environment_id>/metrics`.
To display a metric chart, include a link of the form `https://<root_url>/<project>/-/environments/<environment_id>/metrics`.
A single chart may also be embedded. You can generate a link to the chart via the dropdown located on the right side of the chart:
......
apply:
stage: deploy
image: "registry.gitlab.com/gitlab-org/cluster-integration/cluster-applications:v0.1.0"
environment:
name: production
variables:
TILLER_NAMESPACE: gitlab-managed-apps
GITLAB_MANAGED_APPS_FILE: $CI_PROJECT_DIR/.gitlab/managed-apps/config.yaml
INGRESS_VALUES_FILE: $CI_PROJECT_DIR/.gitlab/managed-apps/ingress/values.yaml
script:
- gitlab-managed-apps /usr/local/share/gitlab-managed-apps/helmfile.yaml
only:
refs:
- master
......@@ -15,6 +15,7 @@ module QA
#
module Flow
autoload :Login, 'qa/flow/login'
autoload :Project, 'qa/flow/project'
end
##
......@@ -33,6 +34,7 @@ module QA
autoload :Fixtures, 'qa/runtime/fixtures'
autoload :Logger, 'qa/runtime/logger'
autoload :GPG, 'qa/runtime/gpg'
autoload :MailHog, 'qa/runtime/mail_hog'
module API
autoload :Client, 'qa/runtime/api/client'
......@@ -130,6 +132,7 @@ module QA
autoload :Kubernetes, 'qa/scenario/test/integration/kubernetes'
autoload :Mattermost, 'qa/scenario/test/integration/mattermost'
autoload :ObjectStorage, 'qa/scenario/test/integration/object_storage'
autoload :SMTP, 'qa/scenario/test/integration/smtp'
end
module Sanity
......@@ -422,6 +425,7 @@ module QA
autoload :Maven, 'qa/service/docker_run/maven'
autoload :NodeJs, 'qa/service/docker_run/node_js'
autoload :GitlabRunner, 'qa/service/docker_run/gitlab_runner'
autoload :MailHog, 'qa/service/docker_run/mail_hog'
end
end
......
# frozen_string_literal: true
module QA
module Flow
module Project
module_function
def add_member(project:, username:)
project.visit!
Page::Project::Menu.perform(&:go_to_members_settings)
Page::Project::Settings::Members.perform do |member_settings|
member_settings.add_member(username)
end
end
end
end
end
......@@ -156,6 +156,8 @@ module QA
def perform(&block)
visit(url)
simulate_slow_connection if Runtime::Env.simulate_slow_connection?
page_class.validate_elements_present!
if QA::Runtime::Env.qa_cookies
......@@ -178,6 +180,28 @@ module QA
def clear!
visit(url)
reset_session!
@network_conditions_configured = false
end
private
def simulate_slow_connection
return if @network_conditions_configured
QA::Runtime::Logger.info(
<<~MSG.tr("\n", " ")
Simulating a slow connection with additional latency
of #{Runtime::Env.slow_connection_latency} ms and a maximum
throughput of #{Runtime::Env.slow_connection_throughput} kbps
MSG
)
Capybara.current_session.driver.browser.network_conditions = {
latency: Runtime::Env.slow_connection_latency,
throughput: Runtime::Env.slow_connection_throughput * 1000
}
@network_conditions_configured = true
end
end
end
......
......@@ -261,10 +261,30 @@ module QA
ENV['QA_RUNTIME_SCENARIO_ATTRIBUTES']
end
def disable_rspec_retry?
enabled?(ENV['QA_DISABLE_RSPEC_RETRY'], default: false)
end
def simulate_slow_connection?
enabled?(ENV['QA_SIMULATE_SLOW_CONNECTION'], default: false)
end
def slow_connection_latency
ENV.fetch('QA_SLOW_CONNECTION_LATENCY_MS', 2000).to_i
end
def slow_connection_throughput
ENV.fetch('QA_SLOW_CONNECTION_THROUGHPUT_KBPS', 32).to_i
end
def gitlab_qa_loop_runner_minutes
ENV.fetch('GITLAB_QA_LOOP_RUNNER_MINUTES', 1).to_i
end
def mailhog_hostname
ENV['MAILHOG_HOSTNAME']
end
private
def remote_grid_credentials
......
# frozen_string_literal: true
module QA
module Runtime
module MailHog
def self.base_url
host = QA::Runtime::Env.mailhog_hostname || 'localhost'
"http://#{host}:8025"
end
def self.api_messages_url
"#{base_url}/api/v2/messages"
end
end
end
end
# frozen_string_literal: true
module QA
module Scenario
module Test
module Integration
class SMTP < Test::Instance::All
tags :smtp
end
end
end
end
end
# frozen_string_literal: true
module QA
context 'Manage', :orchestrated, :smtp do
describe 'mail notification' do
let(:user) do
Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1)
end
let(:project) do
Resource::Project.fabricate_via_api! do |resource|
resource.name = 'email-notification-test'
end
end
before do
Flow::Login.sign_in
end
it 'user receives email for project invitation' do
Flow::Project.add_member(project: project, username: user.username)
expect(page).to have_content(/@#{user.username}(\n| )?Given access/)
# Wait for Action Mailer to deliver messages
mailhog_json = Support::Retrier.retry_until(sleep_interval: 1) do
Runtime::Logger.debug(%Q[retrieving "#{QA::Runtime::MailHog.api_messages_url}"]) if Runtime::Env.debug?
mailhog_response = get QA::Runtime::MailHog.api_messages_url
mailhog_data = JSON.parse(mailhog_response.body)
# Expect at least two invitation messages: group and project
mailhog_data if mailhog_data.dig('total') >= 2
end
# Check json result from mailhog
mailhog_items = mailhog_json.dig('items')
expect(mailhog_items).to include(an_object_satisfying { |o| /project was granted/ === o.dig('Content', 'Headers', 'Subject', 0) })
end
end
end
end
......@@ -62,7 +62,7 @@ RSpec.configure do |config|
# show exception that triggers a retry if verbose_retry is set to true
config.display_try_failure_messages = true
if ENV['CI']
if ENV['CI'] && !QA::Runtime::Env.disable_rspec_retry?
config.around do |example|
retry_times = example.metadata.key?(:quarantine) ? 1 : 2
example.run_with_retry retry: retry_times
......
# frozen_string_literal: true
FactoryBot.define do
factory :dev_ops_score_metric, class: ConversationalDevelopmentIndex::Metric do
factory :dev_ops_score_metric, class: DevOpsScore::Metric do
leader_issues { 9.256 }
instance_issues { 1.234 }
percentage_issues { 13.331 }
......
# frozen_string_literal: true
require 'spec_helper'
describe 'Managed-Cluster-Applications.gitlab-ci.yml' do
subject(:template) { Gitlab::Template::GitlabCiYmlTemplate.find('Managed-Cluster-Applications') }
describe 'the created pipeline' do
let_it_be(:user) { create(:user) }
let(:project) { create(:project, :custom_repo, namespace: user.namespace, files: { 'README.md' => '' }) }
let(:service) { Ci::CreatePipelineService.new(project, user, ref: pipeline_branch ) }
let(:pipeline) { service.execute!(:push) }
let(:build_names) { pipeline.builds.pluck(:name) }
let(:pipeline_branch) { 'master' }
before do
stub_ci_pipeline_yaml_file(template.content)
end
context 'for a default branch' do
it 'creates a apply job' do
expect(build_names).to match_array('apply')
end
end
context 'outside of default branch' do
let(:pipeline_branch) { 'a_branch' }
before do
project.repository.create_branch(pipeline_branch)
end
it 'has no jobs' do
expect { pipeline }.to raise_error(Ci::CreatePipelineService::CreateError, 'No stages / jobs for this pipeline.')
end
end
end
end
......@@ -2,7 +2,7 @@
require 'spec_helper'
describe ConversationalDevelopmentIndex::Metric do
describe DevOpsScore::Metric do
let(:conv_dev_index) { create(:dev_ops_score_metric) }
describe '#percentage_score' do
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
describe ConversationalDevelopmentIndex::MetricPresenter do
describe DevOpsScore::MetricPresenter do
subject { described_class.new(metric) }
let(:metric) { build(:dev_ops_score_metric) }
......
......@@ -11,7 +11,7 @@ describe 'environments routing' do
end
let(:environments_route) do
"#{project.full_path}/environments/"
"#{project.full_path}/-/environments/"
end
describe 'routing environment folders' do
......@@ -38,7 +38,7 @@ describe 'environments routing' do
end
def get_folder(folder)
get("#{project.full_path}/environments/folders/#{folder}")
get("#{project.full_path}/-/environments/folders/#{folder}")
end
def folder_action(**opts)
......
......@@ -794,4 +794,28 @@ describe 'project routing' do
expect(post('/gitlab/gitlabhq/usage_ping/web_ide_clientside_preview')).to route_to('projects/usage_ping#web_ide_clientside_preview', namespace_id: 'gitlab', project_id: 'gitlabhq')
end
end
describe Projects::EnvironmentsController, 'routing' do
describe 'legacy routing' do
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/environments", "/gitlab/gitlabhq/-/environments"
end
end
describe Projects::ClustersController, 'routing' do
describe 'legacy routing' do
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/clusters", "/gitlab/gitlabhq/-/clusters"
end
end
describe Projects::ErrorTrackingController, 'routing' do
describe 'legacy routing' do
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/error_tracking", "/gitlab/gitlabhq/-/error_tracking"
end
end
describe Projects::Serverless, 'routing' do
describe 'legacy routing' do
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/serverless", "/gitlab/gitlabhq/-/serverless"
end
end
end
......@@ -24,7 +24,7 @@ describe ClusterBasicEntity do
it 'exposes the cluster details' do
expect(subject[:name]).to eq('the-cluster')
expect(subject[:path]).to eq("/#{project.full_path}/clusters/#{cluster.id}")
expect(subject[:path]).to eq("/#{project.full_path}/-/clusters/#{cluster.id}")
end
context 'when the user does not have permission to view the cluster' do
......
......@@ -73,7 +73,7 @@ describe EnvironmentStatusEntity do
it 'returns metrics url' do
expect(subject[:metrics_url])
.to eq("/#{project.full_path}/environments/#{environment.id}/deployments/#{deployment.iid}/metrics")
.to eq("/#{project.full_path}/-/environments/#{environment.id}/deployments/#{deployment.iid}/metrics")
end
end
......
......@@ -46,12 +46,12 @@ describe SubmitUsagePingService do
stub_response(with_conv_index_params)
expect { subject.execute }
.to change { ConversationalDevelopmentIndex::Metric.count }
.to change { DevOpsScore::Metric.count }
.by(1)
expect(ConversationalDevelopmentIndex::Metric.last.leader_issues).to eq 10.2
expect(ConversationalDevelopmentIndex::Metric.last.instance_issues).to eq 3.2
expect(ConversationalDevelopmentIndex::Metric.last.percentage_issues).to eq 31.37
expect(DevOpsScore::Metric.last.leader_issues).to eq 10.2
expect(DevOpsScore::Metric.last.instance_issues).to eq 3.2
expect(DevOpsScore::Metric.last.percentage_issues).to eq 31.37
end
end
......
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