Read about our upcoming Code of Conduct on this issue

Commit 85d850b0 authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent fbbf3a83d241
......@@ -3,7 +3,6 @@ image: "registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-golang-1.1
stages:
- sync
- prepare
- quick-test
- test
- post-test
- review-prepare
......
......@@ -660,129 +660,3 @@ Style/UnneededCondition:
# Cop supports --auto-correct.
Style/UnneededInterpolation:
Enabled: false
RSpec/ReceiveCounts:
Exclude:
- 'ee/spec/models/broadcast_message_spec.rb'
- 'ee/spec/services/geo/project_housekeeping_service_spec.rb'
- 'ee/spec/services/geo/repository_sync_service_spec.rb'
- 'spec/lib/gitlab/ci/build/rules/rule/clause/exists_spec.rb'
- 'spec/lib/gitlab/ci/trace/section_parser_spec.rb'
- 'spec/lib/gitlab/cleanup/project_uploads_spec.rb'
- 'spec/lib/gitlab/danger/teammate_spec.rb'
- 'spec/lib/gitlab/git_access_spec.rb'
- 'spec/lib/gitlab/gpg_spec.rb'
- 'spec/lib/gitlab/legacy_github_import/importer_spec.rb'
- 'spec/lib/gitlab/sanitizers/exif_spec.rb'
- 'spec/models/concerns/avatarable_spec.rb'
- 'spec/models/concerns/triggerable_hooks_spec.rb'
- 'spec/requests/api/graphql_spec.rb'
- 'spec/services/ci/ensure_stage_service_spec.rb'
- 'spec/services/clusters/cleanup/app_service_spec.rb'
- 'spec/services/notification_service_spec.rb'
- 'spec/services/projects/housekeeping_service_spec.rb'
- 'spec/tasks/gitlab/cleanup_rake_spec.rb'
- 'spec/uploaders/gitlab_uploader_spec.rb'
- 'spec/workers/create_gpg_signature_worker_spec.rb'
RSpec/ContextMethod:
Exclude:
- 'ee/spec/controllers/ee/projects/autocomplete_sources_controller_spec.rb'
- 'ee/spec/controllers/groups/autocomplete_sources_controller_spec.rb'
- 'ee/spec/finders/geo/file_registry_finder_spec.rb'
- 'ee/spec/helpers/feature_flags_helper_spec.rb'
- 'ee/spec/lib/ee/gitlab/background_migration/migrate_approver_to_approval_rules_spec.rb'
- 'ee/spec/lib/ee/gitlab/ci/config/entry/trigger_spec.rb'
- 'ee/spec/lib/elastic/latest/snippet_instance_proxy_spec.rb'
- 'ee/spec/lib/gitlab/contribution_analytics/data_collector_spec.rb'
- 'ee/spec/lib/gitlab/geo/replication/file_transfer_spec.rb'
- 'ee/spec/lib/gitlab/geo/replication/job_artifact_downloader_spec.rb'
- 'ee/spec/lib/gitlab/geo/replication/job_artifact_retriever_spec.rb'
- 'ee/spec/lib/gitlab/geo/replication/job_artifact_transfer_spec.rb'
- 'ee/spec/lib/gitlab/geo/replication/lfs_downloader_spec.rb'
- 'ee/spec/lib/gitlab/geo/replication/lfs_retriever_spec.rb'
- 'ee/spec/lib/gitlab/geo/replication/lfs_transfer_spec.rb'
- 'ee/spec/lib/gitlab/geo_spec.rb'
- 'ee/spec/models/approval_state_spec.rb'
- 'ee/spec/models/approval_wrapped_any_approver_rule_spec.rb'
- 'ee/spec/models/concerns/approval_rule_like_spec.rb'
- 'ee/spec/models/concerns/elastic/issue_spec.rb'
- 'ee/spec/models/concerns/elastic/note_spec.rb'
- 'ee/spec/models/concerns/elastic/project_spec.rb'
- 'ee/spec/models/concerns/epic_tree_sorting_spec.rb'
- 'ee/spec/models/concerns/has_timelogs_report_spec.rb'
- 'ee/spec/models/ee/clusters/applications/prometheus_spec.rb'
- 'ee/spec/models/ee/clusters/platforms/kubernetes_spec.rb'
- 'ee/spec/models/user_spec.rb'
- 'ee/spec/presenters/ci/pipeline_presenter_spec.rb'
- 'ee/spec/requests/api/epics_spec.rb'
- 'ee/spec/services/boards/update_service_spec.rb'
- 'ee/spec/services/ee/boards/issues/list_service_spec.rb'
- 'ee/spec/services/ee/merge_requests/refresh_service_spec.rb'
- 'ee/spec/services/groups/update_service_spec.rb'
- 'ee/spec/services/projects/create_from_template_service_spec.rb'
- 'ee/spec/services/projects/update_service_spec.rb'
- 'ee/spec/services/update_build_minutes_service_spec.rb'
- 'ee/spec/support/shared_examples/features/gold_trial_callout_shared_examples.rb'
- 'ee/spec/support/shared_examples/models/concerns/elastic/limited_indexing_shared_examples.rb'
- 'qa/spec/ee/scenario/test/integration/group_saml_spec.rb'
- 'qa/spec/resource/api_fabricator_spec.rb'
- 'qa/spec/scenario/test/integration/github_spec.rb'
- 'qa/spec/scenario/test/integration/instance_saml_spec.rb'
- 'qa/spec/scenario/test/integration/kubernetes_spec.rb'
- 'qa/spec/scenario/test/integration/ldap_spec.rb'
- 'qa/spec/scenario/test/integration/mattermost_spec.rb'
- 'qa/spec/scenario/test/integration/oauth_spec.rb'
- 'qa/spec/scenario/test/integration/object_storage_spec.rb'
- 'qa/spec/specs/runner_spec.rb'
- 'spec/controllers/application_controller_spec.rb'
- 'spec/controllers/projects/milestones_controller_spec.rb'
- 'spec/features/projects/blobs/blob_show_spec.rb'
- 'spec/finders/concerns/finder_with_cross_project_access_spec.rb'
- 'spec/helpers/diff_helper_spec.rb'
- 'spec/helpers/nav_helper_spec.rb'
- 'spec/helpers/sourcegraph_helper_spec.rb'
- 'spec/lib/container_registry/registry_spec.rb'
- 'spec/lib/container_registry/tag_spec.rb'
- 'spec/lib/gitlab/ci/trace/chunked_io_spec.rb'
- 'spec/lib/gitlab/content_security_policy/config_loader_spec.rb'
- 'spec/lib/gitlab/database/count_spec.rb'
- 'spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb'
- 'spec/lib/gitlab/git_ref_validator_spec.rb'
- 'spec/lib/gitlab/private_commit_email_spec.rb'
- 'spec/lib/gitlab/rugged_instrumentation_spec.rb'
- 'spec/lib/omni_auth/strategies/jwt_spec.rb'
- 'spec/lib/safe_zip/entry_spec.rb'
- 'spec/lib/safe_zip/extract_spec.rb'
- 'spec/models/badge_spec.rb'
- 'spec/models/badges/project_badge_spec.rb'
- 'spec/models/ci/artifact_blob_spec.rb'
- 'spec/models/ci/persistent_ref_spec.rb'
- 'spec/models/ci/runner_spec.rb'
- 'spec/models/concerns/routable_spec.rb'
- 'spec/models/deployment_spec.rb'
- 'spec/models/issue_spec.rb'
- 'spec/models/notification_recipient_spec.rb'
- 'spec/models/project_services/bamboo_service_spec.rb'
- 'spec/models/project_services/buildkite_service_spec.rb'
- 'spec/models/project_services/chat_message/issue_message_spec.rb'
- 'spec/models/project_services/drone_ci_service_spec.rb'
- 'spec/models/project_services/hipchat_service_spec.rb'
- 'spec/models/project_services/jira_service_spec.rb'
- 'spec/models/project_spec.rb'
- 'spec/models/remote_mirror_spec.rb'
- 'spec/models/user_spec.rb'
- 'spec/models/wiki_page_spec.rb'
- 'spec/requests/api/issues/get_group_issues_spec.rb'
- 'spec/requests/api/merge_requests_spec.rb'
- 'spec/serializers/diff_file_entity_spec.rb'
- 'spec/services/branches/delete_merged_service_spec.rb'
- 'spec/services/labels/available_labels_service_spec.rb'
- 'spec/services/projects/batch_open_issues_count_service_spec.rb'
- 'spec/services/projects/destroy_service_spec.rb'
- 'spec/services/projects/hashed_storage/migrate_attachments_service_spec.rb'
- 'spec/services/projects/hashed_storage/rollback_attachments_service_spec.rb'
- 'spec/services/projects/open_issues_count_service_spec.rb'
- 'spec/services/quick_actions/interpret_service_spec.rb'
- 'spec/support/shared_examples/services/boards/issues_list_service_shared_examples.rb'
- 'spec/uploaders/namespace_file_uploader_spec.rb'
......@@ -307,7 +307,7 @@ export default {
<a
v-if="titleLink"
:href="titleLink"
target="blank"
target="_blank"
rel="noopener noreferrer"
class="js-cluster-application-title"
>{{ title }}</a
......
......@@ -285,7 +285,7 @@ export default {
ref="viewButton"
v-gl-tooltip.hover
:href="diffFile.view_path"
target="blank"
target="_blank"
class="view-file"
data-track-event="click_toggle_view_sha_button"
data-track-label="diff_toggle_view_sha_button"
......
......@@ -166,7 +166,7 @@ export const setUrlFragment = (url, fragment) => {
export function visitUrl(url, external = false) {
if (external) {
// Simulate `target="blank" rel="noopener noreferrer"`
// Simulate `target="_blank" rel="noopener noreferrer"`
// See https://mathiasbynens.github.io/rel-noopener/
const otherWindow = window.open();
otherWindow.opener = null;
......
......@@ -14,13 +14,24 @@ def index
track_event(:list_repositories)
render json: ContainerRepositoriesSerializer
serializer = ContainerRepositoriesSerializer
.new(current_user: current_user)
.represent_read_only(@images)
if Feature.enabled?(:vue_container_registry_explorer)
render json: serializer.with_pagination(request, response)
.represent_read_only(@images)
else
render json: serializer.represent_read_only(@images)
end
end
end
end
# The show action renders index to allow frontend routing to work on page refresh
def show
render :index
end
private
def feature_flag_group_container_registry_browser!
......
......@@ -14,13 +14,23 @@ def index
track_event(:list_repositories)
render json: ContainerRepositoriesSerializer
serializer = ContainerRepositoriesSerializer
.new(project: project, current_user: current_user)
.represent(@images)
if Feature.enabled?(:vue_container_registry_explorer)
render json: serializer.with_pagination(request, response).represent(@images)
else
render json: serializer.represent(@images)
end
end
end
end
# The show action renders index to allow frontend routing to work on page refresh
def show
render :index
end
def destroy
DeleteContainerRepositoryWorker.perform_async(current_user.id, image.id)
track_event(:delete_repository)
......
# frozen_string_literal: true
module Projects
module Prometheus
# Find Prometheus alerts by +project+, +environment+, +id+,
# or any combo thereof.
#
# Optionally filter by +metric+.
#
# Arguments:
# params:
# project: Project | integer
# environment: Environment | integer
# metric: PrometheusMetric | integer
class AlertsFinder
def initialize(params = {})
unless params[:project] || params[:environment] || params[:id]
raise ArgumentError,
'Please provide one or more of the following params: :project, :environment, :id'
end
@params = params
end
# Find all matching alerts
#
# @return [ActiveRecord::Relation<PrometheusAlert>]
def execute
relation = by_project(PrometheusAlert)
relation = by_environment(relation)
relation = by_metric(relation)
relation = by_id(relation)
relation = ordered(relation)
relation
end
private
attr_reader :params
def by_project(relation)
return relation unless params[:project]
relation.for_project(params[:project])
end
def by_environment(relation)
return relation unless params[:environment]
relation.for_environment(params[:environment])
end
def by_metric(relation)
return relation unless params[:metric]
relation.for_metric(params[:metric])
end
def by_id(relation)
return relation unless params[:id]
relation.id_in(params[:id])
end
def ordered(relation)
relation.order_by('id_asc')
end
end
end
end
# frozen_string_literal: true
# ProtectedBranchesFinder
#
# Used to filter protected branches by set of params
#
# Arguments:
# project - which project to scope to
# params:
# search: string
class ProtectedBranchesFinder
LIMIT = 100
attr_accessor :project, :params
def initialize(project, params = {})
@project = project
@params = params
end
def execute
protected_branches = project.limited_protected_branches(LIMIT)
protected_branches = by_name(protected_branches)
protected_branches
end
private
def by_name(protected_branches)
return protected_branches unless params[:search].present?
protected_branches.by_name(params[:search])
end
end
......@@ -2304,6 +2304,10 @@ def uses_default_ci_config?
ci_config_path.blank? || ci_config_path == Gitlab::FileDetector::PATTERNS[:gitlab_ci]
end
def limited_protected_branches(limit)
protected_branches.limit(limit)
end
private
def closest_namespace_setting(name)
......
......@@ -2,6 +2,7 @@
class ProtectedBranch < ApplicationRecord
include ProtectedRef
include Gitlab::SQL::Pattern
scope :requiring_code_owner_approval,
-> { where(code_owner_approval_required: true) }
......@@ -45,6 +46,12 @@ def self.branch_requires_code_owner_approval?(project, branch_name)
# NOOP
#
end
def self.by_name(query)
return none if query.blank?
where(fuzzy_arel_match(:name, query.downcase))
end
end
ProtectedBranch.prepend_if_ee('EE::ProtectedBranch')
# frozen_string_literal: true
module Projects
module Prometheus
class AlertPresenter < Gitlab::View::Presenter::Delegated
RESERVED_ANNOTATIONS = %w(gitlab_incident_markdown title).freeze
GENERIC_ALERT_SUMMARY_ANNOTATIONS = %w(monitoring_tool service hosts).freeze
MARKDOWN_LINE_BREAK = " \n".freeze
def full_title
[environment_name, alert_title].compact.join(': ')
end
def project_full_path
project.full_path
end
def metric_query
gitlab_alert&.full_query
end
def environment_name
environment&.name
end
def performance_dashboard_link
if environment
metrics_project_environment_url(project, environment)
else
metrics_project_environments_url(project)
end
end
def starts_at
super&.rfc3339
end
def issue_summary_markdown
<<~MARKDOWN.chomp
#### Summary
#{metadata_list}
#{alert_details}
MARKDOWN
end
private
def alert_title
query_title || title
end
def query_title
return unless gitlab_alert
"#{gitlab_alert.title} #{gitlab_alert.computed_operator} #{gitlab_alert.threshold} for 5 minutes"
end
def metadata_list
metadata = []
metadata << list_item('Start time', starts_at) if starts_at
metadata << list_item('full_query', backtick(full_query)) if full_query
metadata << list_item(service.label.humanize, service.value) if service
metadata << list_item(monitoring_tool.label.humanize, monitoring_tool.value) if monitoring_tool
metadata << list_item(hosts.label.humanize, host_links) if hosts
metadata.join(MARKDOWN_LINE_BREAK)
end
def alert_details
if annotation_list.present?
<<~MARKDOWN.chomp
#### Alert Details
#{annotation_list}
MARKDOWN
end
end
def annotation_list
strong_memoize(:annotation_list) do
annotations
.reject { |annotation| annotation.label.in?(RESERVED_ANNOTATIONS | GENERIC_ALERT_SUMMARY_ANNOTATIONS) }
.map { |annotation| list_item(annotation.label, annotation.value) }
.join(MARKDOWN_LINE_BREAK)
end
end
def list_item(key, value)
"**#{key}:** #{value}".strip
end
def backtick(value)
"`#{value}`"
end
GENERIC_ALERT_SUMMARY_ANNOTATIONS.each do |annotation_name|
define_method(annotation_name) do
annotations.find { |a| a.label == annotation_name }
end
end
def host_links
Array(hosts.value).join(' ')
end
end
end
end
# frozen_string_literal: true
class ContainerRepositoriesSerializer < BaseSerializer
include WithPagination
entity ContainerRepositoryEntity
def represent_read_only(resource)
......
......@@ -81,15 +81,17 @@ def enqueue_invalidate_cache
end
def pipeline_params
{
before: oldrev,
after: newrev,
ref: ref,
variables_attributes: generate_vars_from_push_options || [],
push_options: params[:push_options] || {},
checkout_sha: Gitlab::DataBuilder::Push.checkout_sha(
project.repository, newrev, ref)
}
strong_memoize(:pipeline_params) do
{
before: oldrev,
after: newrev,
ref: ref,
variables_attributes: generate_vars_from_push_options || [],
push_options: params[:push_options] || {},
checkout_sha: Gitlab::DataBuilder::Push.checkout_sha(
project.repository, newrev, ref)
}
end
end
def ci_variables_from_push_options
......@@ -156,12 +158,16 @@ def log_pipeline_errors(exception)
project_path: project.full_path,
message: "Error creating pipeline",
errors: exception.to_s,
pipeline_params: pipeline_params
pipeline_params: sanitized_pipeline_params
}
logger.warn(data)
end
def sanitized_pipeline_params
pipeline_params.except(:push_options)
end
def logger
if Gitlab::Runtime.sidekiq?
Sidekiq.logger
......
---
title: Add show routes for group and project repositories_controllers and add pagination
to the index responses
merge_request: 23151
author:
type: added
---
title: 'Add CI variables to configure bundler-audit advisory database (Dependency Scanning)'
merge_request: 23717
author:
type: added
---
title: Add search support for protected branches API
merge_request: 24137
author:
type: added
---
title: Fix inconditionally setting user profile to public when updating via
API and private_profile parameter is not present in the request
merge_request: 24456
author: Diego Louzán
type: fixed
---
title: Redact push options from error logs
merge_request: 24540
author:
type: fixed
......@@ -76,7 +76,7 @@
end
end
resources :container_registries, only: [:index], controller: 'registry/repositories'
resources :container_registries, only: [:index, :show], controller: 'registry/repositories'
end
scope(path: '*id',
......
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