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>2021-09-10 03:09:05 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-09-10 03:09:05 +0300
commit8f8e342720899033f06747430414d2d2e3e6527a (patch)
tree74e043e16062ac73bc0703e3437cb108b96cb509
parentcb25fb1a8e437d7a59f005eae401fdf40c8512bc (diff)
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--app/models/dependency_proxy/blob.rb3
-rw-r--r--app/models/dependency_proxy/manifest.rb3
-rw-r--r--db/migrate/20210708011425_rename_ci_builds_metadata_foreign_key.rb28
-rw-r--r--db/migrate/20210908185736_add_status_to_dependency_proxy_manifests.rb7
-rw-r--r--db/migrate/20210908185754_add_status_to_dependency_proxy_blobs.rb7
-rw-r--r--db/post_migrate/20210708011426_finalize_ci_builds_metadata_bigint_conversion.rb113
-rw-r--r--db/schema_migrations/202107080114251
-rw-r--r--db/schema_migrations/202107080114261
-rw-r--r--db/schema_migrations/202109081857361
-rw-r--r--db/schema_migrations/202109081857541
-rw-r--r--db/structure.sql18
-rw-r--r--doc/user/group/saml_sso/index.md3
-rw-r--r--package.json2
-rw-r--r--spec/models/dependency_proxy/blob_spec.rb3
-rw-r--r--spec/models/dependency_proxy/manifest_spec.rb3
-rw-r--r--yarn.lock8
16 files changed, 189 insertions, 13 deletions
diff --git a/app/models/dependency_proxy/blob.rb b/app/models/dependency_proxy/blob.rb
index 3a81112340a..5de6b1cf28f 100644
--- a/app/models/dependency_proxy/blob.rb
+++ b/app/models/dependency_proxy/blob.rb
@@ -8,6 +8,9 @@ class DependencyProxy::Blob < ApplicationRecord
validates :group, presence: true
validates :file, presence: true
validates :file_name, presence: true
+ validates :status, presence: true
+
+ enum status: { default: 0, expired: 1 }
mount_file_store_uploader DependencyProxy::FileUploader
diff --git a/app/models/dependency_proxy/manifest.rb b/app/models/dependency_proxy/manifest.rb
index d613d5708f0..15e5137b50a 100644
--- a/app/models/dependency_proxy/manifest.rb
+++ b/app/models/dependency_proxy/manifest.rb
@@ -9,6 +9,9 @@ class DependencyProxy::Manifest < ApplicationRecord
validates :file, presence: true
validates :file_name, presence: true
validates :digest, presence: true
+ validates :status, presence: true
+
+ enum status: { default: 0, expired: 1 }
mount_file_store_uploader DependencyProxy::FileUploader
diff --git a/db/migrate/20210708011425_rename_ci_builds_metadata_foreign_key.rb b/db/migrate/20210708011425_rename_ci_builds_metadata_foreign_key.rb
new file mode 100644
index 00000000000..70141f4844e
--- /dev/null
+++ b/db/migrate/20210708011425_rename_ci_builds_metadata_foreign_key.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+class RenameCiBuildsMetadataForeignKey < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ TABLE_NAME = 'ci_builds_metadata'
+ OLD_PREFIX = 'fk_rails_'
+
+ def up
+ with_lock_retries(raise_on_exhaustion: true) do
+ rename_constraint(
+ TABLE_NAME,
+ concurrent_foreign_key_name(TABLE_NAME, :build_id, prefix: 'fk_rails_'),
+ concurrent_foreign_key_name(TABLE_NAME, :build_id)
+ )
+ end
+ end
+
+ def down
+ with_lock_retries(raise_on_exhaustion: true) do
+ rename_constraint(
+ TABLE_NAME,
+ concurrent_foreign_key_name(TABLE_NAME, :build_id),
+ concurrent_foreign_key_name(TABLE_NAME, :build_id, prefix: 'fk_rails_')
+ )
+ end
+ end
+end
diff --git a/db/migrate/20210908185736_add_status_to_dependency_proxy_manifests.rb b/db/migrate/20210908185736_add_status_to_dependency_proxy_manifests.rb
new file mode 100644
index 00000000000..b8e7c7af144
--- /dev/null
+++ b/db/migrate/20210908185736_add_status_to_dependency_proxy_manifests.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddStatusToDependencyProxyManifests < Gitlab::Database::Migration[1.0]
+ def change
+ add_column :dependency_proxy_manifests, :status, :smallint, default: 0, null: false
+ end
+end
diff --git a/db/migrate/20210908185754_add_status_to_dependency_proxy_blobs.rb b/db/migrate/20210908185754_add_status_to_dependency_proxy_blobs.rb
new file mode 100644
index 00000000000..4fbdcad33cd
--- /dev/null
+++ b/db/migrate/20210908185754_add_status_to_dependency_proxy_blobs.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddStatusToDependencyProxyBlobs < Gitlab::Database::Migration[1.0]
+ def change
+ add_column :dependency_proxy_blobs, :status, :smallint, default: 0, null: false
+ end
+end
diff --git a/db/post_migrate/20210708011426_finalize_ci_builds_metadata_bigint_conversion.rb b/db/post_migrate/20210708011426_finalize_ci_builds_metadata_bigint_conversion.rb
new file mode 100644
index 00000000000..f75df04ba48
--- /dev/null
+++ b/db/post_migrate/20210708011426_finalize_ci_builds_metadata_bigint_conversion.rb
@@ -0,0 +1,113 @@
+# frozen_string_literal: true
+
+class FinalizeCiBuildsMetadataBigintConversion < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ TABLE_NAME = 'ci_builds_metadata'
+
+ def up
+ ensure_batched_background_migration_is_finished(
+ job_class_name: 'CopyColumnUsingBackgroundMigrationJob',
+ table_name: TABLE_NAME,
+ column_name: 'id',
+ job_arguments: [["id"], ["id_convert_to_bigint"]]
+ )
+
+ ensure_batched_background_migration_is_finished(
+ job_class_name: 'CopyColumnUsingBackgroundMigrationJob',
+ table_name: TABLE_NAME,
+ column_name: 'id',
+ job_arguments: [["build_id"], ["build_id_convert_to_bigint"]]
+ )
+
+ swap
+ end
+
+ def down
+ swap
+ end
+
+ private
+
+ def swap
+ # Indexes were pre-created on gitlab.com to avoid slowing down deployments
+ #
+ # rubocop:disable Migration/PreventIndexCreation
+ add_concurrent_index TABLE_NAME, :id_convert_to_bigint, unique: true, name: 'index_ci_builds_metadata_on_id_convert_to_bigint'
+ add_concurrent_index TABLE_NAME, :build_id_convert_to_bigint, where: 'has_exposed_artifacts IS TRUE', name: 'index_ci_builds_metadata_on_build_id_int8_and_exposed_artifacts'
+ create_covering_index TABLE_NAME, 'index_ci_builds_metadata_on_build_id_int8_where_interruptible'
+ add_concurrent_index TABLE_NAME, :build_id_convert_to_bigint, unique: true, name: 'index_ci_builds_metadata_on_build_id_convert_to_bigint'
+ # rubocop:enable Migration/PreventIndexCreation
+
+ add_concurrent_foreign_key TABLE_NAME, :ci_builds, column: :build_id_convert_to_bigint, on_delete: :cascade,
+ reverse_lock_order: true
+
+ with_lock_retries(raise_on_exhaustion: true) do
+ execute "LOCK TABLE ci_builds, #{TABLE_NAME} IN ACCESS EXCLUSIVE MODE"
+
+ # rubocop:disable Migration/WithLockRetriesDisallowedMethod
+ swap_column :id
+ swap_column :build_id
+ # rubocop:enable Migration/WithLockRetriesDisallowedMethod
+
+ # We need to update the trigger function in order to make PostgreSQL to
+ # regenerate the execution plan for it. This is to avoid type mismatch errors like
+ # "type of parameter 15 (bigint) does not match that when preparing the plan (integer)"
+ execute "ALTER FUNCTION #{quote_table_name(Gitlab::Database::UnidirectionalCopyTrigger.on_table(TABLE_NAME).name(:id, :id_convert_to_bigint))} RESET ALL"
+ execute "ALTER FUNCTION #{quote_table_name(Gitlab::Database::UnidirectionalCopyTrigger.on_table(TABLE_NAME).name(:build_id, :build_id_convert_to_bigint))} RESET ALL"
+
+ # Swap defaults for PK
+ execute "ALTER SEQUENCE ci_builds_metadata_id_seq OWNED BY #{TABLE_NAME}.id"
+ change_column_default TABLE_NAME, :id, -> { "nextval('ci_builds_metadata_id_seq'::regclass)" }
+ change_column_default TABLE_NAME, :id_convert_to_bigint, 0
+
+ # Swap defaults for FK
+ change_column_default TABLE_NAME, :build_id, nil
+ change_column_default TABLE_NAME, :build_id_convert_to_bigint, 0
+
+ # Swap PK constraint
+ execute "ALTER TABLE #{TABLE_NAME} DROP CONSTRAINT ci_builds_metadata_pkey CASCADE"
+ rename_index TABLE_NAME, 'index_ci_builds_metadata_on_id_convert_to_bigint', 'ci_builds_metadata_pkey'
+ execute "ALTER TABLE #{TABLE_NAME} ADD CONSTRAINT ci_builds_metadata_pkey PRIMARY KEY USING INDEX ci_builds_metadata_pkey"
+
+ # Rename the rest of the indexes (we already hold an exclusive lock, so no need to use DROP INDEX CONCURRENTLY here)
+ # rubocop:disable Migration/WithLockRetriesDisallowedMethod
+ swap_index 'index_ci_builds_metadata_on_build_id', 'index_ci_builds_metadata_on_build_id_convert_to_bigint'
+ swap_index 'index_ci_builds_metadata_on_build_id_and_has_exposed_artifacts', 'index_ci_builds_metadata_on_build_id_int8_and_exposed_artifacts'
+ swap_index 'index_ci_builds_metadata_on_build_id_and_id_and_interruptible', 'index_ci_builds_metadata_on_build_id_int8_where_interruptible'
+ # rubocop:enable Migration/WithLockRetriesDisallowedMethod
+
+ # Swap FK constraint
+ remove_foreign_key TABLE_NAME, name: concurrent_foreign_key_name(TABLE_NAME, :build_id)
+ rename_constraint(
+ TABLE_NAME,
+ concurrent_foreign_key_name(TABLE_NAME, :build_id_convert_to_bigint),
+ concurrent_foreign_key_name(TABLE_NAME, :build_id)
+ )
+ end
+ end
+
+ def swap_index(old, new)
+ execute "DROP INDEX #{old}"
+ rename_index TABLE_NAME, new, old
+ end
+
+ def swap_column(name)
+ temp_name = "#{name}_tmp"
+ execute "ALTER TABLE #{quote_table_name(TABLE_NAME)} RENAME COLUMN #{quote_column_name(name)} TO #{quote_column_name(temp_name)}"
+ execute "ALTER TABLE #{quote_table_name(TABLE_NAME)} RENAME COLUMN #{quote_column_name(:"#{name}_convert_to_bigint")} TO #{quote_column_name(name)}"
+ execute "ALTER TABLE #{quote_table_name(TABLE_NAME)} RENAME COLUMN #{quote_column_name(temp_name)} TO #{quote_column_name(:"#{name}_convert_to_bigint")}"
+ end
+
+ def create_covering_index(table, name)
+ return if index_exists_by_name?(table, name)
+
+ disable_statement_timeout do
+ execute <<~SQL
+ CREATE INDEX CONCURRENTLY #{name}
+ ON #{table} (build_id_convert_to_bigint) INCLUDE (id_convert_to_bigint)
+ WHERE interruptible = true
+ SQL
+ end
+ end
+end
diff --git a/db/schema_migrations/20210708011425 b/db/schema_migrations/20210708011425
new file mode 100644
index 00000000000..33e28f436ce
--- /dev/null
+++ b/db/schema_migrations/20210708011425
@@ -0,0 +1 @@
+e3f4424daaba173f607dbae7c84b4f6070126d262e7e9808c6a90e64648e10ed \ No newline at end of file
diff --git a/db/schema_migrations/20210708011426 b/db/schema_migrations/20210708011426
new file mode 100644
index 00000000000..abb2743928c
--- /dev/null
+++ b/db/schema_migrations/20210708011426
@@ -0,0 +1 @@
+b48556968cbff2e3aff65236b313ed8a626af4a08b1cad06723b74a99b678895 \ No newline at end of file
diff --git a/db/schema_migrations/20210908185736 b/db/schema_migrations/20210908185736
new file mode 100644
index 00000000000..826ec2b44e8
--- /dev/null
+++ b/db/schema_migrations/20210908185736
@@ -0,0 +1 @@
+4e9a585d33caed70c3e003e4f0127158ab9c98c790f8131012f052c2bd9cd1f0 \ No newline at end of file
diff --git a/db/schema_migrations/20210908185754 b/db/schema_migrations/20210908185754
new file mode 100644
index 00000000000..53b9efc22d4
--- /dev/null
+++ b/db/schema_migrations/20210908185754
@@ -0,0 +1 @@
+fc70f26e1d691773728e8e2251b23fe39247fc233996c2161143c660a92fe141 \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index 7cb59406ea5..6b39f322fe7 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -11360,8 +11360,8 @@ CREATE SEQUENCE ci_builds_id_seq
ALTER SEQUENCE ci_builds_id_seq OWNED BY ci_builds.id;
CREATE TABLE ci_builds_metadata (
- id integer NOT NULL,
- build_id integer NOT NULL,
+ id_convert_to_bigint integer DEFAULT 0 NOT NULL,
+ build_id_convert_to_bigint integer DEFAULT 0 NOT NULL,
project_id integer NOT NULL,
timeout integer,
timeout_source integer DEFAULT 1 NOT NULL,
@@ -11372,8 +11372,8 @@ CREATE TABLE ci_builds_metadata (
environment_auto_stop_in character varying(255),
expanded_environment_name character varying(255),
secrets jsonb DEFAULT '{}'::jsonb NOT NULL,
- build_id_convert_to_bigint bigint DEFAULT 0 NOT NULL,
- id_convert_to_bigint bigint DEFAULT 0 NOT NULL
+ build_id bigint NOT NULL,
+ id bigint NOT NULL
);
CREATE SEQUENCE ci_builds_metadata_id_seq
@@ -13070,7 +13070,8 @@ CREATE TABLE dependency_proxy_blobs (
size bigint,
file_store integer,
file_name character varying NOT NULL,
- file text NOT NULL
+ file text NOT NULL,
+ status smallint DEFAULT 0 NOT NULL
);
CREATE SEQUENCE dependency_proxy_blobs_id_seq
@@ -13118,6 +13119,7 @@ CREATE TABLE dependency_proxy_manifests (
file text NOT NULL,
digest text NOT NULL,
content_type text,
+ status smallint DEFAULT 0 NOT NULL,
CONSTRAINT check_079b293a7b CHECK ((char_length(file) <= 255)),
CONSTRAINT check_167a9a8a91 CHECK ((char_length(content_type) <= 255)),
CONSTRAINT check_c579e3f586 CHECK ((char_length(file_name) <= 255)),
@@ -28020,6 +28022,9 @@ ALTER TABLE ONLY ci_resources
ALTER TABLE ONLY ci_sources_pipelines
ADD CONSTRAINT fk_e1bad85861 FOREIGN KEY (pipeline_id) REFERENCES ci_pipelines(id) ON DELETE CASCADE;
+ALTER TABLE ONLY ci_builds_metadata
+ ADD CONSTRAINT fk_e20479742e FOREIGN KEY (build_id) REFERENCES ci_builds(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY gitlab_subscriptions
ADD CONSTRAINT fk_e2595d00a1 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
@@ -29553,9 +29558,6 @@ ALTER TABLE ONLY packages_packages
ALTER TABLE ONLY cluster_platforms_kubernetes
ADD CONSTRAINT fk_rails_e1e2cf841a FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE CASCADE;
-ALTER TABLE ONLY ci_builds_metadata
- ADD CONSTRAINT fk_rails_e20479742e FOREIGN KEY (build_id) REFERENCES ci_builds(id) ON DELETE CASCADE;
-
ALTER TABLE ONLY vulnerability_finding_evidences
ADD CONSTRAINT fk_rails_e3205a0c65 FOREIGN KEY (vulnerability_occurrence_id) REFERENCES vulnerability_occurrences(id) ON DELETE CASCADE;
diff --git a/doc/user/group/saml_sso/index.md b/doc/user/group/saml_sso/index.md
index 1c6fad73efe..6865378f333 100644
--- a/doc/user/group/saml_sso/index.md
+++ b/doc/user/group/saml_sso/index.md
@@ -475,6 +475,9 @@ This can then be compared to the [NameID](#nameid) being sent by the identity pr
### Users receive a 404
+If you receive a `404` during setup when using "verify configuration", make sure you have used the correct
+[SHA-1 generated fingerprint](../../../integration/saml.md#notes-on-configuring-your-identity-provider).
+
If a user is trying to sign in for the first time and the GitLab single sign-on URL has not [been configured](#configuring-your-identity-provider), they may see a 404.
As outlined in the [user access section](#linking-saml-to-your-existing-gitlabcom-account), a group Owner will need to provide the URL to users.
diff --git a/package.json b/package.json
index b113ef88117..45bd4f55990 100644
--- a/package.json
+++ b/package.json
@@ -113,7 +113,7 @@
"codesandbox-api": "0.0.23",
"compression-webpack-plugin": "^5.0.2",
"copy-webpack-plugin": "^6.4.1",
- "core-js": "^3.17.2",
+ "core-js": "^3.17.3",
"cron-validator": "^1.1.1",
"cropper": "^2.3.0",
"css-loader": "^2.1.1",
diff --git a/spec/models/dependency_proxy/blob_spec.rb b/spec/models/dependency_proxy/blob_spec.rb
index 7c8a1eb95e8..3797f6184fe 100644
--- a/spec/models/dependency_proxy/blob_spec.rb
+++ b/spec/models/dependency_proxy/blob_spec.rb
@@ -6,10 +6,13 @@ RSpec.describe DependencyProxy::Blob, type: :model do
it { is_expected.to belong_to(:group) }
end
+ it_behaves_like 'having unique enum values'
+
describe 'validations' do
it { is_expected.to validate_presence_of(:group) }
it { is_expected.to validate_presence_of(:file) }
it { is_expected.to validate_presence_of(:file_name) }
+ it { is_expected.to validate_presence_of(:status) }
end
describe '.total_size' do
diff --git a/spec/models/dependency_proxy/manifest_spec.rb b/spec/models/dependency_proxy/manifest_spec.rb
index 4203644c003..2a085b3613b 100644
--- a/spec/models/dependency_proxy/manifest_spec.rb
+++ b/spec/models/dependency_proxy/manifest_spec.rb
@@ -6,11 +6,14 @@ RSpec.describe DependencyProxy::Manifest, type: :model do
it { is_expected.to belong_to(:group) }
end
+ it_behaves_like 'having unique enum values'
+
describe 'validations' do
it { is_expected.to validate_presence_of(:group) }
it { is_expected.to validate_presence_of(:file) }
it { is_expected.to validate_presence_of(:file_name) }
it { is_expected.to validate_presence_of(:digest) }
+ it { is_expected.to validate_presence_of(:status) }
end
describe 'file is being stored' do
diff --git a/yarn.lock b/yarn.lock
index 009c3cfdadb..a49d73e9f4b 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3819,10 +3819,10 @@ core-js-pure@^3.0.0:
resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.6.5.tgz#c79e75f5e38dbc85a662d91eea52b8256d53b813"
integrity sha512-lacdXOimsiD0QyNf9BC/mxivNJ/ybBGJXQFKzRekp1WTHoVUWsUHEn+2T8GJAzzIhyOuXA+gOxCVN3l+5PLPUA==
-core-js@^3.17.2:
- version "3.17.2"
- resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.17.2.tgz#f960eae710dc62c29cca93d5332e3660e289db10"
- integrity sha512-XkbXqhcXeMHPRk2ItS+zQYliAMilea2euoMsnpRRdDad6b2VY6CQQcwz1K8AnWesfw4p165RzY0bTnr3UrbYiA==
+core-js@^3.17.3:
+ version "3.17.3"
+ resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.17.3.tgz#8e8bd20e91df9951e903cabe91f9af4a0895bc1e"
+ integrity sha512-lyvajs+wd8N1hXfzob1LdOCCHFU4bGMbqqmLn1Q4QlCpDqWPpGf+p0nj+LNrvDDG33j0hZXw2nsvvVpHysxyNw==
core-js@~2.3.0:
version "2.3.0"