Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-11-11 21:09:48 +00:00
parent 11c2b8eff6
commit c77ce73fa8
16 changed files with 133 additions and 160 deletions

View file

@ -2632,5 +2632,4 @@ Style/OpenStructUse:
- 'spec/support/shared_examples/requests/api/pypi_packages_shared_examples.rb'
- 'spec/support_specs/helpers/stub_feature_flags_spec.rb'
- 'spec/tooling/rspec_flaky/flaky_example_spec.rb'
- 'spec/workers/packages/maven/metadata/sync_worker_spec.rb'
- 'tooling/rspec_flaky/flaky_example.rb'

View file

@ -1,12 +1,10 @@
- any_pipelines = @commit.present(current_user: current_user).any_pipelines?
%ul.nav-links.no-top.no-bottom.commit-ci-menu.nav.nav-tabs
= nav_link(path: 'commit#show') do
= link_to project_commit_path(@project, @commit.id) do
= _('Changes')
%span.badge.badge-pill= @diffs.size
= gl_tabs_nav({ class: 'commit-ci-menu gl-display-flex gl-flex-grow-1'}) do
= gl_tab_link_to project_commit_path(@project, @commit.id) do
= _('Changes')
= gl_tab_counter_badge(@diffs.size)
- if any_pipelines
= nav_link(path: 'commit#pipelines') do
= link_to pipelines_project_commit_path(@project, @commit.id) do
= _('Pipelines')
%span.badge.badge-pill.js-pipelines-mr-count= @commit.pipelines.size
= gl_tab_link_to pipelines_project_commit_path(@project, @commit.id) do
= _('Pipelines')
= gl_tab_counter_badge(@commit.pipelines.size, { class: 'js-pipelines-mr-count' })

View file

@ -1,18 +1,12 @@
%ul.nav-links.mobile-separator.nav.nav-tabs
%li{ class: active_when(scope.nil?) }>
= link_to schedule_path_proc.call(nil) do
= s_("PipelineSchedules|All")
%span.badge.gl-tab-counter-badge.badge-muted.badge-pill.gl-badge.sm.js-totalbuilds-count
= number_with_delimiter(all_schedules.count(:id))
= gl_tabs_nav({ class: 'gl-display-flex gl-flex-grow-1 gl-border-0' }) do
= gl_tab_link_to schedule_path_proc.call(nil), { item_active: active_when(scope.nil?) } do
= s_("PipelineSchedules|All")
= gl_tab_counter_badge(number_with_delimiter(all_schedules.count(:id)), { class: 'js-totalbuilds-count' })
%li{ class: active_when(scope == 'active') }>
= link_to schedule_path_proc.call('active') do
= s_("PipelineSchedules|Active")
%span.badge.gl-tab-counter-badge.badge-muted.badge-pill.gl-badge.sm
= number_with_delimiter(all_schedules.active.count(:id))
= gl_tab_link_to schedule_path_proc.call('active'), { item_active: active_when(scope == 'active') } do
= s_("PipelineSchedules|Active")
= gl_tab_counter_badge(number_with_delimiter(all_schedules.active.count(:id)))
%li{ class: active_when(scope == 'inactive') }>
= link_to schedule_path_proc.call('inactive') do
= s_("PipelineSchedules|Inactive")
%span.badge.gl-tab-counter-badge.badge-muted.badge-pill.gl-badge.sm
= number_with_delimiter(all_schedules.inactive.count(:id))
= gl_tab_link_to schedule_path_proc.call('inactive'), { item_active: active_when(scope == 'inactive') } do
= s_("PipelineSchedules|Inactive")
= gl_tab_counter_badge(number_with_delimiter(all_schedules.inactive.count(:id)))

View file

@ -13,7 +13,8 @@ module LooseForeignKeys
def perform
return if Feature.disabled?(:loose_foreign_key_cleanup, default_enabled: :yaml)
in_lock(self.class.name.underscore, ttl: 1.hour, retries: 0) do
ttl = ModificationTracker::MAX_RUNTIME + 1.minute
in_lock(self.class.name.underscore, ttl: ttl, retries: 0) do
# TODO: Iterate over the connections
# https://gitlab.com/gitlab-org/gitlab/-/issues/341513
stats = ProcessDeletedRecordsService.new(connection: ApplicationRecord.connection).execute

View file

@ -36,12 +36,6 @@
:why: https://github.com/ruby/ruby/blob/ruby_2_1/COPYING
:versions: []
:when: 2016-05-02 05:31:54.498490000 Z
- - :permit
- LGPL
- :who: Connor Shea
:why: http://www.gnu.org/licenses/license-list.html#LGPLv2.1
:versions: []
:when: 2016-05-02 05:32:48.645841000 Z
- - :permit
- ISC
- :who: Connor Shea
@ -54,24 +48,12 @@
:why: https://opensource.org/licenses/BSD-3-Clause
:versions: []
:when: 2016-05-02 05:44:38.246021000 Z
- - :permit
- LGPL-2.1+
- :who: Connor Shea
:why: Equivalent to LGPL.
:versions: []
:when: 2016-05-02 05:52:56.303239000 Z
- - :permit
- BSD
- :who: Connor Shea
:why: https://opensource.org/licenses/BSD-2-Clause
:versions: []
:when: 2016-05-02 05:55:09.796363000 Z
- - :permit
- LGPLv2+
- :who: Stan Hu
:why: Equivalent to LGPLv2
:versions: []
:when: 2016-06-07 17:14:10.907682000 Z
- - :permit
- Artistic 2.0
- :who: Josh Frye
@ -211,13 +193,18 @@
:why: https://github.com/pieroxy/lz-string/blob/master/LICENSE.txt
:versions: []
:when: 2018-08-03 08:22:44.973457000 Z
- - :add_package
- smooshpack
- 0.0.62
- &1
:who: Phil Hughes
:why: https://github.com/codesandbox/codesandbox-client/blob/006adee03295b5d42bb311a526774747758fd1a0/standalone-packages/sandpack/LICENSE.md
:versions: []
:when: 2018-08-03 08:24:29.578991000 Z
- - :license
- smooshpack
- LGPL
- :who: Phil Hughes
:why: https://github.com/CompuIves/codesandbox-client/blob/master/packages/sandpack/LICENSE.md
:versions: []
:when: 2018-08-03 08:24:29.578991000 Z
- *1
- - :license
- codesandbox-import-util-types
- LGPL
@ -317,3 +304,61 @@
:why: https://github.com/xijo/reverse_markdown/blob/master/LICENSE
:versions: []
:when: 2021-02-03 08:47:28.792907000 Z
- - :approve
- sidekiq
- :who: Sean McGivern
:why: https://gitlab.com/gitlab-com/legal-and-compliance/-/issues/672
:versions: []
:when: 2021-11-08 13:53:54.127540759 Z
- - :approve
- gitlab-sidekiq-fetcher
- :who: Sean McGivern
:why: https://gitlab.com/gitlab-com/legal-and-compliance/-/issues/672
:versions: []
:when: 2021-11-08 13:54:27.222104249 Z
- - :approve
- device_detector
- :who: Sean McGivern
:why: https://gitlab.com/gitlab-com/legal-and-compliance/-/issues/672
:versions: []
:when: 2021-11-08 13:54:52.533334287 Z
- - :approve
- gpgme
- :who: Sean McGivern
:why: https://gitlab.com/gitlab-com/legal-and-compliance/-/issues/672
:versions: []
:when: 2021-11-08 13:54:43.878212822 Z
- - :approve
- rchardet
- :who: Sean McGivern
:why: https://gitlab.com/gitlab-com/legal-and-compliance/-/issues/672
:versions: []
:when: 2021-11-08 13:54:35.324449740 Z
- - :approve
- timfel-krb5-auth
- :who: Sean McGivern
:why: https://gitlab.com/gitlab-com/legal-and-compliance/-/issues/672
:versions: []
:when: 2021-11-08 13:55:10.859429290 Z
- - :approve
- codesandbox-import-util-types
- :who: Sean McGivern
:why: https://gitlab.com/gitlab-com/legal-and-compliance/-/issues/672
:versions: []
:when: 2021-11-08 14:03:20.304435279 Z
- - :approve
- codesandbox-import-utils
- :who: Sean McGivern
:why: https://gitlab.com/gitlab-com/legal-and-compliance/-/issues/672
:versions: []
:when: 2021-11-08 14:03:25.577163700 Z
- - :approve
- smooshpack
- &2
:who: Sean McGivern
:why: https://gitlab.com/gitlab-com/legal-and-compliance/-/issues/672
:versions: []
:when: 2021-11-10 10:09:31.584355110 Z
- - :approve
- 0.0.62
- *2

View file

@ -1,8 +0,0 @@
---
name: report_on_long_redis_durations
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/67512
rollout_issue_url: https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/1183
milestone: '14.2'
type: development
group: team::Scalability
default_enabled: false

View file

@ -23,8 +23,9 @@ Sidekiq::Testing.inline! do
full_path = url.sub('https://android.googlesource.com/', '')
full_path = full_path.sub(/\.git\z/, '')
full_path, _, project_path = full_path.rpartition('/')
group = Group.find_by_full_path(full_path) ||
Groups::NestedCreateService.new(user, group_path: full_path).execute
group = Sidekiq::Worker.skipping_transaction_check do
Group.find_by_full_path(full_path) || Groups::NestedCreateService.new(user, group_path: full_path).execute
end
params = {
import_url: url,

View file

@ -5,10 +5,6 @@ module Gitlab
module RedisInterceptor
APDEX_EXCLUDE = %w[brpop blpop brpoplpush bzpopmin bzpopmax xread xreadgroup].freeze
# These are temporary to help with investigating
# https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/1183
DURATION_ERROR_THRESHOLD = 1.25.seconds
class MysteryRedisDurationError < StandardError
attr_reader :backtrace
@ -19,7 +15,6 @@ module Gitlab
def call(*args, &block)
start = Gitlab::Metrics::System.monotonic_time # must come first so that 'start' is always defined
start_real_time = Time.now
instrumentation_class.instance_count_request
instrumentation_class.redis_cluster_validate!(args.first)
@ -40,16 +35,6 @@ module Gitlab
instrumentation_class.add_duration(duration)
instrumentation_class.add_call_details(duration, args)
end
if duration > DURATION_ERROR_THRESHOLD &&
instrumentation_class == ::Gitlab::Instrumentation::Redis::SharedState &&
Feature.enabled?(:report_on_long_redis_durations, default_enabled: :yaml)
Gitlab::ErrorTracking.track_exception(MysteryRedisDurationError.new(caller),
command: command_from_args(args),
duration: duration,
timestamp: start_real_time.iso8601(5))
end
end
def write(command)

View file

@ -62,6 +62,12 @@ module QA
has_element? :job_log_content
end
def has_status?(status, wait: 30)
wait_until(reload: false, max_duration: wait, sleep_interval: 1) do
status_badge == status
end
end
private
def loaded?(wait: 60)

View file

@ -23,6 +23,7 @@ module QA
groups_page.click_new_group
Page::Group::New.perform do |group|
group.click_create_group
group.set_path(path)
group.set_visibility('Public')
group.create

View file

@ -1,10 +1,10 @@
# frozen_string_literal: true
module QA
RSpec.describe 'Manage', :requires_admin do
# run only base UI validation on staging because test requires top level group creation which is problematic
# on staging environment
RSpec.describe 'Manage', :requires_admin, except: { subdomain: :staging } do
describe 'Bulk group import' do
let!(:staging?) { Runtime::Scenario.gitlab_address.include?('staging.gitlab.com') }
let(:import_wait_duration) { { max_duration: 300, sleep_interval: 2 } }
let(:admin_api_client) { Runtime::API::Client.as_admin }
let(:user) do
@ -38,15 +38,11 @@ module QA
end
before do
Runtime::Feature.enable(:top_level_group_creation_enabled) if staging?
sandbox.add_member(user, Resource::Members::AccessLevel::MAINTAINER)
end
after do
user.remove_via_api!
ensure
Runtime::Feature.disable(:top_level_group_creation_enabled) if staging?
end
context 'with subgroups and labels' do

View file

@ -1,10 +1,10 @@
# frozen_string_literal: true
module QA
RSpec.describe 'Manage', :requires_admin do
# run only base UI validation on staging because test requires top level group creation which is problematic
# on staging environment
RSpec.describe 'Manage', :requires_admin, except: { subdomain: :staging } do
describe 'Bulk project import' do
let!(:staging?) { Runtime::Scenario.gitlab_address.include?('staging.gitlab.com') }
let(:import_wait_duration) { { max_duration: 300, sleep_interval: 2 } }
let(:admin_api_client) { Runtime::API::Client.as_admin }
let(:user) do
@ -57,7 +57,6 @@ module QA
before do
Runtime::Feature.enable(:bulk_import_projects)
Runtime::Feature.enable(:top_level_group_creation_enabled) if staging?
sandbox.add_member(user, Resource::Members::AccessLevel::MAINTAINER)
@ -68,7 +67,6 @@ module QA
user.remove_via_api!
ensure
Runtime::Feature.disable(:bulk_import_projects)
Runtime::Feature.disable(:top_level_group_creation_enabled) if staging?
end
context 'with project' do

View file

@ -4,17 +4,16 @@ module QA
RSpec.describe 'Manage', :requires_admin do
describe 'Bulk group import' do
let!(:staging?) { Runtime::Scenario.gitlab_address.include?('staging.gitlab.com') }
let(:admin_api_client) { Runtime::API::Client.as_admin }
let(:user) do
let!(:admin_api_client) { Runtime::API::Client.as_admin }
let!(:user) do
Resource::User.fabricate_via_api! do |usr|
usr.api_client = admin_api_client
usr.hard_delete_on_api_removal = true
end
end
let(:api_client) { Runtime::API::Client.new(user: user) }
let(:personal_access_token) { api_client.personal_access_token }
let!(:api_client) { Runtime::API::Client.new(user: user) }
let!(:personal_access_token) { api_client.personal_access_token }
let(:sandbox) do
Resource::Sandbox.fabricate_via_api! do |group|
@ -23,7 +22,9 @@ module QA
end
let(:source_group) do
Resource::Sandbox.fabricate_via_api! do |group|
# top level group can't be created on staging via api, create via UI
fabricate_method = staging? ? :fabricate_via_browser_ui! : :fabricate_via_api!
Resource::Sandbox.send(fabricate_method) do |group|
group.api_client = api_client
group.path = "source-group-for-import-#{SecureRandom.hex(4)}"
end
@ -38,14 +39,12 @@ module QA
end
before do
Runtime::Feature.enable(:top_level_group_creation_enabled) if staging?
sandbox.add_member(user, Resource::Members::AccessLevel::MAINTAINER)
# create groups explicitly before connecting gitlab instance
Flow::Login.sign_in(as: user)
source_group
Flow::Login.sign_in(as: user)
Page::Main::Menu.perform(&:go_to_create_group)
Page::Group::New.perform do |group|
group.switch_to_import_tab
@ -53,6 +52,10 @@ module QA
end
end
after do
user.remove_via_api!
end
it(
'imports group from UI',
testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1806',
@ -72,12 +75,6 @@ module QA
end
end
end
after do
user.remove_via_api!
ensure
Runtime::Feature.disable(:top_level_group_creation_enabled) if staging?
end
end
end
end

View file

@ -1,10 +1,9 @@
# frozen_string_literal: true
module QA
RSpec.describe 'Verify', :runner do
RSpec.describe 'Verify', :smoke, :runner do
describe 'Pipeline creation and processing' do
let(:executor) { "qa-runner-#{Time.now.to_i}" }
let(:max_wait) { 30 }
let(:project) do
Resource::Project.fabricate_via_api! do |project|
@ -21,11 +20,10 @@ module QA
end
after do
runner.remove_via_api!
[runner, project].each(&:remove_via_api!)
end
it 'users creates a pipeline which gets processed', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1601' do
# TODO: Convert back to :smoke once proved to be stable. Related issue: https://gitlab.com/gitlab-org/gitlab/-/issues/300909
Flow::Login.sign_in
Resource::Repository::Commit.fabricate_via_api! do |commit|
@ -68,19 +66,21 @@ module QA
Flow::Pipeline.visit_latest_pipeline
{
'test-success': :passed,
'test-failure': :failed,
'test-tags-mismatch': :pending,
'test-artifacts': :passed
}.each do |job, status|
Page::Project::Pipeline::Show.perform do |pipeline|
pipeline.click_job(job)
end
aggregate_failures do
{
'test-success': 'passed',
'test-failure': 'failed',
'test-tags-mismatch': 'pending',
'test-artifacts': 'passed'
}.each do |job, status|
Page::Project::Pipeline::Show.perform do |pipeline|
pipeline.click_job(job)
end
Page::Project::Job::Show.perform do |show|
expect(show).to public_send("be_#{status}")
show.click_element(:pipeline_path, Page::Project::Pipeline::Show)
Page::Project::Job::Show.perform do |show|
expect(show).to have_status(status), "Expected job status to be #{status} but got #{show.status_badge} instead."
show.click_element(:pipeline_path, Page::Project::Pipeline::Show)
end
end
end
end

View file

@ -111,45 +111,4 @@ RSpec.describe Gitlab::Instrumentation::RedisInterceptor, :clean_gitlab_redis_sh
end
end
end
context 'when a command takes longer than DURATION_ERROR_THRESHOLD' do
let(:threshold) { 0.5 }
before do
stub_const("#{described_class}::DURATION_ERROR_THRESHOLD", threshold)
end
context 'when report_on_long_redis_durations is disabled' do
it 'does nothing' do
stub_feature_flags(report_on_long_redis_durations: false)
expect(Gitlab::ErrorTracking).not_to receive(:track_exception)
Gitlab::Redis::SharedState.with { |r| r.mget('foo', 'foo') { sleep threshold + 0.1 } }
end
end
context 'when report_on_long_redis_durations is enabled' do
context 'for an instance other than SharedState' do
it 'does nothing' do
expect(Gitlab::ErrorTracking).not_to receive(:track_exception)
Gitlab::Redis::Queues.with { |r| r.mget('foo', 'foo') { sleep threshold + 0.1 } }
end
end
context 'for the SharedState instance' do
it 'tracks an exception and continues' do
expect(Gitlab::ErrorTracking)
.to receive(:track_exception)
.with(an_instance_of(described_class::MysteryRedisDurationError),
command: 'mget',
duration: be > threshold,
timestamp: a_string_matching(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{5}/))
Gitlab::Redis::SharedState.with { |r| r.mget('foo', 'foo') { sleep threshold + 0.1 } }
end
end
end
end
end

View file

@ -8,6 +8,7 @@ RSpec.describe Packages::Maven::Metadata::SyncWorker, type: :worker do
let(:versions) { %w[1.2 1.1 2.1 3.0-SNAPSHOT] }
let(:worker) { described_class.new }
let(:data_struct) { Struct.new(:release, :latest, :versions, keyword_init: true) }
describe '#perform' do
let(:user) { create(:user) }
@ -197,7 +198,7 @@ RSpec.describe Packages::Maven::Metadata::SyncWorker, type: :worker do
def versions_from(xml_content)
xml_doc = Nokogiri::XML(xml_content)
OpenStruct.new(
data_struct.new(
release: xml_doc.xpath('//metadata/versioning/release').first.content,
latest: xml_doc.xpath('//metadata/versioning/latest').first.content,
versions: xml_doc.xpath('//metadata/versioning/versions/version').map(&:content)