Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-12-05 03:07:09 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-12-05 03:07:09 +0300
commitf50a7f8d970c50026e52c0b5d1c444b365d3b795 (patch)
tree86071eb3685930272e2a8c48a24ac3380af0a10f
parent6d10e8955122e96a92bb980c04f1d7b116ed527a (diff)
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--.rubocop_todo/rails/time_zone.yml1
-rw-r--r--Gemfile2
-rw-r--r--Gemfile.checksum2
-rw-r--r--Gemfile.lock6
-rw-r--r--db/docs/dependency_list_exports.yml8
-rw-r--r--db/migrate/20221111135238_create_dependency_list_exports_table.rb23
-rw-r--r--db/migrate/20221116100056_add_foreign_key_to_dependency_list_exports.rb27
-rw-r--r--db/schema_migrations/202211111352381
-rw-r--r--db/schema_migrations/202211161000561
-rw-r--r--db/structure.sql36
-rw-r--r--lib/backup/manager.rb8
-rw-r--r--lib/gitlab/database/gitlab_schemas.yml1
-rw-r--r--rubocop/cop/graphql/descriptions.rb3
-rw-r--r--spec/lib/backup/manager_spec.rb4
-rw-r--r--spec/rubocop/cop/graphql/descriptions_spec.rb58
15 files changed, 164 insertions, 17 deletions
diff --git a/.rubocop_todo/rails/time_zone.yml b/.rubocop_todo/rails/time_zone.yml
index d8694925792..af57e55f6e9 100644
--- a/.rubocop_todo/rails/time_zone.yml
+++ b/.rubocop_todo/rails/time_zone.yml
@@ -32,7 +32,6 @@ Rails/TimeZone:
- 'ee/spec/lib/gitlab/prometheus/queries/cluster_query_spec.rb'
- 'lib/api/helpers.rb'
- 'lib/api/sidekiq_metrics.rb'
- - 'lib/backup/manager.rb'
- 'lib/bitbucket_server/representation/base.rb'
- 'lib/gitlab/auth/current_user_mode.rb'
- 'lib/gitlab/auth/ldap/access.rb'
diff --git a/Gemfile b/Gemfile
index 0bd8742940e..24d7a9f0dd0 100644
--- a/Gemfile
+++ b/Gemfile
@@ -107,7 +107,7 @@ gem 'browser', '~> 5.3.1'
gem 'ohai', '~> 16.10'
# GPG
-gem 'gpgme', '~> 2.0.19'
+gem 'gpgme', '~> 2.0.22'
# LDAP Auth
# GitLab fork with several improvements to original library. For full list of changes
diff --git a/Gemfile.checksum b/Gemfile.checksum
index f55fecef006..cce6c8ef018 100644
--- a/Gemfile.checksum
+++ b/Gemfile.checksum
@@ -239,7 +239,7 @@
{"name":"google-protobuf","version":"3.21.9","platform":"x86_64-linux","checksum":"d4053012022f7bf47cd54c7c19416f600325e6cc1e1604a631c2fde69dd920a4"},
{"name":"googleapis-common-protos-types","version":"1.3.0","platform":"ruby","checksum":"c5411f3197cc3e02547ded1858303b1f830b4dc89c588c142ad6c8a231050671"},
{"name":"googleauth","version":"1.3.0","platform":"ruby","checksum":"51dd7362353cf1e90a2d01e1fb94321ae3926c776d4dc4a79db65230217ffcc2"},
-{"name":"gpgme","version":"2.0.20","platform":"ruby","checksum":"fc194689cff40cd4ccafb3086031e930650b3efc15348bbfdf7a2f8b5a826f75"},
+{"name":"gpgme","version":"2.0.22","platform":"ruby","checksum":"7c6904952afdd0bf2c7c3ed6de98a5143f86c6b7390dbcd9d7012bddfa3ec862"},
{"name":"grape","version":"1.5.2","platform":"ruby","checksum":"1df3b734c3862e235174232bc629587eddda9ef3df648230827575186700ae29"},
{"name":"grape-entity","version":"0.10.0","platform":"ruby","checksum":"9aed1e7cbbc96d9e73f72e5f32c776d4ba8a5baf54c3acda2682008dba2b2cfe"},
{"name":"grape-path-helpers","version":"1.7.1","platform":"ruby","checksum":"2e27271a20d4073e3a3b2b955425c7f803e198be3ba8f6e59e3d59643c5381e2"},
diff --git a/Gemfile.lock b/Gemfile.lock
index 608e633e11a..026907a7f59 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -661,8 +661,8 @@ GEM
multi_json (~> 1.11)
os (>= 0.9, < 2.0)
signet (>= 0.16, < 2.a)
- gpgme (2.0.20)
- mini_portile2 (~> 2.3)
+ gpgme (2.0.22)
+ mini_portile2 (~> 2.7)
grape (1.5.2)
activesupport
builder
@@ -1680,7 +1680,7 @@ DEPENDENCIES
gon (~> 6.4.0)
google-api-client (~> 0.33)
google-protobuf (~> 3.21, >= 3.21.9)
- gpgme (~> 2.0.19)
+ gpgme (~> 2.0.22)
grape (~> 1.5.2)
grape-entity (~> 0.10.0)
grape-path-helpers (~> 1.7.1)
diff --git a/db/docs/dependency_list_exports.yml b/db/docs/dependency_list_exports.yml
new file mode 100644
index 00000000000..3f48323ba7a
--- /dev/null
+++ b/db/docs/dependency_list_exports.yml
@@ -0,0 +1,8 @@
+---
+table_name: dependency_list_exports
+feature_categories:
+- dependency_scanning
+description: Dependency list exported data
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/104361
+milestone: '15.7'
+gitlab_schema: gitlab_main
diff --git a/db/migrate/20221111135238_create_dependency_list_exports_table.rb b/db/migrate/20221111135238_create_dependency_list_exports_table.rb
new file mode 100644
index 00000000000..d47bd93fff7
--- /dev/null
+++ b/db/migrate/20221111135238_create_dependency_list_exports_table.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class CreateDependencyListExportsTable < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ def up
+ create_table :dependency_list_exports do |t|
+ t.timestamps_with_timezone null: false
+ t.bigint :project_id, null: false
+ t.bigint :user_id
+ t.integer :file_store
+ t.integer :status, default: 0, null: false, limit: 2
+ t.text :file, limit: 255
+
+ t.index :user_id
+ t.index :project_id
+ end
+ end
+
+ def down
+ drop_table :dependency_list_exports
+ end
+end
diff --git a/db/migrate/20221116100056_add_foreign_key_to_dependency_list_exports.rb b/db/migrate/20221116100056_add_foreign_key_to_dependency_list_exports.rb
new file mode 100644
index 00000000000..1c7df66bd04
--- /dev/null
+++ b/db/migrate/20221116100056_add_foreign_key_to_dependency_list_exports.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+class AddForeignKeyToDependencyListExports < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key(
+ :dependency_list_exports,
+ :users,
+ column: :user_id,
+ on_delete: :nullify)
+ add_concurrent_foreign_key(
+ :dependency_list_exports,
+ :projects,
+ column: :project_id,
+ on_delete: :cascade)
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key_if_exists :dependency_list_exports, column: :user_id
+ end
+ with_lock_retries do
+ remove_foreign_key_if_exists :dependency_list_exports, column: :project_id
+ end
+ end
+end
diff --git a/db/schema_migrations/20221111135238 b/db/schema_migrations/20221111135238
new file mode 100644
index 00000000000..5a01cca7871
--- /dev/null
+++ b/db/schema_migrations/20221111135238
@@ -0,0 +1 @@
+baf4a11c802eccd1d45bc210c981f0ee2552d7347252caa5558e223271f8a92f \ No newline at end of file
diff --git a/db/schema_migrations/20221116100056 b/db/schema_migrations/20221116100056
new file mode 100644
index 00000000000..8909a1d9bf2
--- /dev/null
+++ b/db/schema_migrations/20221116100056
@@ -0,0 +1 @@
+20fd10e525180e73a642809143c4e3caf3a58defc1c475389bc2a9b386bad253 \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index 4fe6646c271..b1f6118344e 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -14638,6 +14638,27 @@ CREATE TABLE dependency_proxy_blob_states (
COMMENT ON TABLE dependency_proxy_blob_states IS '{"owner":"group::geo","description":"Geo-specific table to store the verification state of DependencyProxy::Blob objects"}';
+CREATE TABLE dependency_list_exports (
+ id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ project_id bigint NOT NULL,
+ user_id bigint,
+ file_store integer,
+ status smallint DEFAULT 0 NOT NULL,
+ file text,
+ CONSTRAINT check_fff6fc9b2f CHECK ((char_length(file) <= 255))
+);
+
+CREATE SEQUENCE dependency_list_exports_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE dependency_list_exports_id_seq OWNED BY dependency_list_exports.id;
+
CREATE TABLE dependency_proxy_blobs (
id integer NOT NULL,
group_id integer NOT NULL,
@@ -23851,6 +23872,8 @@ ALTER TABLE ONLY dast_site_validations ALTER COLUMN id SET DEFAULT nextval('dast
ALTER TABLE ONLY dast_sites ALTER COLUMN id SET DEFAULT nextval('dast_sites_id_seq'::regclass);
+ALTER TABLE ONLY dependency_list_exports ALTER COLUMN id SET DEFAULT nextval('dependency_list_exports_id_seq'::regclass);
+
ALTER TABLE ONLY dependency_proxy_blobs ALTER COLUMN id SET DEFAULT nextval('dependency_proxy_blobs_id_seq'::regclass);
ALTER TABLE ONLY dependency_proxy_group_settings ALTER COLUMN id SET DEFAULT nextval('dependency_proxy_group_settings_id_seq'::regclass);
@@ -25713,6 +25736,9 @@ ALTER TABLE ONLY dast_site_validations
ALTER TABLE ONLY dast_sites
ADD CONSTRAINT dast_sites_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY dependency_list_exports
+ ADD CONSTRAINT dependency_list_exports_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY dependency_proxy_blob_states
ADD CONSTRAINT dependency_proxy_blob_states_pkey PRIMARY KEY (dependency_proxy_blob_id);
@@ -28971,6 +28997,10 @@ CREATE UNIQUE INDEX index_dast_sites_on_project_id_and_url ON dast_sites USING b
CREATE UNIQUE INDEX index_dep_prox_manifests_on_group_id_file_name_and_status ON dependency_proxy_manifests USING btree (group_id, file_name, status);
+CREATE INDEX index_dependency_list_exports_on_project_id ON dependency_list_exports USING btree (project_id);
+
+CREATE INDEX index_dependency_list_exports_on_user_id ON dependency_list_exports USING btree (user_id);
+
CREATE INDEX index_dependency_proxy_blob_states_failed_verification ON dependency_proxy_blob_states USING btree (verification_retry_at NULLS FIRST) WHERE (verification_state = 3);
CREATE INDEX index_dependency_proxy_blob_states_needs_verification ON dependency_proxy_blob_states USING btree (verification_state) WHERE ((verification_state = 0) OR (verification_state = 3));
@@ -33169,6 +33199,9 @@ ALTER TABLE ONLY approval_merge_request_rules
ALTER TABLE ONLY deploy_keys_projects
ADD CONSTRAINT fk_58a901ca7e FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+ALTER TABLE ONLY dependency_list_exports
+ ADD CONSTRAINT fk_5b3d11e1ef FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL;
+
ALTER TABLE ONLY dast_scanner_profiles_builds
ADD CONSTRAINT fk_5d46286ad3 FOREIGN KEY (dast_scanner_profile_id) REFERENCES dast_scanner_profiles(id) ON DELETE CASCADE;
@@ -33652,6 +33685,9 @@ ALTER TABLE ONLY system_note_metadata
ALTER TABLE ONLY sbom_occurrences
ADD CONSTRAINT fk_d857c6edc1 FOREIGN KEY (component_id) REFERENCES sbom_components(id) ON DELETE CASCADE;
+ALTER TABLE ONLY dependency_list_exports
+ ADD CONSTRAINT fk_d871d74675 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY todos
ADD CONSTRAINT fk_d94154aa95 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
diff --git a/lib/backup/manager.rb b/lib/backup/manager.rb
index 10364e39106..aaffd24291d 100644
--- a/lib/backup/manager.rb
+++ b/lib/backup/manager.rb
@@ -277,7 +277,7 @@ module Backup
def build_backup_information
@backup_information ||= {
db_version: ActiveRecord::Migrator.current_version.to_s,
- backup_created_at: Time.now,
+ backup_created_at: Time.current,
gitlab_version: Gitlab::VERSION,
tar_version: tar_version,
installation_type: Gitlab::INSTALLATION_TYPE,
@@ -291,7 +291,7 @@ module Backup
@backup_information.merge!(
full_backup_id: full_backup_id,
db_version: ActiveRecord::Migrator.current_version.to_s,
- backup_created_at: Time.zone.now,
+ backup_created_at: Time.current,
gitlab_version: Gitlab::VERSION,
tar_version: tar_version,
installation_type: Gitlab::INSTALLATION_TYPE,
@@ -396,7 +396,7 @@ module Backup
timestamp = matched[1].to_i
- next unless Time.at(timestamp) < (Time.now - keep_time)
+ next unless Time.zone.at(timestamp) < (Time.current - keep_time)
begin
FileUtils.rm(file)
@@ -611,7 +611,7 @@ module Backup
end
def puts_time(msg)
- progress.puts "#{Time.now} -- #{msg}"
+ progress.puts "#{Time.current} -- #{msg}"
Gitlab::BackupLogger.info(message: "#{Rainbow.uncolor(msg)}")
end
end
diff --git a/lib/gitlab/database/gitlab_schemas.yml b/lib/gitlab/database/gitlab_schemas.yml
index 4dc06489797..9b47214146a 100644
--- a/lib/gitlab/database/gitlab_schemas.yml
+++ b/lib/gitlab/database/gitlab_schemas.yml
@@ -170,6 +170,7 @@ dast_sites: :gitlab_main
dast_site_tokens: :gitlab_main
dast_site_validations: :gitlab_main
dependency_proxy_blob_states: :gitlab_main
+dependency_list_exports: :gitlab_main
dependency_proxy_blobs: :gitlab_main
dependency_proxy_group_settings: :gitlab_main
dependency_proxy_image_ttl_group_policies: :gitlab_main
diff --git a/rubocop/cop/graphql/descriptions.rb b/rubocop/cop/graphql/descriptions.rb
index d49673b29b3..0234ad99521 100644
--- a/rubocop/cop/graphql/descriptions.rb
+++ b/rubocop/cop/graphql/descriptions.rb
@@ -91,10 +91,9 @@ module RuboCop
return unless message
add_offense(node, message: message) do |corrector|
- description = locate_description(node)
next unless description
- corrector.insert_after(before_end_quote(description), '.')
+ corrector.insert_after(before_end_quote(description), '.') if no_period?(description)
end
end
diff --git a/spec/lib/backup/manager_spec.rb b/spec/lib/backup/manager_spec.rb
index f85b005f4d1..992dbec73c2 100644
--- a/spec/lib/backup/manager_spec.rb
+++ b/spec/lib/backup/manager_spec.rb
@@ -166,7 +166,7 @@ RSpec.describe Backup::Manager do
describe '#create' do
let(:incremental_env) { 'false' }
let(:expected_backup_contents) { %w{backup_information.yml task1.tar.gz task2.tar.gz} }
- let(:backup_time) { Time.utc(2019, 1, 1) }
+ let(:backup_time) { Time.zone.parse('2019-1-1') }
let(:backup_id) { "1546300800_2019_01_01_#{Gitlab::VERSION}" }
let(:full_backup_id) { backup_id }
let(:pack_tar_file) { "#{backup_id}_gitlab_backup.tar" }
@@ -284,7 +284,7 @@ RSpec.describe Backup::Manager do
allow(Dir).to receive(:chdir).and_yield
allow(Dir).to receive(:glob).and_return(files)
allow(FileUtils).to receive(:rm)
- allow(Time).to receive(:now).and_return(Time.utc(2016))
+ allow(Time).to receive(:now).and_return(Time.zone.parse('2016-1-1'))
end
context 'when keep_time is zero' do
diff --git a/spec/rubocop/cop/graphql/descriptions_spec.rb b/spec/rubocop/cop/graphql/descriptions_spec.rb
index 5e3f9539ff4..6aee4b544f6 100644
--- a/spec/rubocop/cop/graphql/descriptions_spec.rb
+++ b/spec/rubocop/cop/graphql/descriptions_spec.rb
@@ -16,6 +16,8 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do
end
end
TYPE
+
+ expect_no_corrections
end
it 'adds an offense when description does not end in a period' do
@@ -44,6 +46,8 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do
end
end
TYPE
+
+ expect_no_corrections
end
it 'adds an offense when description begins with "The"' do
@@ -58,6 +62,8 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do
end
end
TYPE
+
+ expect_no_corrections
end
it 'adds an offense when description contains the demonstrative "this"' do
@@ -72,6 +78,8 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do
end
end
TYPE
+
+ expect_no_corrections
end
it 'does not add an offense when a word contains the substring "this"' do
@@ -123,6 +131,8 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do
end
end
TYPE
+
+ expect_no_corrections
end
it 'adds an offense when description does not end in a period' do
@@ -151,6 +161,8 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do
end
end
TYPE
+
+ expect_no_corrections
end
it 'adds an offense when description begins with "The"' do
@@ -165,6 +177,8 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do
end
end
TYPE
+
+ expect_no_corrections
end
it 'adds an offense when description contains the demonstrative "this"' do
@@ -179,6 +193,8 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do
end
end
TYPE
+
+ expect_no_corrections
end
it 'does not add an offense when a word contains the substring "this"' do
@@ -218,6 +234,8 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do
end
end
TYPE
+
+ expect_no_corrections
end
it 'adds an offense when description does not end in a period' do
@@ -240,6 +258,8 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do
end
end
TYPE
+
+ expect_no_corrections
end
it 'adds an offense when description begins with "A"' do
@@ -251,6 +271,8 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do
end
end
TYPE
+
+ expect_no_corrections
end
it 'adds an offense when description contains the demonstrative "this"' do
@@ -262,6 +284,8 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do
end
end
TYPE
+
+ expect_no_corrections
end
it 'does not add an offense when a word contains the substring "this"' do
@@ -295,8 +319,8 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do
end
end
- describe 'autocorrecting descriptions without periods' do
- it 'can autocorrect' do
+ describe 'autocorrecting periods in descriptions' do
+ it 'autocorrects missing periods' do
expect_offense(<<~TYPE)
module Types
class FakeType < BaseObject
@@ -321,7 +345,20 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do
TYPE
end
- it 'can autocorrect a heredoc' do
+ it 'does not autocorrect if periods exist' do
+ expect_no_offenses(<<~TYPE)
+ module Types
+ class FakeType < BaseObject
+ field :a_thing,
+ GraphQL::Types::String,
+ null: false,
+ description: 'Behold! A description.'
+ end
+ end
+ TYPE
+ end
+
+ it 'autocorrects a heredoc' do
expect_offense(<<~TYPE)
module Types
class FakeType < BaseObject
@@ -349,5 +386,20 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do
end
TYPE
end
+
+ it 'does not autocorrect a heredoc if periods exist' do
+ expect_no_offenses(<<~TYPE)
+ module Types
+ class FakeType < BaseObject
+ field :a_thing,
+ GraphQL::Types::String,
+ null: false,
+ description: <<~DESC
+ Behold! A description.
+ DESC
+ end
+ end
+ TYPE
+ end
end
end