Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-01-24 09:16:59 +00:00
parent 6178536e7e
commit 94df43c8c1
13 changed files with 83 additions and 40 deletions

View File

@ -1 +1 @@
639d1a25d4de3e2a60cf10e8c3afc0121c27c317
3f6bb782a56a34cca7d7c45493119dc2c457b303

View File

@ -57,7 +57,7 @@ export default {
'totalClusters',
]),
contentAlignClasses() {
return 'gl-display-flex gl-align-items-center gl-justify-content-end gl-justify-content-md-start';
return 'gl-display-flex gl-align-items-center gl-justify-content-end gl-md-justify-content-start';
},
currentPage: {
get() {

View File

@ -128,7 +128,7 @@ export default {
>
<template #cell(name)="{ item }">
<div
class="gl-display-flex align-items-center gl-justify-content-end gl-justify-content-md-start"
class="gl-display-flex align-items-center gl-justify-content-end gl-md-justify-content-start"
data-testid="terraform-states-table-name"
>
<p class="gl-font-weight-bold gl-m-0 gl-text-gray-900">

View File

@ -90,7 +90,7 @@ export default {
</template>
<div class="row">
<div
class="col-md-5 order-md-last col-12 gl-mt-5 gl-mt-md-n2! gl-pt-md-2 svg-content svg-225"
class="col-md-5 order-md-last col-12 gl-mt-5 gl-md-mt-n2! gl-md-pt-2 svg-content svg-225"
>
<img data-testid="pipeline-image" :src="pipelineSvgPath" />
</div>

View File

@ -7,22 +7,20 @@ module Gitlab
DEFAULT_SAMPLING_INTERVAL_SECONDS = 60
GC_REPORT_BUCKETS = [0.01, 0.05, 0.1, 0.2, 0.3, 0.5, 1].freeze
def initialize(...)
def initialize(prefix: nil, **options)
@prefix = prefix
GC::Profiler.clear
metrics[:process_start_time_seconds].set(labels, Time.now.to_i)
super(...)
super(**options)
end
def metrics
@metrics ||= init_metrics
end
def with_prefix(prefix, name)
"ruby_#{prefix}_#{name}".to_sym
end
def to_doc_string(name)
name.to_s.humanize
end
@ -33,19 +31,19 @@ module Gitlab
def init_metrics
metrics = {
file_descriptors: ::Gitlab::Metrics.gauge(with_prefix(:file, :descriptors), 'File descriptors used', labels),
process_cpu_seconds_total: ::Gitlab::Metrics.gauge(with_prefix(:process, :cpu_seconds_total), 'Process CPU seconds total'),
process_max_fds: ::Gitlab::Metrics.gauge(with_prefix(:process, :max_fds), 'Process max fds'),
process_resident_memory_bytes: ::Gitlab::Metrics.gauge(with_prefix(:process, :resident_memory_bytes), 'Memory used (RSS)', labels),
process_unique_memory_bytes: ::Gitlab::Metrics.gauge(with_prefix(:process, :unique_memory_bytes), 'Memory used (USS)', labels),
process_proportional_memory_bytes: ::Gitlab::Metrics.gauge(with_prefix(:process, :proportional_memory_bytes), 'Memory used (PSS)', labels),
process_start_time_seconds: ::Gitlab::Metrics.gauge(with_prefix(:process, :start_time_seconds), 'Process start time seconds'),
sampler_duration: ::Gitlab::Metrics.counter(with_prefix(:sampler, :duration_seconds_total), 'Sampler time', labels),
gc_duration_seconds: ::Gitlab::Metrics.histogram(with_prefix(:gc, :duration_seconds), 'GC time', labels, GC_REPORT_BUCKETS)
file_descriptors: ::Gitlab::Metrics.gauge(metric_name(:file, :descriptors), 'File descriptors used', labels),
process_cpu_seconds_total: ::Gitlab::Metrics.gauge(metric_name(:process, :cpu_seconds_total), 'Process CPU seconds total'),
process_max_fds: ::Gitlab::Metrics.gauge(metric_name(:process, :max_fds), 'Process max fds'),
process_resident_memory_bytes: ::Gitlab::Metrics.gauge(metric_name(:process, :resident_memory_bytes), 'Memory used (RSS)', labels),
process_unique_memory_bytes: ::Gitlab::Metrics.gauge(metric_name(:process, :unique_memory_bytes), 'Memory used (USS)', labels),
process_proportional_memory_bytes: ::Gitlab::Metrics.gauge(metric_name(:process, :proportional_memory_bytes), 'Memory used (PSS)', labels),
process_start_time_seconds: ::Gitlab::Metrics.gauge(metric_name(:process, :start_time_seconds), 'Process start time seconds'),
sampler_duration: ::Gitlab::Metrics.counter(metric_name(:sampler, :duration_seconds_total), 'Sampler time', labels),
gc_duration_seconds: ::Gitlab::Metrics.histogram(metric_name(:gc, :duration_seconds), 'GC time', labels, GC_REPORT_BUCKETS)
}
GC.stat.keys.each do |key|
metrics[key] = ::Gitlab::Metrics.gauge(with_prefix(:gc_stat, key), to_doc_string(key), labels)
metrics[key] = ::Gitlab::Metrics.gauge(metric_name(:gc_stat, key), to_doc_string(key), labels)
end
metrics
@ -65,6 +63,12 @@ module Gitlab
private
def metric_name(group, metric)
name = "ruby_#{group}_#{metric}"
name = "#{@prefix}_#{name}" if @prefix.present?
name.to_sym
end
def sample_gc
# Observe all GC samples
sample_gc_reports.each do |report|

View File

@ -31803,6 +31803,9 @@ msgstr ""
msgid "SecurityOrchestration|Scan result"
msgstr ""
msgid "SecurityOrchestration|Scan result policies can only be created by project owners."
msgstr ""
msgid "SecurityOrchestration|Scan to be performed %{cadence}"
msgstr ""
@ -31848,7 +31851,7 @@ msgstr ""
msgid "SecurityOrchestration|Unlinking a security project removes all policies stored in the linked security project. Save to confirm this action."
msgstr ""
msgid "SecurityOrchestration|Update scan execution policies"
msgid "SecurityOrchestration|Update scan policies"
msgstr ""
msgid "SecurityOrchestration|a"

View File

@ -50,7 +50,7 @@ class MetricsServer # rubocop:disable Gitlab/NamespacedClass
# a race where not all Prometheus db files will be visible to the exporter, resulting
# in missing metrics.
# Warming up ensures that these files exist prior to the exporter starting up.
Gitlab::Metrics::Samplers::RubySampler.initialize_instance(warmup: true).start
Gitlab::Metrics::Samplers::RubySampler.initialize_instance(prefix: name, warmup: true).start
exporter_class = "Gitlab::Metrics::Exporter::#{@target.camelize}Exporter".constantize
settings = Settings.new(Settings.monitoring[name])

View File

@ -57,7 +57,7 @@
"@gitlab/favicon-overlay": "2.0.0",
"@gitlab/svgs": "2.2.0",
"@gitlab/tributejs": "1.0.0",
"@gitlab/ui": "32.68.0",
"@gitlab/ui": "33.0.0",
"@gitlab/visual-review-tools": "1.6.1",
"@rails/actioncable": "6.1.4-1",
"@rails/ujs": "6.1.4-1",

View File

@ -61,6 +61,8 @@ module QA
end
def fabricate_via_api!
resource_web_url(api_get)
rescue ResourceNotFoundError
populate_new_branch_if_required
super
@ -75,7 +77,11 @@ module QA
end
def api_delete_path
"/projects/#{project.id}/protected_branches/#{branch_name}"
api_get_path
end
def api_put_path
api_get_path
end
def api_post_path
@ -107,6 +113,16 @@ module QA
# this particular resource does not expose a web_url property
end
def set_require_code_owner_approval(require = true)
response = patch(Runtime::API::Request.new(api_client, api_put_path).url, { code_owner_approval_required: require })
return if response.code == HTTP_STATUS_OK
raise(
ResourceUpdateFailedError,
"Could not update code_owner_approval_required to #{require}. Request returned (#{response.code}): `#{response}`."
)
end
class Roles
NO_ONE = { description: 'No one', access_level: 0 }.freeze
DEVS_AND_MAINTAINERS = { description: 'Developers + Maintainers', access_level: 30 }.freeze

View File

@ -44,6 +44,18 @@ module QA
end
end
def patch(url, payload = nil)
with_retry_on_too_many_requests do
RestClient::Request.execute(
method: :patch,
url: url,
payload: payload,
verify_ssl: false)
rescue RestClient::ExceptionWithResponse => e
return_response_or_raise(e)
end
end
def put(url, payload = nil)
with_retry_on_too_many_requests do
RestClient::Request.execute(

View File

@ -31,19 +31,13 @@ module QA
end
# Require approval from code owners on the default branch
# The default branch is already protected, and we can't update a protected branch via the API (yet)
# so we unprotect it first and then protect it again with the desired parameters
Resource::ProtectedBranch.unprotect_via_api! do |protected_branch|
protected_branch.project = project
protected_branch.branch_name = project.default_branch
end
Resource::ProtectedBranch.fabricate_via_api! do |protected_branch|
protected_branch.project = project
protected_branch.branch_name = project.default_branch
protected_branch.new_branch = false
protected_branch.require_code_owner_approval = true
protected_branch = Resource::ProtectedBranch.fabricate_via_api! do |branch|
branch.project = project
branch.branch_name = project.default_branch
branch.new_branch = false
branch.require_code_owner_approval = true
end
protected_branch.set_require_code_owner_approval
# Push a change to the file with a CODEOWNERS rule
Resource::Repository::Push.fabricate! do |push|

View File

@ -18,6 +18,20 @@ RSpec.describe Gitlab::Metrics::Samplers::RubySampler do
expect(sampler.metrics[:process_start_time_seconds].get).to eq(Time.now.to_i)
end
end
context 'when not setting a prefix' do
it 'does not prepend metrics with that prefix' do
expect(sampler.metrics[:process_start_time_seconds].name).to eq(:ruby_process_start_time_seconds)
end
end
context 'when using custom prefix' do
let(:sampler) { described_class.new(prefix: 'custom') }
it 'prepends metrics with that prefix' do
expect(sampler.metrics[:process_start_time_seconds].name).to eq(:custom_ruby_process_start_time_seconds)
end
end
end
describe '#sample' do

View File

@ -924,10 +924,10 @@
resolved "https://registry.yarnpkg.com/@gitlab/tributejs/-/tributejs-1.0.0.tgz#672befa222aeffc83e7d799b0500a7a4418e59b8"
integrity sha512-nmKw1+hB6MHvlmPz63yPwVs1qQkycHwsKgxpEbzmky16Y6mL4EJMk3w1b8QlOAF/AIAzjCERPhe/R4MJiohbZw==
"@gitlab/ui@32.68.0":
version "32.68.0"
resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-32.68.0.tgz#f7c4ebd2f9b3635db16589b289fdda149ca1cbcc"
integrity sha512-rTd0+bNBjPvL1ZMfGEHNoBSZwumu6DMQLBwtPhUaj288nAB4K2xibdhFmsm1yqhnW04VNLyBs9FqKdXRQqFttA==
"@gitlab/ui@33.0.0":
version "33.0.0"
resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-33.0.0.tgz#d41f59e9acc19af84a80fa14c4ac4eff0b8f6ba5"
integrity sha512-os2PmiOIdzlYIv0GoFtvTmBXhl8B4rnzPgibHUOiMZf8n9Oye8LNs9+zA1fk5PRur/SVwmS5+0hIFH7Dyqt9hw==
dependencies:
"@babel/standalone" "^7.0.0"
bootstrap-vue "2.20.1"