Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-16 21:08:22 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-16 21:08:22 +0300
commit123c68a7cf788ace140e57e478a12c5b7ac893ae (patch)
treeb36e565ecd895ee46c1713f3734308cfce0e6ba9 /lib
parent862d225ca0d8eb452e56b8fe5a0109aac796e872 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r--lib/banzai/filter/base_sanitization_filter.rb1
-rw-r--r--lib/banzai/filter/broadcast_message_sanitization_filter.rb20
-rw-r--r--lib/banzai/pipeline/broadcast_message_pipeline.rb2
-rw-r--r--lib/gitlab/ci/config/entry/job.rb9
-rw-r--r--lib/gitlab/ci/pipeline/chain/validate/external.rb2
-rw-r--r--lib/gitlab/ci/pipeline/seed/build.rb2
-rw-r--r--lib/gitlab/ci/pipeline/seed/build/resource_group.rb40
-rw-r--r--lib/gitlab/ci/yaml_processor.rb1
-rw-r--r--lib/gitlab/file_type_detection.rb5
-rw-r--r--lib/gitlab/import_export/import_export.yml2
-rw-r--r--lib/gitlab/import_export/relation_factory.rb4
11 files changed, 33 insertions, 55 deletions
diff --git a/lib/banzai/filter/base_sanitization_filter.rb b/lib/banzai/filter/base_sanitization_filter.rb
index 2dabca3552d..1b7af8aee45 100644
--- a/lib/banzai/filter/base_sanitization_filter.rb
+++ b/lib/banzai/filter/base_sanitization_filter.rb
@@ -7,6 +7,7 @@ module Banzai
#
# - Banzai::Filter::SanitizationFilter (Markdown)
# - Banzai::Filter::AsciiDocSanitizationFilter (AsciiDoc/Asciidoctor)
+ # - Banzai::Filter::BroadcastMessageSanitizationFilter (Markdown with styled links and line breaks)
#
# Extends HTML::Pipeline::SanitizationFilter with common rules.
class BaseSanitizationFilter < HTML::Pipeline::SanitizationFilter
diff --git a/lib/banzai/filter/broadcast_message_sanitization_filter.rb b/lib/banzai/filter/broadcast_message_sanitization_filter.rb
new file mode 100644
index 00000000000..042293170c8
--- /dev/null
+++ b/lib/banzai/filter/broadcast_message_sanitization_filter.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+module Banzai
+ module Filter
+ # Sanitize HTML produced by Markdown. Allows styling of links and usage of line breaks.
+ #
+ # Extends Banzai::Filter::BaseSanitizationFilter with specific rules.
+ class BroadcastMessageSanitizationFilter < Banzai::Filter::BaseSanitizationFilter
+ def customize_whitelist(whitelist)
+ whitelist[:elements].push('br')
+
+ whitelist[:attributes]['a'].push('class', 'style')
+
+ whitelist[:css] = { properties: %w(color border background padding margin text-decoration) }
+
+ whitelist
+ end
+ end
+ end
+end
diff --git a/lib/banzai/pipeline/broadcast_message_pipeline.rb b/lib/banzai/pipeline/broadcast_message_pipeline.rb
index 580b5b72474..e31795e673c 100644
--- a/lib/banzai/pipeline/broadcast_message_pipeline.rb
+++ b/lib/banzai/pipeline/broadcast_message_pipeline.rb
@@ -6,7 +6,7 @@ module Banzai
def self.filters
@filters ||= FilterArray[
Filter::MarkdownFilter,
- Filter::SanitizationFilter,
+ Filter::BroadcastMessageSanitizationFilter,
Filter::EmojiFilter,
Filter::ColorFilter,
diff --git a/lib/gitlab/ci/config/entry/job.rb b/lib/gitlab/ci/config/entry/job.rb
index 5164223876a..517caabc79e 100644
--- a/lib/gitlab/ci/config/entry/job.rb
+++ b/lib/gitlab/ci/config/entry/job.rb
@@ -16,8 +16,7 @@ module Gitlab
ALLOWED_KEYS = %i[tags script only except rules type image services
allow_failure type stage when start_in artifacts cache
dependencies before_script needs after_script variables
- environment coverage retry parallel extends interruptible timeout
- resource_group].freeze
+ environment coverage retry parallel extends interruptible timeout].freeze
REQUIRED_BY_NEEDS = %i[stage].freeze
@@ -49,7 +48,6 @@ module Gitlab
validates :dependencies, array_of_strings: true
validates :extends, array_of_strings_or_string: true
validates :rules, array_of_hashes: true
- validates :resource_group, type: String
end
validates :start_in, duration: { limit: '1 week' }, if: :delayed?
@@ -158,7 +156,7 @@ module Gitlab
attributes :script, :tags, :allow_failure, :when, :dependencies,
:needs, :retry, :parallel, :extends, :start_in, :rules,
- :interruptible, :timeout, :resource_group
+ :interruptible, :timeout
def self.matching?(name, config)
!name.to_s.start_with?('.') &&
@@ -245,8 +243,7 @@ module Gitlab
artifacts: artifacts_value,
after_script: after_script_value,
ignore: ignored?,
- needs: needs_defined? ? needs_value : nil,
- resource_group: resource_group }
+ needs: needs_defined? ? needs_value : nil }
end
end
end
diff --git a/lib/gitlab/ci/pipeline/chain/validate/external.rb b/lib/gitlab/ci/pipeline/chain/validate/external.rb
index 97af42b5fd6..44dc333a6a1 100644
--- a/lib/gitlab/ci/pipeline/chain/validate/external.rb
+++ b/lib/gitlab/ci/pipeline/chain/validate/external.rb
@@ -38,7 +38,7 @@ module Gitlab
raise InvalidResponseCode, "Unsupported response code received from Validation Service: #{response_code}"
end
rescue => ex
- Gitlab::Sentry.track_exception(ex)
+ Gitlab::ErrorTracking.track_exception(ex)
true
end
diff --git a/lib/gitlab/ci/pipeline/seed/build.rb b/lib/gitlab/ci/pipeline/seed/build.rb
index 98b4b4593e0..590c7f4d1dd 100644
--- a/lib/gitlab/ci/pipeline/seed/build.rb
+++ b/lib/gitlab/ci/pipeline/seed/build.rb
@@ -18,7 +18,6 @@ module Gitlab
@seed_attributes = attributes
@previous_stages = previous_stages
@needs_attributes = dig(:needs_attributes)
- @resource_group_key = attributes.delete(:resource_group_key)
@using_rules = attributes.key?(:rules)
@using_only = attributes.key?(:only)
@@ -79,7 +78,6 @@ module Gitlab
else
::Ci::Build.new(attributes).tap do |job|
job.deployment = Seed::Deployment.new(job).to_resource
- job.resource_group = Seed::Build::ResourceGroup.new(job, @resource_group_key).to_resource
end
end
end
diff --git a/lib/gitlab/ci/pipeline/seed/build/resource_group.rb b/lib/gitlab/ci/pipeline/seed/build/resource_group.rb
deleted file mode 100644
index 100eb1d4084..00000000000
--- a/lib/gitlab/ci/pipeline/seed/build/resource_group.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-# frozen_string_literal: true
-
-module Gitlab
- module Ci
- module Pipeline
- module Seed
- class Build
- class ResourceGroup < Seed::Base
- include Gitlab::Utils::StrongMemoize
-
- attr_reader :build, :resource_group_key
-
- def initialize(build, resource_group_key)
- @build = build
- @resource_group_key = resource_group_key
- end
-
- def to_resource
- return unless Feature.enabled?(:ci_resource_group, build.project)
- return unless resource_group_key.present?
-
- resource_group = build.project.resource_groups
- .safe_find_or_create_by(key: expanded_resource_group_key)
-
- resource_group if resource_group.persisted?
- end
-
- private
-
- def expanded_resource_group_key
- strong_memoize(:expanded_resource_group_key) do
- ExpandVariables.expand(resource_group_key, -> { build.simple_variables })
- end
- end
- end
- end
- end
- end
- end
-end
diff --git a/lib/gitlab/ci/yaml_processor.rb b/lib/gitlab/ci/yaml_processor.rb
index 7f3f518dfd7..8ac864eb5cf 100644
--- a/lib/gitlab/ci/yaml_processor.rb
+++ b/lib/gitlab/ci/yaml_processor.rb
@@ -64,7 +64,6 @@ module Gitlab
except: job[:except],
rules: job[:rules],
cache: job[:cache],
- resource_group_key: job[:resource_group],
options: {
image: job[:image],
services: job[:services],
diff --git a/lib/gitlab/file_type_detection.rb b/lib/gitlab/file_type_detection.rb
index ca78d49f99b..e052792675a 100644
--- a/lib/gitlab/file_type_detection.rb
+++ b/lib/gitlab/file_type_detection.rb
@@ -20,6 +20,7 @@
module Gitlab
module FileTypeDetection
SAFE_IMAGE_EXT = %w[png jpg jpeg gif bmp tiff ico].freeze
+ PDF_EXT = 'pdf'
# We recommend using the .mp4 format over .mov. Videos in .mov format can
# still be used but you really need to make sure they are served with the
# proper MIME type video/mp4 and not video/quicktime or your videos won't play
@@ -46,6 +47,10 @@ module Gitlab
extension_match?(SAFE_AUDIO_EXT)
end
+ def pdf?
+ extension_match?([PDF_EXT])
+ end
+
def embeddable?
image? || video? || audio?
end
diff --git a/lib/gitlab/import_export/import_export.yml b/lib/gitlab/import_export/import_export.yml
index f822e931bdb..2fd4f18b756 100644
--- a/lib/gitlab/import_export/import_export.yml
+++ b/lib/gitlab/import_export/import_export.yml
@@ -203,8 +203,6 @@ excluded_attributes:
- :artifacts_metadata_store
- :artifacts_size
- :commands
- - :resource_group_id
- - :waiting_for_resource_at
push_event_payload:
- :event_id
project_badges:
diff --git a/lib/gitlab/import_export/relation_factory.rb b/lib/gitlab/import_export/relation_factory.rb
index 5d907300d68..1438a7db001 100644
--- a/lib/gitlab/import_export/relation_factory.rb
+++ b/lib/gitlab/import_export/relation_factory.rb
@@ -38,12 +38,12 @@ module Gitlab
IMPORTED_OBJECT_MAX_RETRIES = 5.freeze
- EXISTING_OBJECT_CHECK = %i[milestone milestones label labels project_label project_labels group_label group_labels project_feature merge_request ProjectCiCdSetting].freeze
+ EXISTING_OBJECT_CHECK = %i[milestone milestones label labels project_label project_labels group_label group_labels project_feature merge_request ProjectCiCdSetting container_expiration_policy].freeze
TOKEN_RESET_MODELS = %i[Project Namespace Ci::Trigger Ci::Build Ci::Runner ProjectHook].freeze
# This represents all relations that have unique key on `project_id`
- UNIQUE_RELATIONS = %i[project_feature ProjectCiCdSetting].freeze
+ UNIQUE_RELATIONS = %i[project_feature ProjectCiCdSetting container_expiration_policy].freeze
def self.create(*args)
new(*args).create