Skip to content
Snippets Groups Projects
Commit bd860c22 authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent e567b4c2
No related branches found
No related tags found
No related merge requests found
Showing
with 111 additions and 44 deletions
Loading
Loading
@@ -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.
Loading
Loading
---
title: Render xml artifact files in GitLab
merge_request: 16790
author:
type: added
1.8.1
1.9.0
Loading
Loading
@@ -199,12 +199,7 @@ class Projects::PipelinesController < Projects::ApplicationController
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
 
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -60,14 +63,30 @@ class IssuableFinder
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 = {})
Loading
Loading
@@ -79,6 +98,9 @@ class IssuableFinder
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
Loading
Loading
@@ -366,6 +388,33 @@ class IssuableFinder
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
Loading
Loading
# coding: utf-8
# frozen_string_literal: true
 
module PageLayoutHelper
Loading
Loading
Loading
Loading
@@ -562,7 +562,7 @@ module ProjectsHelper
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,
Loading
Loading
Loading
Loading
@@ -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
 
Loading
Loading
Loading
Loading
@@ -37,13 +37,18 @@ module Clusters
 
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
 
Loading
Loading
@@ -127,15 +132,9 @@ module Clusters
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
Loading
Loading
Loading
Loading
@@ -32,6 +32,10 @@ module Clusters
self.to_s.demodulize.underscore
end
 
def self.association_name
:"application_#{application_name}"
end
def name
self.class.application_name
end
Loading
Loading
# coding: utf-8
# frozen_string_literal: true
 
class Commit
Loading
Loading
Loading
Loading
@@ -753,6 +753,15 @@ class Project < ApplicationRecord
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
Loading
Loading
Loading
Loading
@@ -77,6 +77,10 @@ module Clusters
params[:application]
end
 
def application_class
Clusters::Cluster::APPLICATIONS[application_name]
end
def create_oauth_application(application, request)
oauth_application_params = {
name: params[:application],
Loading
Loading
Loading
Loading
@@ -10,7 +10,7 @@ module Clusters
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
Loading
Loading
Loading
Loading
@@ -16,7 +16,7 @@ module Clusters
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
Loading
Loading
Loading
Loading
@@ -10,7 +10,7 @@ module Clusters
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
Loading
Loading
Loading
Loading
@@ -9,3 +9,5 @@ module ProtectedBranches
end
end
end
ProtectedBranches::DestroyService.prepend_if_ee('EE::ProtectedBranches::DestroyService')
Loading
Loading
@@ -10,3 +10,5 @@ module ProtectedBranches
end
end
end
ProtectedBranches::UpdateService.prepend_if_ee('EE::ProtectedBranches::UpdateService')
Loading
Loading
@@ -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),
Loading
Loading
---
title: Add not param to Issues API endpoint
merge_request: 16748
author:
type: added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment