Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2019-09-25 12:06:15 +00:00
parent 1cfd8874ee
commit aabf412bc1
21 changed files with 119 additions and 22 deletions

View File

@ -218,6 +218,12 @@ ActiveRecordAssociationReload:
- 'spec/**/*'
- 'ee/spec/**/*'
Naming/PredicateName:
Enabled: true
Exclude:
- 'spec/**/*'
- 'ee/spec/**/*'
RSpec/FactoriesInMigrationSpecs:
Enabled: true
Include:

View File

@ -73,10 +73,6 @@
summary {
margin-bottom: $gl-padding;
}
*:first-child:not(summary) {
margin-top: $gl-padding;
}
}
// Single code lines should wrap

View File

@ -20,7 +20,6 @@ module NavHelper
def page_gutter_class
if page_has_markdown?
if cookies[:collapsed_gutter] == 'true'
%w[page-gutter right-sidebar-collapsed]
else

View File

@ -23,11 +23,12 @@ module Clusters
key: Settings.attr_encrypted_db_key_base_truncated,
algorithm: 'aes-256-cbc'
before_validation :nullify_blank_namespace
before_validation :enforce_namespace_to_lower_case
before_validation :enforce_ca_whitespace_trimming
validates :namespace,
allow_blank: true,
allow_nil: true,
length: 1..63,
format: {
with: Gitlab::Regex.kubernetes_namespace_regex,
@ -190,6 +191,10 @@ module Clusters
true
end
def nullify_blank_namespace
self.namespace = nil if namespace.blank?
end
end
end
end

View File

@ -137,10 +137,9 @@ class JiraService < IssueTrackerService
return if issue.nil? || has_resolution?(issue) || !jira_issue_transition_id.present?
commit_id = if entity.is_a?(Commit)
entity.id
elsif entity.is_a?(MergeRequest)
entity.diff_head_sha
commit_id = case entity
when Commit then entity.id
when MergeRequest then entity.diff_head_sha
end
commit_url = build_entity_url(:commit, commit_id)
@ -331,7 +330,6 @@ class JiraService < IssueTrackerService
# Handle errors when doing Jira API calls
def jira_request
yield
rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, Errno::ECONNREFUSED, URI::InvalidURIError, JIRA::HTTPError, OpenSSL::SSL::SSLError => e
@error = e.message
log_error("Error sending message", client_url: client_url, error: @error)

View File

@ -18,7 +18,7 @@ module Issues
# The code calling this method is responsible for ensuring that a user is
# allowed to close the given issue.
def close_issue(issue, closed_via: nil, notifications: true, system_note: true)
if project.jira_tracker? && project.jira_service.active && issue.is_a?(ExternalIssue)
if project.jira_tracker_active? && issue.is_a?(ExternalIssue)
project.jira_service.close_issue(closed_via, issue)
todo_service.close_issue(issue, current_user)
return issue

View File

@ -0,0 +1,5 @@
---
title: Nullify platform Kubernetes namespace if blank
merge_request: 17657
author:
type: fixed

View File

@ -0,0 +1,5 @@
---
title: Fix css selector for details in issue description
merge_request: 17557
author:
type: fixed

View File

@ -0,0 +1,5 @@
---
title: Add columns for per project/group max pages/artifacts sizes
merge_request: 17231
author:
type: added

View File

@ -0,0 +1,9 @@
# frozen_string_literal: true
class AddProjectsMaxPagesSize < ActiveRecord::Migration[5.2]
DOWNTIME = false
def change
add_column :projects, :max_pages_size, :integer
end
end

View File

@ -0,0 +1,9 @@
# frozen_string_literal: true
class AddNamespacesMaxPagesSize < ActiveRecord::Migration[5.2]
DOWNTIME = false
def change
add_column :namespaces, :max_pages_size, :integer
end
end

View File

@ -0,0 +1,9 @@
# frozen_string_literal: true
class AddProjectsMaxArtifactsSize < ActiveRecord::Migration[5.2]
DOWNTIME = false
def change
add_column :projects, :max_artifacts_size, :integer
end
end

View File

@ -0,0 +1,9 @@
# frozen_string_literal: true
class AddNamespacesMaxArtifactsSize < ActiveRecord::Migration[5.2]
DOWNTIME = false
def change
add_column :namespaces, :max_artifacts_size, :integer
end
end

View File

@ -2317,6 +2317,8 @@ ActiveRecord::Schema.define(version: 2019_09_19_162036) do
t.integer "last_ci_minutes_usage_notification_level"
t.integer "subgroup_creation_level", default: 1
t.boolean "emails_disabled"
t.integer "max_pages_size"
t.integer "max_artifacts_size"
t.index ["created_at"], name: "index_namespaces_on_created_at"
t.index ["custom_project_templates_group_id", "type"], name: "index_namespaces_on_custom_project_templates_group_id_and_type", where: "(custom_project_templates_group_id IS NOT NULL)"
t.index ["file_template_project_id"], name: "index_namespaces_on_file_template_project_id"
@ -2909,6 +2911,8 @@ ActiveRecord::Schema.define(version: 2019_09_19_162036) do
t.boolean "merge_requests_disable_committers_approval"
t.boolean "require_password_to_approve"
t.boolean "emails_disabled"
t.integer "max_pages_size"
t.integer "max_artifacts_size"
t.index ["archived", "pending_delete", "merge_requests_require_code_owner_approval"], name: "projects_requiring_code_owner_approval", where: "((pending_delete = false) AND (archived = false) AND (merge_requests_require_code_owner_approval = true))"
t.index ["created_at"], name: "index_projects_on_created_at"
t.index ["creator_id"], name: "index_projects_on_creator_id"

View File

@ -155,6 +155,7 @@ module API
def self.services
{
'alerts' => [],
'asana' => [
{
required: true,
@ -696,6 +697,7 @@ module API
def self.service_classes
[
::AlertsService,
::AsanaService,
::AssemblaService,
::BambooService,

View File

@ -143,6 +143,8 @@ excluded_attributes:
- :mirror_last_update_at
- :mirror_last_successful_update_at
- :emails_disabled
- :max_pages_size
- :max_artifacts_size
namespaces:
- :runners_token
- :runners_token_encrypted

View File

@ -4,7 +4,7 @@ module Gitlab
module Jira
# Gitlab JIRA HTTP client to be used with jira-ruby gem, this subclasses JIRA::HTTPClient.
# Uses Gitlab::HTTP to make requests to JIRA REST API.
# The parent class implementation can be found at: https://github.com/sumoheavy/jira-ruby/blob/v1.4.0/lib/jira/http_client.rb
# The parent class implementation can be found at: https://github.com/sumoheavy/jira-ruby/blob/v1.7.0/lib/jira/http_client.rb
class HttpClient < JIRA::HttpClient
extend ::Gitlab::Utils::Override
@ -24,7 +24,7 @@ module Gitlab
password: @options.delete(:password)
}.to_json
make_request(:post, @options[:context_path] + '/rest/auth/1/session', body, { 'Content-Type' => 'application/json' })
make_request(:post, @options[:context_path] + '/rest/auth/1/session', body, 'Content-Type' => 'application/json')
end
override :make_request

View File

@ -1234,6 +1234,9 @@ msgstr ""
msgid "Alerts"
msgstr ""
msgid "Alerts endpoint"
msgstr ""
msgid "All"
msgstr ""
@ -12760,6 +12763,9 @@ msgstr ""
msgid "Receive alerts from manually configured Prometheus servers."
msgstr ""
msgid "Receive alerts on GitLab from any source"
msgstr ""
msgid "Receive notifications about your own activity"
msgstr ""

View File

@ -411,6 +411,7 @@ project:
- project_aliases
- external_pull_requests
- pages_metadatum
- alerts_service
award_emoji:
- awardable
- user

View File

@ -19,14 +19,23 @@ describe Clusters::Platforms::Kubernetes do
it_behaves_like 'having unique enum values'
describe 'before_validation' do
let(:kubernetes) { create(:cluster_platform_kubernetes, :configured, namespace: namespace) }
context 'when namespace includes upper case' do
let(:kubernetes) { create(:cluster_platform_kubernetes, :configured, namespace: namespace) }
let(:namespace) { 'ABC' }
it 'converts to lower case' do
expect(kubernetes.namespace).to eq('abc')
end
end
context 'when namespace is blank' do
let(:namespace) { '' }
it 'nullifies the namespace' do
expect(kubernetes.namespace).to be_nil
end
end
end
describe 'validation' do
@ -35,8 +44,8 @@ describe Clusters::Platforms::Kubernetes do
context 'when validates namespace' do
let(:kubernetes) { build(:cluster_platform_kubernetes, :configured, namespace: namespace) }
context 'when namespace is blank' do
let(:namespace) { '' }
context 'when namespace is nil' do
let(:namespace) { nil }
it { is_expected.to be_truthy }
end

View File

@ -28,12 +28,17 @@ Service.available_services_names.each do |service|
end
end
let(:licensed_features) do
{
'github' => :github_project_service_integration,
'jenkins' => :jenkins_integration,
'jenkins_deprecated' => :jenkins_integration,
'alerts' => :incident_management
}
end
before do
if service == 'github' && respond_to?(:stub_licensed_features)
stub_licensed_features(github_project_service_integration: true)
project.clear_memoization(:disabled_services)
project.clear_memoization(:licensed_feature_available)
end
enable_license_for_service(service)
end
def initialize_service(service)
@ -42,5 +47,18 @@ Service.available_services_names.each do |service|
service_item.save!
service_item
end
private
def enable_license_for_service(service)
return unless respond_to?(:stub_licensed_features)
licensed_feature = licensed_features[service]
return unless licensed_feature
stub_licensed_features(licensed_feature => true)
project.clear_memoization(:disabled_services)
project.clear_memoization(:licensed_feature_available)
end
end
end