Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2020-10-08 00:08:30 +00:00
parent a87ae2e97e
commit 5ae54edfa9
20 changed files with 236 additions and 22 deletions

View File

@ -1,6 +1,8 @@
<script>
import { GlTable, GlIcon, GlTooltipDirective } from '@gitlab/ui';
import { s__, __ } from '~/locale';
import Tracking from '~/tracking';
import { trackAlertIntergrationsViewsOptions } from '../constants';
export const i18n = {
title: s__('AlertsIntegrations|Current integrations'),
@ -57,6 +59,15 @@ export default {
};
},
},
mounted() {
this.trackPageViews();
},
methods: {
trackPageViews() {
const { category, action } = trackAlertIntergrationsViewsOptions;
Tracking.event(category, action);
},
},
};
</script>

View File

@ -16,7 +16,6 @@ import {
import { debounce } from 'lodash';
import { s__ } from '~/locale';
import { doesHashExistInUrl } from '~/lib/utils/url_utility';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
import ToggleButton from '~/vue_shared/components/toggle_button.vue';
import IntegrationsList from './alerts_integrations_list.vue';
@ -56,7 +55,6 @@ export default {
directives: {
'gl-modal': GlModalDirective,
},
mixins: [glFeatureFlagsMixin()],
inject: ['prometheus', 'generic', 'opsgenie'],
data() {
return {

View File

@ -51,3 +51,13 @@ export const targetPrometheusUrlPlaceholder = 'http://prometheus.example.com/';
export const targetOpsgenieUrlPlaceholder = 'https://app.opsgenie.com/alert/list/';
export const sectionHash = 'js-alert-management-settings';
/* eslint-disable @gitlab/require-i18n-strings */
/**
* Tracks snowplow event when user views alerts intergration list
*/
export const trackAlertIntergrationsViewsOptions = {
category: 'Alert Intergrations',
action: 'view_alert_integrations_list',
};

View File

@ -27,17 +27,10 @@ class HelpController < ApplicationController
respond_to do |format|
format.any(:markdown, :md, :html) do
# Note: We are purposefully NOT using `Rails.root.join` because of https://gitlab.com/gitlab-org/gitlab/-/issues/216028.
path = File.join(Rails.root, 'doc', "#{@path}.md")
if File.exist?(path)
# Remove YAML frontmatter so that it doesn't look weird
@markdown = File.read(path).gsub(YAML_FRONT_MATTER_REGEXP, '')
render 'show.html.haml'
if redirect_to_documentation_website?
redirect_to documentation_url
else
# Force template to Haml
render 'errors/not_found.html.haml', layout: 'errors', status: :not_found
render_documentation
end
end
@ -76,4 +69,48 @@ class HelpController < ApplicationController
params
end
def redirect_to_documentation_website?
return false unless Feature.enabled?(:help_page_documentation_redirect)
return false unless Gitlab::UrlSanitizer.valid_web?(documentation_url)
true
end
def documentation_url
return unless documentation_base_url
@documentation_url ||= [
documentation_base_url.chomp('/'),
version_segment,
'ee',
"#{@path}.html"
].compact.join('/')
end
def documentation_base_url
@documentation_base_url ||= Gitlab::CurrentSettings.current_application_settings.help_page_documentation_base_url.presence
end
def version_segment
return if Gitlab.pre_release?
version = Gitlab.version_info
[version.major, version.minor].join('.')
end
def render_documentation
# Note: We are purposefully NOT using `Rails.root.join` because of https://gitlab.com/gitlab-org/gitlab/-/issues/216028.
path = File.join(Rails.root, 'doc', "#{@path}.md")
if File.exist?(path)
# Remove YAML frontmatter so that it doesn't look weird
@markdown = File.read(path).gsub(YAML_FRONT_MATTER_REGEXP, '')
render 'show.html.haml'
else
# Force template to Haml
render 'errors/not_found.html.haml', layout: 'errors', status: :not_found
end
end
end

View File

@ -14,7 +14,7 @@ class CiPlatformMetric < ApplicationRecord
numericality: { only_integer: true, greater_than: 0 }
CI_VARIABLE_KEY = 'AUTO_DEVOPS_PLATFORM_TARGET'
ALLOWED_TARGETS = %w[ECS FARGATE].freeze
ALLOWED_TARGETS = %w[ECS FARGATE EC2].freeze
def self.insert_auto_devops_platform_targets!
recorded_at = Time.zone.now

View File

@ -0,0 +1,5 @@
---
title: Enable automatic allocation of purchased storage
merge_request: 44376
author:
type: changed

View File

@ -0,0 +1,5 @@
---
title: Redirect to documentation pages URL when configuration option is set
merge_request: 43157
author:
type: added

View File

@ -0,0 +1,5 @@
---
title: Fix rollback portion of migration that adds temporary index for container scanning findings
merge_request: 44593
author:
type: fixed

View File

@ -15,6 +15,6 @@ class AddIndexToContainerScanningFindings < ActiveRecord::Migration[6.0]
end
def down
remove_concurrent_index_by_name(:project_registry, INDEX_NAME)
remove_concurrent_index_by_name(:vulnerability_occurrences, INDEX_NAME)
end
end

View File

@ -0,0 +1,9 @@
# frozen_string_literal: true
class AddAutomaticPurchasedStorageAllocationToApplicationSettings < ActiveRecord::Migration[6.0]
DOWNTIME = false
def change
add_column :application_settings, :automatic_purchased_storage_allocation, :boolean, default: false, null: false
end
end

View File

@ -0,0 +1 @@
d1a636c0b0c7f11bf5d6e882970a5286a28c3f060f89df3ac51df2e7c86f042e

View File

@ -9293,6 +9293,7 @@ CREATE TABLE application_settings (
abuse_notification_email character varying,
require_admin_approval_after_user_signup boolean DEFAULT false NOT NULL,
help_page_documentation_base_url text,
automatic_purchased_storage_allocation boolean DEFAULT false NOT NULL,
CONSTRAINT check_2dba05b802 CHECK ((char_length(gitpod_url) <= 255)),
CONSTRAINT check_51700b31b5 CHECK ((char_length(default_branch_name) <= 255)),
CONSTRAINT check_57123c9593 CHECK ((char_length(help_page_documentation_base_url) <= 255)),

View File

@ -406,8 +406,8 @@ server (with `gitaly_address`) unless you setup with special
```
1. Save the file and [reconfigure GitLab](../restart_gitlab.md#omnibus-gitlab-reconfigure).
1. Run `sudo gitlab-rake gitlab:gitaly:check` to confirm the Gitaly client can connect to Gitaly
servers.
1. Run `sudo gitlab-rake gitlab:gitaly:check` on the Gitaly client (for example, the
Rails application) to confirm it can connect to Gitaly servers.
1. Tail the logs to see the requests:
```shell

View File

@ -182,7 +182,7 @@ failure. For greater fault tolerance, the following options are available:
- For Geo instances, either:
- Set up a separate [PostgreSQL instance](https://www.postgresql.org/docs/11/high-availability.html).
- Use a cloud-managed PostgreSQL service. AWS
[Relational Database Service](https://aws.amazon.com/rds/)) is recommended.
[Relational Database Service](https://aws.amazon.com/rds/) is recommended.
To complete this section you will need:

View File

@ -209,6 +209,7 @@ listed in the descriptions of the relevant settings.
| `authorized_keys_enabled` | boolean | no | By default, we write to the `authorized_keys` file to support Git over SSH without additional configuration. GitLab can be optimized to authenticate SSH keys via the database file. Only disable this if you have configured your OpenSSH server to use the AuthorizedKeysCommand. |
| `auto_devops_domain` | string | no | Specify a domain to use by default for every project's Auto Review Apps and Auto Deploy stages. |
| `auto_devops_enabled` | boolean | no | Enable Auto DevOps for projects by default. It will automatically build, test, and deploy applications based on a predefined CI/CD configuration. |
| `automatic_purchased_storage_allocation` | boolean | no | Enabling this permits automatic allocation of purchased storage within a namespace. |
| `check_namespace_plan` | boolean | no | **(PREMIUM)** Enabling this will make only licensed EE features available to projects if the project namespace's plan includes the feature or if the project is public. |
| `commit_email_hostname` | string | no | Custom hostname (for private commit emails). |
| `container_registry_token_expire_delay` | integer | no | Container Registry token duration in minutes. |

View File

@ -0,0 +1,11 @@
stages:
- provision
- review
- production
variables:
AUTO_DEVOPS_PLATFORM_TARGET: EC2
include:
- template: Jobs/CF-Provision.gitlab-ci.yml
- template: Jobs/Deploy/EC2.gitlab-ci.yml

View File

@ -0,0 +1,14 @@
stages:
- provision
cloud_formation:
image: 'registry.gitlab.com/gitlab-org/cloud-deploy/aws-cloudformation:latest'
stage: provision
script:
- gl-cloudformation create-stack
rules:
- if: '($AUTO_DEVOPS_PLATFORM_TARGET != "EC2") || ($AUTO_DEVOPS_PLATFORM_TARGET != "ECS")'
when: never
- if: '$CI_KUBERNETES_ACTIVE'
when: never
- if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'

View File

@ -0,0 +1,39 @@
stages:
- review
- production
.push-and-deploy:
image: 'registry.gitlab.com/gitlab-org/cloud-deploy/aws-ec2:latest'
script:
- gl-ec2 push-to-s3
- gl-ec2 deploy-to-ec2
review_ec2:
extends: .push-and-deploy
stage: review
environment:
name: review/$CI_COMMIT_REF_NAME
rules:
- if: '$AUTO_DEVOPS_PLATFORM_TARGET != "EC2"'
when: never
- if: '$CI_KUBERNETES_ACTIVE'
when: never
- if: '$REVIEW_DISABLED'
when: never
- if: '$CI_COMMIT_BRANCH == "master"'
when: never
- if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'
production_ec2:
extends: .push-and-deploy
stage: production
environment:
name: production
rules:
- if: '$AUTO_DEVOPS_PLATFORM_TARGET != "EC2"'
when: never
- if: '$CI_KUBERNETES_ACTIVE'
when: never
- if: '$CI_COMMIT_BRANCH != "master"'
when: never
- if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'

View File

@ -3,6 +3,8 @@
require 'spec_helper'
RSpec.describe HelpController do
include StubVersion
let(:user) { create(:user) }
before do
@ -108,8 +110,56 @@ RSpec.describe HelpController do
end
it 'renders HTML' do
expect(response).to render_template('show.html.haml')
expect(response.media_type).to eq 'text/html'
aggregate_failures do
expect(response).to render_template('show.html.haml')
expect(response.media_type).to eq 'text/html'
end
end
end
context 'when a custom help_page_documentation_url is set' do
before do
stub_application_setting(help_page_documentation_base_url: documentation_base_url)
stub_version(gitlab_version, 'deadbeaf')
end
subject { get :show, params: { path: path }, format: 'html' }
let(:gitlab_version) { '13.4.0-ee' }
let(:documentation_base_url) { 'https://docs.gitlab.com' }
let(:path) { 'ssh/README' }
it 'redirects user to custom documentation url with a specified version' do
is_expected.to redirect_to("#{documentation_base_url}/13.4/ee/#{path}.html")
end
context 'when documentation url ends with a slash' do
let(:documentation_base_url) { 'https://docs.gitlab.com/' }
it 'redirects user to custom documentation url without slash duplicates' do
is_expected.to redirect_to("https://docs.gitlab.com/13.4/ee/#{path}.html")
end
end
context 'when it is a pre-release' do
let(:gitlab_version) { '13.4.0-pre' }
it 'redirects user to custom documentation url without a version' do
is_expected.to redirect_to("#{documentation_base_url}/ee/#{path}.html")
end
end
context 'when feature flag is disabled' do
before do
stub_feature_flags(help_page_documentation_redirect: false)
end
it 'renders HTML' do
aggregate_failures do
is_expected.to render_template('show.html.haml')
expect(response.media_type).to eq 'text/html'
end
end
end
end
@ -129,9 +179,12 @@ RSpec.describe HelpController do
path: 'user/img/markdown_logo'
},
format: :png
expect(response).to be_successful
expect(response.media_type).to eq 'image/png'
expect(response.headers['Content-Disposition']).to match(/^inline;/)
aggregate_failures do
expect(response).to be_successful
expect(response.media_type).to eq 'image/png'
expect(response.headers['Content-Disposition']).to match(/^inline;/)
end
end
end

View File

@ -1,8 +1,10 @@
import { GlTable, GlIcon } from '@gitlab/ui';
import { mount } from '@vue/test-utils';
import Tracking from '~/tracking';
import AlertIntegrationsList, {
i18n,
} from '~/alerts_settings/components/alerts_integrations_list.vue';
import { trackAlertIntergrationsViewsOptions } from '~/alerts_settings/constants';
const mockIntegrations = [
{
@ -72,4 +74,16 @@ describe('AlertIntegrationsList', () => {
expect(notActivatedIcon.attributes('title')).toBe(i18n.status.disabled.tooltip);
});
});
describe('Snowplow tracking', () => {
beforeEach(() => {
jest.spyOn(Tracking, 'event');
mountComponent();
});
it('should track alert list page views', () => {
const { category, action } = trackAlertIntergrationsViewsOptions;
expect(Tracking.event).toHaveBeenCalledWith(category, action);
});
});
});