Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2020-10-29 21:08:54 +00:00
parent ce27ba9f6c
commit 5d47d3f8ed
47 changed files with 326 additions and 25 deletions

View File

@ -422,8 +422,12 @@ class Service < ApplicationRecord
ProjectServiceWorker.perform_async(id, data)
end
def issue_tracker?
self.category == :issue_tracker
def external_issue_tracker?
category == :issue_tracker && active?
end
def external_wiki?
type == 'ExternalWikiService' && active?
end
# override if needed

View File

@ -34,11 +34,11 @@ class BulkCreateIntegrationService
end
def run_callbacks(batch)
if integration.issue_tracker? && integration.active?
if integration.external_issue_tracker?
batch.update_all(has_external_issue_tracker: true)
end
if integration.type == 'ExternalWikiService' && integration.active?
if integration.external_wiki?
batch.update_all(has_external_wiki: true)
end
end

View File

@ -29,9 +29,7 @@ class PostReceiveService
response.add_alert_message(message)
end
broadcast_message = BroadcastMessage.current_banner_messages&.last&.message
response.add_alert_message(broadcast_message)
response.add_merge_request_urls(merge_request_urls)
# Neither User nor Project are guaranteed to be returned; an orphaned write deploy
@ -74,6 +72,24 @@ class PostReceiveService
::MergeRequests::GetUrlsService.new(project).execute(params[:changes])
end
private
def broadcast_message
banner = nil
if project
scoped_messages = BroadcastMessage.current_banner_messages(project.full_path).select do |message|
message.target_path.present? && message.matches_current_path(project.full_path)
end
banner = scoped_messages.last
end
banner ||= BroadcastMessage.current_banner_messages.last
banner&.message
end
end
PostReceiveService.prepend_if_ee('EE::PostReceiveService')

View File

@ -35,6 +35,7 @@ class FeatureFlagOptionParser
:name,
:type,
:group,
:milestone,
:ee,
:amend,
:dry_run,
@ -64,6 +65,10 @@ class FeatureFlagOptionParser
options.introduced_by_url = value
end
opts.on('-M', '--milestone [string]', String, 'Milestone in which the Feature Flag was introduced') do |value|
options.milestone = value
end
opts.on('-i', '--rollout-issue-url [string]', String, 'URL of Issue rolling out the Feature Flag') do |value|
options.rollout_issue_url = value
end
@ -188,6 +193,11 @@ class FeatureFlagOptionParser
end
end
def read_milestone
milestone = File.read('VERSION')
milestone.gsub(/^(\d+\.\d+).*$/, '\1').chomp
end
def read_default_enabled(options)
TYPES.dig(options.type, :default_enabled)
end
@ -214,6 +224,7 @@ class FeatureFlagCreator
options.group ||= FeatureFlagOptionParser.read_group
options.introduced_by_url ||= FeatureFlagOptionParser.read_introduced_by_url
options.rollout_issue_url ||= FeatureFlagOptionParser.read_rollout_issue_url(options)
options.milestone ||= FeatureFlagOptionParser.read_milestone
$stdout.puts "\e[32mcreate\e[0m #{file_path}"
$stdout.puts contents
@ -243,6 +254,7 @@ class FeatureFlagCreator
'name' => options.name,
'introduced_by_url' => options.introduced_by_url,
'rollout_issue_url' => options.rollout_issue_url,
'milestone' => options.milestone,
'group' => options.group,
'type' => options.type.to_s,
'default_enabled' => FeatureFlagOptionParser.read_default_enabled(options)

View File

@ -0,0 +1,5 @@
---
title: Add a stop review job for ECS
merge_request: 44717
author:
type: added

View File

@ -0,0 +1,5 @@
---
title: Fix QuickActions not working if written before a codeblock
merge_request: 46401
author:
type: fixed

View File

@ -0,0 +1,5 @@
---
title: Allow for return of scoped broadcast messages on shell
merge_request: 46333
author:
type: changed

View File

@ -1,7 +0,0 @@
---
name: deploy_boards_dedupe_instances
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/40768
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/258214
type: development
group: group::progressive delivery
default_enabled: false

View File

@ -1,3 +1,9 @@
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Abuse reports
You can report abuse from other GitLab users to GitLab administrators.

View File

@ -1,3 +1,9 @@
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# DevOps Report
> - [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/30469) in GitLab 9.3.

View File

@ -1,3 +1,9 @@
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Instance-level analytics
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/41416) in GitLab 11.2.

View File

@ -1,3 +1,9 @@
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Instance Statistics
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/235754) in GitLab 13.4.

View File

@ -1,3 +1,9 @@
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Cohorts
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/23361) in GitLab 9.1.

View File

@ -1,4 +1,7 @@
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
type: howto
disqus_identifier: 'https://docs.gitlab.com/ee/customization/branded_login_page.html'
---

View File

@ -1,4 +1,7 @@
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
type: reference, howto
---

View File

@ -1,4 +1,7 @@
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
type: reference
---

View File

@ -1,4 +1,7 @@
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
type: concepts, howto
---

View File

@ -1,4 +1,7 @@
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
type: reference
---

View File

@ -1,4 +1,7 @@
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
type: howto
---

View File

@ -1,4 +1,7 @@
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
type: index
---

View File

@ -1,4 +1,7 @@
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
type: reference
---

View File

@ -1,4 +1,7 @@
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
type: reference
---

View File

@ -1,4 +1,7 @@
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
type: reference
---

View File

@ -1,4 +1,7 @@
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
type: reference
---

View File

@ -1,4 +1,7 @@
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
type: reference
---

View File

@ -1,4 +1,7 @@
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
type: reference
---

View File

@ -1,4 +1,7 @@
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
type: reference
---

View File

@ -1,4 +1,7 @@
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
type: reference
---

View File

@ -1,4 +1,7 @@
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
type: reference, howto
---

View File

@ -1,3 +1,9 @@
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Feature highlight
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/16379) in GitLab 10.5

View File

@ -1,3 +1,9 @@
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# GitLab.com settings
In this page you will find information about the settings that are used on

View File

@ -1,4 +1,7 @@
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
type: reference, howto, concepts
---

View File

@ -1,4 +1,7 @@
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
type: reference, index
description: 'Read through the GitLab User documentation to learn how to use, configure, and customize GitLab and GitLab.com to your own needs.'
---

View File

@ -1,3 +1,9 @@
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Operations Dashboard **(PREMIUM)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/5781) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 11.5. [Moved](https://gitlab.com/gitlab-org/gitlab/-/issues/9218) to [GitLab Premium](https://about.gitlab.com/pricing/) in 11.10.

View File

@ -1,4 +1,7 @@
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
type: howto
---

View File

@ -1,4 +1,7 @@
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
type: concepts, howto
---

View File

@ -1,3 +1,9 @@
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Canary Deployments **(PREMIUM)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/1659) in [GitLab Premium](https://about.gitlab.com/pricing/) 9.1.

View File

@ -41,9 +41,9 @@ knowledge. In particular, you should be familiar with:
- [Kubernetes namespaces](https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/)
- [Kubernetes canary deployments](https://kubernetes.io/docs/concepts/cluster-administration/manage-deployment/#canary-deployments)
NOTE: **Note:**
Apps that consist of multiple deployments are shown as duplicates on the deploy board.
Follow [this issue](https://gitlab.com/gitlab-org/gitlab/-/issues/8463) for details.
In GitLab 13.5 and earlier, apps that consist of multiple deployments are shown as
duplicates on the deploy board. This is [fixed](https://gitlab.com/gitlab-org/gitlab/-/issues/8463)
in GitLab 13.6.
## Use cases

View File

@ -1,4 +1,7 @@
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
type: concepts
---

View File

@ -1,3 +1,9 @@
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Insights **(ULTIMATE)**
> [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/725) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 12.0.

View File

@ -57,6 +57,7 @@ class Feature
name
introduced_by_url
rollout_issue_url
milestone
type
group
default_enabled

View File

@ -8,8 +8,11 @@
#
# More about including CI templates: https://docs.gitlab.com/ee/ci/yaml/#includetemplate
.deploy_to_ecs:
.ecs_image:
image: 'registry.gitlab.com/gitlab-org/cloud-deploy/aws-ecs:latest'
.deploy_to_ecs:
extends: .ecs_image
dependencies: []
script:
- ecs update-task-definition
@ -17,8 +20,6 @@
.review_ecs_base:
stage: review
extends: .deploy_to_ecs
environment:
name: review/$CI_COMMIT_REF_NAME
.production_ecs_base:
stage: production
@ -26,8 +27,18 @@
environment:
name: production
.stop_review_ecs_base:
extends: .ecs_image
stage: cleanup
allow_failure: true
script:
- ecs stop-task
review_ecs:
extends: .review_ecs_base
environment:
name: review/$CI_COMMIT_REF_NAME
on_stop: stop_review_ecs
rules:
- if: '$AUTO_DEVOPS_PLATFORM_TARGET != "ECS"'
when: never
@ -39,8 +50,30 @@ review_ecs:
when: never
- if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'
stop_review_ecs:
extends: .stop_review_ecs_base
environment:
name: review/$CI_COMMIT_REF_NAME
action: stop
rules:
- if: '$AUTO_DEVOPS_PLATFORM_TARGET != "ECS"'
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'
when: manual
review_fargate:
extends: .review_ecs_base
environment:
name: review/$CI_COMMIT_REF_NAME
on_stop: stop_review_fargate
script:
- ecs update-task-definition
rules:
- if: '$AUTO_DEVOPS_PLATFORM_TARGET != "FARGATE"'
when: never
@ -52,6 +85,23 @@ review_fargate:
when: never
- if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'
stop_review_fargate:
extends: .stop_review_ecs_base
environment:
name: review/$CI_COMMIT_REF_NAME
action: stop
rules:
- if: '$AUTO_DEVOPS_PLATFORM_TARGET != "FARGATE"'
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'
when: manual
production_ecs:
extends: .production_ecs_base
rules:

View File

@ -29,9 +29,9 @@ module Gitlab
# Anything, including `/cmd arg` which are ignored by this filter
# `
^.*`\n*
`\n*
.+?
\n*`$
\n*`
)
}mix.freeze

View File

@ -94,14 +94,14 @@ RSpec.describe 'Auto-DevOps.gitlab-ci.yml' do
end
it 'creates an ECS deployment job for review only' do
expect(review_prod_build_names).to contain_exactly('review_ecs')
expect(review_prod_build_names).to contain_exactly('review_ecs', 'stop_review_ecs')
end
context 'with FARGATE as a launch type' do
let(:platform_value) { 'FARGATE' }
it 'creates an FARGATE deployment job for review only' do
expect(review_prod_build_names).to contain_exactly('review_fargate')
expect(review_prod_build_names).to contain_exactly('review_fargate', 'stop_review_fargate')
end
end
end

View File

@ -264,6 +264,22 @@ RSpec.describe Gitlab::QuickActions::Extractor do
expect(msg).to eq 'Fixes #123'
end
it 'does not get confused if command comes before an inline code' do
msg = "/reopen\n`some inline code`\n/labels ~a\n`more inline code`"
msg, commands = extractor.extract_commands(msg)
expect(commands).to eq([['reopen'], ['labels', '~a']])
expect(msg).to eq "`some inline code`\n`more inline code`"
end
it 'does not get confused if command comes before a blockcode' do
msg = "/reopen\n```\nsome blockcode\n```\n/labels ~a\n```\nmore blockcode\n```"
msg, commands = extractor.extract_commands(msg)
expect(commands).to eq([['reopen'], ['labels', '~a']])
expect(msg).to eq "```\nsome blockcode\n```\n```\nmore blockcode\n```"
end
it 'does not extract commands inside a blockcode' do
msg = "Hello\r\n```\r\nThis is some text\r\n/close\r\n/assign @user\r\n```\r\n\r\nWorld"
expected = msg.delete("\r")

View File

@ -3,6 +3,8 @@
require 'spec_helper'
RSpec.describe Service do
using RSpec::Parameterized::TableSyntax
let_it_be(:group) { create(:group) }
let_it_be(:project) { create(:project, group: group) }
@ -15,8 +17,6 @@ RSpec.describe Service do
end
describe 'validations' do
using RSpec::Parameterized::TableSyntax
it { is_expected.to validate_presence_of(:type) }
where(:project_id, :group_id, :template, :instance, :valid) do
@ -863,4 +863,32 @@ RSpec.describe Service do
end
end
end
describe '#external_issue_tracker?' do
where(:category, :active, :result) do
:issue_tracker | true | true
:issue_tracker | false | false
:common | true | false
end
with_them do
it 'returns the right result' do
expect(build(:service, category: category, active: active).external_issue_tracker?).to eq(result)
end
end
end
describe '#external_wiki?' do
where(:type, :active, :result) do
'ExternalWikiService' | true | true
'ExternalWikiService' | false | false
'SlackService' | true | false
end
with_them do
it 'returns the right result' do
expect(build(:service, type: type, active: active).external_wiki?).to eq(result)
end
end
end
end

View File

@ -232,6 +232,49 @@ RSpec.describe PostReceiveService do
end
end
context "broadcast message has a target_path" do
let!(:older_scoped_message) do
create(:broadcast_message, message: "Old top secret", target_path: "/company/sekrit-project")
end
let!(:latest_scoped_message) do
create(:broadcast_message, message: "Top secret", target_path: "/company/sekrit-project")
end
let!(:unscoped_message) do
create(:broadcast_message, message: "Hi")
end
context "no project path matches" do
it "does not output the scoped broadcast messages" do
expect(subject).not_to include(build_alert_message(older_scoped_message.message))
expect(subject).not_to include(build_alert_message(latest_scoped_message.message))
end
it "does output another message that doesn't have a target_path" do
expect(subject).to include(build_alert_message(unscoped_message.message))
end
end
context "project path matches" do
before do
allow(project).to receive(:full_path).and_return("/company/sekrit-project")
end
it "does output the latest scoped broadcast message" do
expect(subject).to include(build_alert_message(latest_scoped_message.message))
end
it "does not output the older scoped broadcast message" do
expect(subject).not_to include(build_alert_message(older_scoped_message.message))
end
it "does not output another message that doesn't have a target_path" do
expect(subject).not_to include(build_alert_message(unscoped_message.message))
end
end
end
context 'with a redirected data' do
it 'returns redirected message on the response' do
project_moved = Gitlab::Checks::ProjectMoved.new(project.repository, user, 'http', 'foo/baz')