diff --git a/app/models/user.rb b/app/models/user.rb index 6b7bf7fa822..80b8c9173d1 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -2106,7 +2106,7 @@ class User < ApplicationRecord end def check_username_format - return if username.blank? || Mime::EXTENSION_LOOKUP.keys.none? { |type| username.end_with?(type) } + return if username.blank? || Mime::EXTENSION_LOOKUP.keys.none? { |type| username.end_with?(".#{type}") } errors.add(:username, _('ending with MIME type format is not allowed.')) end diff --git a/app/workers/all_queues.yml b/app/workers/all_queues.yml index 26afe36893a..04c557965b1 100644 --- a/app/workers/all_queues.yml +++ b/app/workers/all_queues.yml @@ -274,15 +274,6 @@ :weight: 1 :idempotent: :tags: [] -- :name: cronjob:gitlab_usage_ping - :worker_name: GitlabUsagePingWorker - :feature_category: :service_ping - :has_external_dependencies: - :urgency: :low - :resource_boundary: :unknown - :weight: 1 - :idempotent: - :tags: [] - :name: cronjob:import_export_project_cleanup :worker_name: ImportExportProjectCleanupWorker :feature_category: :importers diff --git a/app/workers/gitlab_usage_ping_worker.rb b/app/workers/gitlab_usage_ping_worker.rb deleted file mode 100644 index 5dbd2272e07..00000000000 --- a/app/workers/gitlab_usage_ping_worker.rb +++ /dev/null @@ -1,4 +0,0 @@ -# frozen_string_literal: true - -class GitlabUsagePingWorker < GitlabServicePingWorker # rubocop:disable Scalability/IdempotentWorker -end diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index 98e13137d73..5c4088a7f87 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -498,9 +498,6 @@ Settings.cron_jobs['jira_import_stuck_jira_import_jobs']['job_class'] = 'Gitlab: Settings.cron_jobs['stuck_export_jobs_worker'] ||= Settingslogic.new({}) Settings.cron_jobs['stuck_export_jobs_worker']['cron'] ||= '30 * * * *' Settings.cron_jobs['stuck_export_jobs_worker']['job_class'] = 'StuckExportJobsWorker' -Settings.cron_jobs['gitlab_usage_ping_worker'] ||= Settingslogic.new({}) -Settings.cron_jobs['gitlab_usage_ping_worker']['cron'] ||= nil # This is dynamically loaded in the sidekiq initializer -Settings.cron_jobs['gitlab_usage_ping_worker']['job_class'] = 'GitlabUsagePingWorker' Settings.cron_jobs['gitlab_service_ping_worker'] ||= Settingslogic.new({}) Settings.cron_jobs['gitlab_service_ping_worker']['cron'] ||= nil # This is dynamically loaded in the sidekiq initializer Settings.cron_jobs['gitlab_service_ping_worker']['job_class'] = 'GitlabServicePingWorker' diff --git a/doc/integration/saml.md b/doc/integration/saml.md index 75a4529982e..8e34f115072 100644 --- a/doc/integration/saml.md +++ b/doc/integration/saml.md @@ -201,6 +201,9 @@ For example configurations, see the [notes on specific providers](#providers). If a username is not specified, the email address is used to generate the GitLab username. +See [`attribute_statements`](#attribute_statements) for examples on how the +assertions are configured. + Please refer to [the OmniAuth SAML gem](https://github.com/omniauth/omniauth-saml/blob/master/lib/omniauth/strategies/saml.rb) for a full list of supported assertions. diff --git a/qa/qa/fixtures/export.tar.gz b/qa/qa/fixtures/export.tar.gz index 107037a9562..08e4f0c9c43 100644 Binary files a/qa/qa/fixtures/export.tar.gz and b/qa/qa/fixtures/export.tar.gz differ diff --git a/qa/qa/resource/merge_request.rb b/qa/qa/resource/merge_request.rb index d9703eb889e..8d9de0ea718 100644 --- a/qa/qa/resource/merge_request.rb +++ b/qa/qa/resource/merge_request.rb @@ -152,7 +152,7 @@ module QA @project = Resource::ImportProject.fabricate_via_browser_ui! # Setting the name here, since otherwise some tests will look for an existing file in # the proejct without ever knowing what is in it. - @file_name = "LICENSE" + @file_name = "github_controller_spec.rb" visit("#{project.web_url}/-/merge_requests/1") current_url end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 6cc7e78fbd0..0eb769c65cd 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -394,6 +394,7 @@ RSpec.describe User do expect(user).not_to be_valid expect(user.errors.full_messages).to include('Username ending with MIME type format is not allowed.') + expect(build(:user, username: "test#{type}")).to be_valid end end diff --git a/spec/workers/every_sidekiq_worker_spec.rb b/spec/workers/every_sidekiq_worker_spec.rb index e67cf62b0c8..5ab5c60065a 100644 --- a/spec/workers/every_sidekiq_worker_spec.rb +++ b/spec/workers/every_sidekiq_worker_spec.rb @@ -288,7 +288,6 @@ RSpec.describe 'Every Sidekiq worker' do 'GitlabPerformanceBarStatsWorker' => 3, 'GitlabShellWorker' => 3, 'GitlabServicePingWorker' => 3, - 'GitlabUsagePingWorker' => 3, 'GroupDestroyWorker' => 3, 'GroupExportWorker' => false, 'GroupImportWorker' => false, diff --git a/spec/workers/gitlab_usage_ping_worker_spec.rb b/spec/workers/gitlab_usage_ping_worker_spec.rb deleted file mode 100644 index ff60c368e04..00000000000 --- a/spec/workers/gitlab_usage_ping_worker_spec.rb +++ /dev/null @@ -1,50 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe GitlabUsagePingWorker, :clean_gitlab_redis_shared_state do - before do - allow_next_instance_of(ServicePing::SubmitService) { |service| allow(service).to receive(:execute) } - allow(subject).to receive(:sleep) - end - - it 'does not run for GitLab.com' do - allow(Gitlab).to receive(:com?).and_return(true) - expect(ServicePing::SubmitService).not_to receive(:new) - - subject.perform - end - - it 'delegates to ServicePing::SubmitService' do - expect_next_instance_of(ServicePing::SubmitService) { |service| expect(service).to receive(:execute) } - - subject.perform - end - - it "obtains a #{described_class::LEASE_TIMEOUT} second exclusive lease" do - expect(Gitlab::ExclusiveLeaseHelpers::SleepingLock) - .to receive(:new) - .with(described_class::LEASE_KEY, hash_including(timeout: described_class::LEASE_TIMEOUT)) - .and_call_original - - subject.perform - end - - it 'sleeps for between 0 and 60 seconds' do - expect(subject).to receive(:sleep).with(0..60) - - subject.perform - end - - context 'when lease is not obtained' do - before do - Gitlab::ExclusiveLease.new(described_class::LEASE_KEY, timeout: described_class::LEASE_TIMEOUT).try_obtain - end - - it 'does not invoke ServicePing::SubmitService' do - allow_next_instance_of(ServicePing::SubmitService) { |service| expect(service).not_to receive(:execute) } - - expect { subject.perform }.to raise_error(Gitlab::ExclusiveLeaseHelpers::FailedToObtainLockError) - end - end -end