Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
eef9e3fbb5
commit
a4d8bae627
|
@ -1 +1 @@
|
|||
7ce0d18ad44686865aa0dbf5f1b47d9cc05988be
|
||||
b119c19734ba589a079381e8390952e37994149f
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
.select-wrapper
|
||||
= f.select :auth_method,
|
||||
options_for_select(auth_options, mirror.auth_method),
|
||||
{}, { class: "form-control gl-form-input select-control js-mirror-auth-type qa-authentication-method" }
|
||||
{}, { class: "form-control gl-form-select select-control js-mirror-auth-type qa-authentication-method" }
|
||||
= sprite_icon('chevron-down', css_class: "gl-icon gl-absolute gl-top-3 gl-right-3 gl-text-gray-200")
|
||||
= f.hidden_field :auth_method, value: "password", class: "js-hidden-mirror-auth-type"
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.form-group
|
||||
= label_tag :mirror_direction, _('Mirror direction'), class: 'label-light'
|
||||
.select-wrapper
|
||||
= select_tag :mirror_direction, options_for_select([[_('Push'), 'push']]), class: 'form-control gl-form-input select-control js-mirror-direction qa-mirror-direction', disabled: true
|
||||
= select_tag :mirror_direction, options_for_select([[_('Push'), 'push']]), class: 'form-control gl-form-select select-control js-mirror-direction qa-mirror-direction', disabled: true
|
||||
= sprite_icon('chevron-down', css_class: "gl-icon gl-absolute gl-top-3 gl-right-3 gl-text-gray-200")
|
||||
|
||||
= render partial: "projects/mirrors/mirror_repos_push", locals: { f: f }
|
||||
|
|
|
@ -5,4 +5,4 @@ rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/347405
|
|||
milestone: '14.6'
|
||||
type: development
|
||||
group: group::testing
|
||||
default_enabled: false
|
||||
default_enabled: true
|
||||
|
|
|
@ -287,12 +287,11 @@ If the artifacts were deleted successfully, a response with status `204 No Conte
|
|||
|
||||
## Delete project artifacts
|
||||
|
||||
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/223793) in GitLab 14.7 [with a flag](../administration/feature_flags.md) named `bulk_expire_project_artifacts`. Disabled by default on GitLab self-managed. Enabled on GitLab.com.
|
||||
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/223793) in GitLab 14.7 [with a flag](../administration/feature_flags.md) named `bulk_expire_project_artifacts`. Enabled by default on GitLab self-managed. Enabled on GitLab.com.
|
||||
|
||||
FLAG:
|
||||
On self-managed GitLab, by default this feature is not available. To make it
|
||||
available, ask an administrator to [enable the `bulk_expire_project_artifacts` flag](../administration/feature_flags.md).
|
||||
On GitLab.com, this feature is available.
|
||||
On self-managed GitLab, by default this feature is available. To hide the feature, ask an administrator to
|
||||
[disable the `bulk_expire_project_artifacts` flag](../administration/feature_flags.md). On GitLab.com, this feature is available.
|
||||
|
||||
[Expire artifacts of a project that can be deleted](https://gitlab.com/gitlab-org/gitlab/-/issues/223793) but that don't have an expiry time.
|
||||
|
||||
|
|
|
@ -11,10 +11,11 @@ module Gitlab
|
|||
|
||||
attr_accessor :readiness_checks
|
||||
|
||||
def initialize(settings, log_enabled:, log_file:, **options)
|
||||
def initialize(settings, log_enabled:, log_file:, gc_requests: false, **options)
|
||||
super(**options)
|
||||
|
||||
@settings = settings
|
||||
@gc_requests = gc_requests
|
||||
|
||||
# log_enabled does not exist for all exporters
|
||||
log_sink = log_enabled ? File.join(Rails.root, 'log', log_file) : File::NULL
|
||||
|
@ -71,11 +72,13 @@ module Gitlab
|
|||
readiness = readiness_probe
|
||||
liveness = liveness_probe
|
||||
pid = thread_name
|
||||
gc_requests = @gc_requests
|
||||
|
||||
Rack::Builder.app do
|
||||
use Rack::Deflater
|
||||
use Gitlab::Metrics::Exporter::MetricsMiddleware, pid
|
||||
use Gitlab::Metrics::Exporter::HealthChecksMiddleware, readiness, liveness
|
||||
use Gitlab::Metrics::Exporter::GcRequestMiddleware if gc_requests
|
||||
use ::Prometheus::Client::Rack::Exporter if ::Gitlab::Metrics.metrics_folder_present?
|
||||
run -> (env) { [404, {}, ['']] }
|
||||
end
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Gitlab
|
||||
module Metrics
|
||||
module Exporter
|
||||
class GcRequestMiddleware
|
||||
def initialize(app)
|
||||
@app = app
|
||||
end
|
||||
|
||||
def call(env)
|
||||
@app.call(env).tap do
|
||||
GC.start
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -26,6 +26,7 @@ require_relative '../lib/gitlab/metrics/exporter/base_exporter'
|
|||
require_relative '../lib/gitlab/metrics/exporter/sidekiq_exporter'
|
||||
require_relative '../lib/gitlab/metrics/exporter/metrics_middleware'
|
||||
require_relative '../lib/gitlab/metrics/exporter/health_checks_middleware'
|
||||
require_relative '../lib/gitlab/metrics/exporter/gc_request_middleware'
|
||||
require_relative '../lib/gitlab/health_checks/probes/collection'
|
||||
require_relative '../lib/gitlab/health_checks/probes/status'
|
||||
require_relative '../lib/gitlab/process_management'
|
||||
|
|
|
@ -54,7 +54,7 @@ class MetricsServer # rubocop:disable Gitlab/NamespacedClass
|
|||
|
||||
exporter_class = "Gitlab::Metrics::Exporter::#{@target.camelize}Exporter".constantize
|
||||
settings = Settings.new(Settings.monitoring[name])
|
||||
server = exporter_class.instance(settings, synchronous: true)
|
||||
server = exporter_class.instance(settings, gc_requests: true, synchronous: true)
|
||||
|
||||
server.start
|
||||
end
|
||||
|
|
|
@ -37,7 +37,7 @@ module QA
|
|||
push.file_name = 'test.txt'
|
||||
push.file_content = "# This is a test project named #{@project.name}"
|
||||
push.commit_message = 'Add test.txt'
|
||||
push.branch_name = 'new_branch'
|
||||
push.branch_name = "new_branch_#{SecureRandom.hex(8)}"
|
||||
push.user = @user
|
||||
end
|
||||
end.to raise_error(QA::Support::Run::CommandError, /You are not allowed to push code to this project/)
|
||||
|
@ -48,7 +48,7 @@ module QA
|
|||
Resource::File.fabricate_via_api! do |file|
|
||||
file.api_client = @user_api_client
|
||||
file.project = @project
|
||||
file.branch = 'new_branch'
|
||||
file.branch = "new_branch_#{SecureRandom.hex(8)}"
|
||||
file.commit_message = 'Add new file'
|
||||
file.name = 'test.txt'
|
||||
file.content = "New file"
|
||||
|
@ -61,7 +61,7 @@ module QA
|
|||
Resource::Repository::Commit.fabricate_via_api! do |commit|
|
||||
commit.api_client = @user_api_client
|
||||
commit.project = @project
|
||||
commit.branch = 'new_branch'
|
||||
commit.branch = "new_branch_#{SecureRandom.hex(8)}"
|
||||
commit.start_branch = @project.default_branch
|
||||
commit.commit_message = 'Add new file'
|
||||
commit.add_files([
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'fast_spec_helper'
|
||||
|
||||
RSpec.describe Gitlab::Metrics::Exporter::GcRequestMiddleware do
|
||||
let(:app) { double(:app) }
|
||||
let(:env) { {} }
|
||||
|
||||
subject(:middleware) { described_class.new(app) }
|
||||
|
||||
describe '#call' do
|
||||
it 'runs a major GC after the next middleware is called' do
|
||||
expect(app).to receive(:call).with(env).ordered.and_return([200, {}, []])
|
||||
expect(GC).to receive(:start).ordered
|
||||
|
||||
response = middleware.call(env)
|
||||
|
||||
expect(response).to eq([200, {}, []])
|
||||
end
|
||||
end
|
||||
end
|
|
@ -70,7 +70,9 @@ RSpec.describe MetricsServer do # rubocop:disable RSpec/FilePath
|
|||
|
||||
before do
|
||||
stub_const('Gitlab::Metrics::Exporter::FakeExporter', exporter_class)
|
||||
expect(exporter_class).to receive(:instance).with(settings['fake_exporter'], synchronous: true).and_return(exporter_double)
|
||||
expect(exporter_class).to receive(:instance).with(
|
||||
settings['fake_exporter'], gc_requests: true, synchronous: true
|
||||
).and_return(exporter_double)
|
||||
expect(Settings).to receive(:monitoring).and_return(settings)
|
||||
|
||||
allow(Gitlab::Metrics::Samplers::RubySampler).to receive(:initialize_instance).and_return(ruby_sampler_double)
|
||||
|
|
|
@ -4581,11 +4581,25 @@ RSpec.describe Project, factory_default: :keep do
|
|||
include ProjectHelpers
|
||||
|
||||
let_it_be(:group) { create(:group) }
|
||||
let_it_be_with_reload(:project) { create(:project, namespace: group) }
|
||||
|
||||
let!(:project) { create(:project, project_level, namespace: group ) }
|
||||
let(:user) { create_user_from_membership(project, membership) }
|
||||
|
||||
context 'reporter level access' do
|
||||
subject { described_class.filter_by_feature_visibility(feature, user) }
|
||||
|
||||
shared_examples 'filter respects visibility' do
|
||||
it 'respects visibility' do
|
||||
enable_admin_mode!(user) if admin_mode
|
||||
project.update!(visibility_level: Gitlab::VisibilityLevel.level_value(project_level.to_s))
|
||||
update_feature_access_level(project, feature_access_level)
|
||||
|
||||
expected_objects = expected_count == 1 ? [project] : []
|
||||
|
||||
expect(subject).to eq(expected_objects)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with reporter level access' do
|
||||
let(:feature) { MergeRequest }
|
||||
|
||||
where(:project_level, :feature_access_level, :membership, :admin_mode, :expected_count) do
|
||||
|
@ -4593,20 +4607,11 @@ RSpec.describe Project, factory_default: :keep do
|
|||
end
|
||||
|
||||
with_them do
|
||||
it "respects visibility" do
|
||||
enable_admin_mode!(user) if admin_mode
|
||||
update_feature_access_level(project, feature_access_level)
|
||||
|
||||
expected_objects = expected_count == 1 ? [project] : []
|
||||
|
||||
expect(
|
||||
described_class.filter_by_feature_visibility(feature, user)
|
||||
).to eq(expected_objects)
|
||||
end
|
||||
it_behaves_like 'filter respects visibility'
|
||||
end
|
||||
end
|
||||
|
||||
context 'issues' do
|
||||
context 'with feature issues' do
|
||||
let(:feature) { Issue }
|
||||
|
||||
where(:project_level, :feature_access_level, :membership, :admin_mode, :expected_count) do
|
||||
|
@ -4614,20 +4619,11 @@ RSpec.describe Project, factory_default: :keep do
|
|||
end
|
||||
|
||||
with_them do
|
||||
it "respects visibility" do
|
||||
enable_admin_mode!(user) if admin_mode
|
||||
update_feature_access_level(project, feature_access_level)
|
||||
|
||||
expected_objects = expected_count == 1 ? [project] : []
|
||||
|
||||
expect(
|
||||
described_class.filter_by_feature_visibility(feature, user)
|
||||
).to eq(expected_objects)
|
||||
end
|
||||
it_behaves_like 'filter respects visibility'
|
||||
end
|
||||
end
|
||||
|
||||
context 'wiki' do
|
||||
context 'with feature wiki' do
|
||||
let(:feature) { :wiki }
|
||||
|
||||
where(:project_level, :feature_access_level, :membership, :admin_mode, :expected_count) do
|
||||
|
@ -4635,20 +4631,11 @@ RSpec.describe Project, factory_default: :keep do
|
|||
end
|
||||
|
||||
with_them do
|
||||
it "respects visibility" do
|
||||
enable_admin_mode!(user) if admin_mode
|
||||
update_feature_access_level(project, feature_access_level)
|
||||
|
||||
expected_objects = expected_count == 1 ? [project] : []
|
||||
|
||||
expect(
|
||||
described_class.filter_by_feature_visibility(feature, user)
|
||||
).to eq(expected_objects)
|
||||
end
|
||||
it_behaves_like 'filter respects visibility'
|
||||
end
|
||||
end
|
||||
|
||||
context 'code' do
|
||||
context 'with feature code' do
|
||||
let(:feature) { :repository }
|
||||
|
||||
where(:project_level, :feature_access_level, :membership, :admin_mode, :expected_count) do
|
||||
|
@ -4656,16 +4643,7 @@ RSpec.describe Project, factory_default: :keep do
|
|||
end
|
||||
|
||||
with_them do
|
||||
it "respects visibility" do
|
||||
enable_admin_mode!(user) if admin_mode
|
||||
update_feature_access_level(project, feature_access_level)
|
||||
|
||||
expected_objects = expected_count == 1 ? [project] : []
|
||||
|
||||
expect(
|
||||
described_class.filter_by_feature_visibility(feature, user)
|
||||
).to eq(expected_objects)
|
||||
end
|
||||
it_behaves_like 'filter respects visibility'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue