diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-03 12:09:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-03 12:09:09 +0300 |
commit | c384315ae1ea48df2a741874b326581ded0a97e1 (patch) | |
tree | 6f50dfdb7fb726ef3e738dc5264526cf683906a3 | |
parent | e1e017ddc4d64e4777bbe663c555093a7ae0cca3 (diff) |
Add latest changes from gitlab-org/gitlab@master
34 files changed, 380 insertions, 82 deletions
diff --git a/app/controllers/instance_statistics/conversational_development_index_controller.rb b/app/controllers/instance_statistics/conversational_development_index_controller.rb index 306c16d559c..f34347b4d22 100644 --- a/app/controllers/instance_statistics/conversational_development_index_controller.rb +++ b/app/controllers/instance_statistics/conversational_development_index_controller.rb @@ -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 diff --git a/app/helpers/conversational_development_index_helper.rb b/app/helpers/dev_ops_score_helper.rb index 37e5bb325fb..9a673998149 100644 --- a/app/helpers/conversational_development_index_helper.rb +++ b/app/helpers/dev_ops_score_helper.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module ConversationalDevelopmentIndexHelper +module DevOpsScoreHelper def score_level(score) if score < 33.33 'low' diff --git a/app/models/conversational_development_index/card.rb b/app/models/dev_ops_score/card.rb index f9180bdd97b..b1894cf4138 100644 --- a/app/models/conversational_development_index/card.rb +++ b/app/models/dev_ops_score/card.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module ConversationalDevelopmentIndex +module DevOpsScore class Card attr_accessor :metric, :title, :description, :feature, :blog, :docs diff --git a/app/models/conversational_development_index/idea_to_production_step.rb b/app/models/dev_ops_score/idea_to_production_step.rb index e78a734693c..d892793cf97 100644 --- a/app/models/conversational_development_index/idea_to_production_step.rb +++ b/app/models/dev_ops_score/idea_to_production_step.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module ConversationalDevelopmentIndex +module DevOpsScore class IdeaToProductionStep attr_accessor :metric, :title, :features diff --git a/app/models/conversational_development_index/metric.rb b/app/models/dev_ops_score/metric.rb index b91123be87e..a9133128ce9 100644 --- a/app/models/conversational_development_index/metric.rb +++ b/app/models/dev_ops_score/metric.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module ConversationalDevelopmentIndex +module DevOpsScore class Metric < ApplicationRecord include Presentable diff --git a/app/presenters/conversational_development_index/metric_presenter.rb b/app/presenters/dev_ops_score/metric_presenter.rb index 9639b84cf56..d22beefee54 100644 --- a/app/presenters/conversational_development_index/metric_presenter.rb +++ b/app/presenters/dev_ops_score/metric_presenter.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module ConversationalDevelopmentIndex +module DevOpsScore class MetricPresenter < Gitlab::View::Presenter::Simple def cards [ diff --git a/app/services/submit_usage_ping_service.rb b/app/services/submit_usage_ping_service.rb index 415a02ab337..7927ab265c5 100644 --- a/app/services/submit_usage_ping_service.rb +++ b/app/services/submit_usage_ping_service.rb @@ -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 diff --git a/changelogs/unreleased/ci_template_cluster_applications.yml b/changelogs/unreleased/ci_template_cluster_applications.yml new file mode 100644 index 00000000000..aab3544ef1c --- /dev/null +++ b/changelogs/unreleased/ci_template_cluster_applications.yml @@ -0,0 +1,5 @@ +--- +title: CI template for installing cluster applications +merge_request: 20822 +author: +type: added diff --git a/changelogs/unreleased/dz-move-operations-routes.yml b/changelogs/unreleased/dz-move-operations-routes.yml new file mode 100644 index 00000000000..76e7e81fdea --- /dev/null +++ b/changelogs/unreleased/dz-move-operations-routes.yml @@ -0,0 +1,5 @@ +--- +title: Move operations project routes under - scope +merge_request: 20456 +author: +type: deprecated diff --git a/changelogs/unreleased/qa-add-email-delivery-tests.yml b/changelogs/unreleased/qa-add-email-delivery-tests.yml new file mode 100644 index 00000000000..85795541cea --- /dev/null +++ b/changelogs/unreleased/qa-add-email-delivery-tests.yml @@ -0,0 +1,5 @@ +--- +title: Add e2e qa test for email delivery +merge_request: 20675 +author: Diego Louzán +type: other diff --git a/config/routes/project.rb b/config/routes/project.rb index 303fa8efaff..848846b5f5b 100644 --- a/config/routes/project.rb +++ b/config/routes/project.rb @@ -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 diff --git a/db/fixtures/development/21_conversational_development_index_metrics.rb b/db/fixtures/development/21_dev_ops_score_metrics.rb index 4cd0a82ed1a..afea7fb4bd0 100644 --- a/db/fixtures/development/21_conversational_development_index_metrics.rb +++ b/db/fixtures/development/21_dev_ops_score_metrics.rb @@ -1,5 +1,5 @@ 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 diff --git a/doc/administration/auth/smartcard.md b/doc/administration/auth/smartcard.md index 1088d1446fd..84ddd4278ab 100644 --- a/doc/administration/auth/smartcard.md +++ b/doc/administration/auth/smartcard.md @@ -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 diff --git a/doc/development/fe_guide/vue.md b/doc/development/fe_guide/vue.md index c3edaec70c7..96bc89675fe 100644 --- a/doc/development/fe_guide/vue.md +++ b/doc/development/fe_guide/vue.md @@ -78,7 +78,7 @@ document.addEventListener('DOMContentLoaded', () => new Vue({ render(createElement) { return createElement('my-component', { props: { - endpoint: this.isLoading, + endpoint: this.endpoint, }, }); }, diff --git a/doc/user/clusters/applications.md b/doc/user/clusters/applications.md index 7ee1650f698..6498545a4f6 100644 --- a/doc/user/clusters/applications.md +++ b/doc/user/clusters/applications.md @@ -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. diff --git a/doc/user/project/integrations/prometheus.md b/doc/user/project/integrations/prometheus.md index 6f7f9b27aa7..25ba0a47a4e 100644 --- a/doc/user/project/integrations/prometheus.md +++ b/doc/user/project/integrations/prometheus.md @@ -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: diff --git a/lib/gitlab/ci/templates/Managed-Cluster-Applications.gitlab-ci.yml b/lib/gitlab/ci/templates/Managed-Cluster-Applications.gitlab-ci.yml new file mode 100644 index 00000000000..a6b09e38ce8 --- /dev/null +++ b/lib/gitlab/ci/templates/Managed-Cluster-Applications.gitlab-ci.yml @@ -0,0 +1,14 @@ +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 diff --git a/qa/qa/flow/project.rb b/qa/qa/flow/project.rb new file mode 100644 index 00000000000..72b9357a604 --- /dev/null +++ b/qa/qa/flow/project.rb @@ -0,0 +1,19 @@ +# 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 diff --git a/qa/qa/runtime/browser.rb b/qa/qa/runtime/browser.rb index ea92cdbdb7f..69ba90702be 100644 --- a/qa/qa/runtime/browser.rb +++ b/qa/qa/runtime/browser.rb @@ -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 diff --git a/qa/qa/runtime/env.rb b/qa/qa/runtime/env.rb index bcd2a225469..9cf72457fa6 100644 --- a/qa/qa/runtime/env.rb +++ b/qa/qa/runtime/env.rb @@ -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 diff --git a/qa/qa/runtime/mail_hog.rb b/qa/qa/runtime/mail_hog.rb new file mode 100644 index 00000000000..899450a1540 --- /dev/null +++ b/qa/qa/runtime/mail_hog.rb @@ -0,0 +1,15 @@ +# 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 diff --git a/qa/qa/scenario/test/integration/smtp.rb b/qa/qa/scenario/test/integration/smtp.rb new file mode 100644 index 00000000000..a27bb5f9368 --- /dev/null +++ b/qa/qa/scenario/test/integration/smtp.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module QA + module Scenario + module Test + module Integration + class SMTP < Test::Instance::All + tags :smtp + end + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/1_manage/mail/trigger_mail_notification_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/mail/trigger_mail_notification_spec.rb new file mode 100644 index 00000000000..d3bb269bcb3 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/1_manage/mail/trigger_mail_notification_spec.rb @@ -0,0 +1,43 @@ +# 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 diff --git a/qa/spec/spec_helper.rb b/qa/spec/spec_helper.rb index 42f1e6f292a..36a1b901c65 100644 --- a/qa/spec/spec_helper.rb +++ b/qa/spec/spec_helper.rb @@ -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 diff --git a/spec/factories/dev_ops_score_metrics.rb b/spec/factories/dev_ops_score_metrics.rb index a9c592098d4..0d9d7059e7f 100644 --- a/spec/factories/dev_ops_score_metrics.rb +++ b/spec/factories/dev_ops_score_metrics.rb @@ -1,7 +1,7 @@ # 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 } diff --git a/spec/lib/gitlab/ci/templates/managed_cluster_applications_gitlab_ci_yaml_spec.rb b/spec/lib/gitlab/ci/templates/managed_cluster_applications_gitlab_ci_yaml_spec.rb new file mode 100644 index 00000000000..2a6314755ef --- /dev/null +++ b/spec/lib/gitlab/ci/templates/managed_cluster_applications_gitlab_ci_yaml_spec.rb @@ -0,0 +1,39 @@ +# 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 diff --git a/spec/models/conversational_development_index/metric_spec.rb b/spec/models/dev_ops_score/metric_spec.rb index 3f88236f8c4..89212d5ca26 100644 --- a/spec/models/conversational_development_index/metric_spec.rb +++ b/spec/models/dev_ops_score/metric_spec.rb @@ -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 diff --git a/spec/presenters/conversational_development_index/metric_presenter_spec.rb b/spec/presenters/dev_ops_score/metric_presenter_spec.rb index 857b23656bb..b6eab3f2e74 100644 --- a/spec/presenters/conversational_development_index/metric_presenter_spec.rb +++ b/spec/presenters/dev_ops_score/metric_presenter_spec.rb @@ -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) } diff --git a/spec/routing/environments_spec.rb b/spec/routing/environments_spec.rb index ea172698764..46d4f31dd31 100644 --- a/spec/routing/environments_spec.rb +++ b/spec/routing/environments_spec.rb @@ -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) diff --git a/spec/routing/project_routing_spec.rb b/spec/routing/project_routing_spec.rb index 561c2b572ec..fc562f93406 100644 --- a/spec/routing/project_routing_spec.rb +++ b/spec/routing/project_routing_spec.rb @@ -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 diff --git a/spec/serializers/cluster_basic_entity_spec.rb b/spec/serializers/cluster_basic_entity_spec.rb index be03ee91784..8c3307a1837 100644 --- a/spec/serializers/cluster_basic_entity_spec.rb +++ b/spec/serializers/cluster_basic_entity_spec.rb @@ -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 diff --git a/spec/serializers/environment_status_entity_spec.rb b/spec/serializers/environment_status_entity_spec.rb index bac590d44e9..6d98f91cfde 100644 --- a/spec/serializers/environment_status_entity_spec.rb +++ b/spec/serializers/environment_status_entity_spec.rb @@ -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 diff --git a/spec/services/submit_usage_ping_service_spec.rb b/spec/services/submit_usage_ping_service_spec.rb index 653f17a4324..8b68da6674a 100644 --- a/spec/services/submit_usage_ping_service_spec.rb +++ b/spec/services/submit_usage_ping_service_spec.rb @@ -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 |