This instance will be upgraded to Heptapod 0.27.1 on 2021-12-02 at 15:00 UTC+1 (a few minutes of down time)

Commit 9bb3d24b authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent 4b06c61bd003
......@@ -565,11 +565,6 @@ Style/EmptyLiteral:
Style/EmptyMethod:
Enabled: false
# Offense count: 40
# Cop supports --auto-correct.
Style/Encoding:
Enabled: false
# Offense count: 203
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
......
---
title: Render xml artifact files in GitLab
merge_request: 16790
author:
type: added
......@@ -199,12 +199,7 @@ def set_pipeline_path
end
def latest_pipeline
ref = params['ref'].presence || @project.default_branch
sha = @project.commit(ref)&.sha
@project.ci_pipelines
.newest_first(ref: ref, sha: sha)
.first
@project.latest_pipeline_for_ref(params['ref'])
&.present(current_user: current_user)
end
......
......@@ -46,10 +46,13 @@ class IssuableFinder
# This is used in unassigning users
NONE = '0'
NEGATABLE_PARAMS_HELPER_KEYS = %i[include_subgroups in].freeze
attr_accessor :current_user, :params
def self.scalar_params
@scalar_params ||= %i[
class << self
def scalar_params
@scalar_params ||= %i[
assignee_id
assignee_username
author_id
......@@ -60,14 +63,30 @@ def self.scalar_params
search
in
]
end
end
def self.array_params
@array_params ||= { label_name: [], assignee_username: [] }
end
def array_params
@array_params ||= { label_name: [], assignee_username: [] }
end
# This should not be used in controller strong params!
def negatable_scalar_params
@negatable_scalar_params ||= scalar_params + %i[project_id group_id]
end
# This should not be used in controller strong params!
def negatable_array_params
@negatable_array_params ||= array_params.keys.append(:iids)
end
def self.valid_params
@valid_params ||= scalar_params + [array_params]
# This should not be used in controller strong params!
def negatable_params
@negatable_params ||= negatable_scalar_params + negatable_array_params
end
def valid_params
@valid_params ||= scalar_params + [array_params] + [{ not: [] }]
end
end
def initialize(current_user, params = {})
......@@ -79,6 +98,9 @@ def execute
items = init_collection
items = filter_items(items)
# Let's see if we have to negate anything
items = by_negation(items)
# This has to be last as we use a CTE as an optimization fence
# for counts by passing the force_cte param and enabling the
# attempt_group_search_optimizations feature flag
......@@ -366,6 +388,33 @@ def count_key(value)
Array(value).last.to_sym
end
# Negates all params found in `negatable_params`
# rubocop: disable CodeReuse/ActiveRecord
def by_negation(items)
not_params = params[:not].dup
# API endpoints send in `nil` values so we test if there are any non-nil
return items unless not_params.present? && not_params.values.any?
not_params.keep_if { |_k, v| v.present? }.each do |(key, value)|
# These aren't negatable params themselves, but rather help other searches, so we skip them.
# They will be added into all the NOT searches.
next if NEGATABLE_PARAMS_HELPER_KEYS.include?(key.to_sym)
next unless self.class.negatable_params.include?(key.to_sym)
# These are "helper" params that are required inside the NOT to get the right results. They usually come in
# at the top-level params, but if they do come in inside the `:not` params, they should take precedence.
not_helpers = params.slice(*NEGATABLE_PARAMS_HELPER_KEYS).merge(params[:not].slice(*NEGATABLE_PARAMS_HELPER_KEYS))
not_param = { key => value }.with_indifferent_access.merge(not_helpers)
items_to_negate = self.class.new(current_user, not_param).execute
items = items.where.not(id: items_to_negate)
end
items
end
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: disable CodeReuse/ActiveRecord
def by_scope(items)
return items.none if current_user_related? && !current_user
......
# coding: utf-8
# frozen_string_literal: true
module PageLayoutHelper
......
......@@ -562,7 +562,7 @@ def project_permissions_panel_data(project)
allowedVisibilityOptions: project_allowed_visibility_levels(project),
visibilityHelpPath: help_page_path('public_access/public_access'),
registryAvailable: Gitlab.config.registry.enabled,
registryHelpPath: help_page_path('user/project/container_registry'),
registryHelpPath: help_page_path('user/packages/container_registry/index'),
lfsAvailable: Gitlab.config.lfs.enabled,
lfsHelpPath: help_page_path('workflow/lfs/manage_large_binaries_with_git_lfs'),
pagesAvailable: Gitlab.config.pages.enabled,
......
......@@ -4,7 +4,7 @@ module Ci
class ArtifactBlob
include BlobLike
EXTENSIONS_SERVED_BY_PAGES = %w[.html .htm .txt .json .log].freeze
EXTENSIONS_SERVED_BY_PAGES = %w[.html .htm .txt .json .xml .log].freeze
attr_reader :entry
......
......@@ -37,13 +37,18 @@ class Cluster < ApplicationRecord
has_one :platform_kubernetes, class_name: 'Clusters::Platforms::Kubernetes', inverse_of: :cluster, autosave: true
has_one :application_helm, class_name: 'Clusters::Applications::Helm'
has_one :application_ingress, class_name: 'Clusters::Applications::Ingress'
has_one :application_cert_manager, class_name: 'Clusters::Applications::CertManager'
has_one :application_prometheus, class_name: 'Clusters::Applications::Prometheus'
has_one :application_runner, class_name: 'Clusters::Applications::Runner'
has_one :application_jupyter, class_name: 'Clusters::Applications::Jupyter'
has_one :application_knative, class_name: 'Clusters::Applications::Knative'
def self.has_one_cluster_application(name) # rubocop:disable Naming/PredicateName
application = APPLICATIONS[name.to_s]
has_one application.association_name, class_name: application.to_s # rubocop:disable Rails/ReflectionClassName
end
has_one_cluster_application :helm
has_one_cluster_application :ingress
has_one_cluster_application :cert_manager
has_one_cluster_application :prometheus
has_one_cluster_application :runner
has_one_cluster_application :jupyter
has_one_cluster_application :knative
has_many :kubernetes_namespaces
......@@ -127,15 +132,9 @@ def calculate_reactive_cache
end
def applications
[
application_helm || build_application_helm,
application_ingress || build_application_ingress,
application_cert_manager || build_application_cert_manager,
application_prometheus || build_application_prometheus,
application_runner || build_application_runner,
application_jupyter || build_application_jupyter,
application_knative || build_application_knative
]
APPLICATIONS.values.map do |application_class|
public_send(application_class.association_name) || public_send("build_#{application_class.association_name}") # rubocop:disable GitlabSecurity/PublicSend
end
end
def provider
......
......@@ -32,6 +32,10 @@ def self.application_name
self.to_s.demodulize.underscore
end
def self.association_name
:"application_#{application_name}"
end
def name
self.class.application_name
end
......
# coding: utf-8
# frozen_string_literal: true
class Commit
......
......@@ -753,6 +753,15 @@ def latest_successful_build_for_ref!(job_name, ref = default_branch)
latest_successful_build_for_ref(job_name, ref) || raise(ActiveRecord::RecordNotFound.new("Couldn't find job #{job_name}"))
end
def latest_pipeline_for_ref(ref = default_branch)
ref = ref.presence || default_branch
sha = commit(ref)&.sha
return unless sha
ci_pipelines.newest_first(ref: ref, sha: sha).first
end
def merge_base_commit(first_commit_id, second_commit_id)
sha = repository.merge_base(first_commit_id, second_commit_id)
commit_by(oid: sha) if sha
......
......@@ -77,6 +77,10 @@ def application_name
params[:application]
end
def application_class
Clusters::Cluster::APPLICATIONS[application_name]
end
def create_oauth_application(application, request)
oauth_application_params = {
name: params[:application],
......
......@@ -10,7 +10,7 @@ def worker_class(application)
end
def builder
cluster.public_send(:"application_#{application_name}") || # rubocop:disable GitlabSecurity/PublicSend
cluster.public_send(application_class.association_name) || # rubocop:disable GitlabSecurity/PublicSend
cluster.public_send(:"build_application_#{application_name}") # rubocop:disable GitlabSecurity/PublicSend
end
end
......
......@@ -16,7 +16,7 @@ def execute(_request)
private
def builder
cluster.public_send(:"application_#{application_name}") # rubocop:disable GitlabSecurity/PublicSend
cluster.public_send(application_class.association_name) # rubocop:disable GitlabSecurity/PublicSend
end
end
end
......
......@@ -10,7 +10,7 @@ def worker_class(application)
end
def builder
cluster.public_send(:"application_#{application_name}") # rubocop:disable GitlabSecurity/PublicSend
cluster.public_send(application_class.association_name) # rubocop:disable GitlabSecurity/PublicSend
end
end
end
......
......@@ -9,3 +9,5 @@ def execute(protected_branch)
end
end
end
ProtectedBranches::DestroyService.prepend_if_ee('EE::ProtectedBranches::DestroyService')
......@@ -10,3 +10,5 @@ def execute(protected_branch)
end
end
end
ProtectedBranches::UpdateService.prepend_if_ee('EE::ProtectedBranches::UpdateService')
......@@ -2,7 +2,7 @@
.row.registry-placeholder.prepend-bottom-10
.col-12
#js-vue-registry-images{ data: { endpoint: project_container_registry_index_path(@project, format: :json),
"help_page_path" => help_page_path('user/project/container_registry'),
"help_page_path" => help_page_path('user/packages/container_registry/index'),
"no_containers_image" => image_path('illustrations/docker-empty-state.svg'),
"containers_error_image" => image_path('illustrations/docker-error-state.svg'),
"repository_url" => escape_once(@project.container_registry_url),
......
---
title: Add not param to Issues API endpoint
merge_request: 16748
author:
type: added
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment