Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
b7d1217d
Commit
b7d1217d
authored
Oct 13, 2021
by
Thong Kuah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow old background migration that does cross-DB query
parent
8cfb1472
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
11 deletions
+15
-11
ee/lib/ee/gitlab/background_migration/migrate_security_scans.rb
.../ee/gitlab/background_migration/migrate_security_scans.rb
+11
-8
ee/lib/ee/gitlab/background_migration/populate_vulnerability_feedback_pipeline_id.rb
..._migration/populate_vulnerability_feedback_pipeline_id.rb
+4
-1
spec/support/database/cross-join-allowlist.yml
spec/support/database/cross-join-allowlist.yml
+0
-2
No files found.
ee/lib/ee/gitlab/background_migration/migrate_security_scans.rb
View file @
b7d1217d
...
...
@@ -9,14 +9,17 @@ module EE
override
:perform
def
perform
(
start_id
,
stop_id
)
execute
<<~
SQL
INSERT INTO security_scans (created_at, updated_at, build_id, scan_type)
SELECT ci_job_artifacts.created_at, ci_job_artifacts.updated_at, ci_job_artifacts.job_id, ci_job_artifacts.file_type - 4
FROM ci_job_artifacts
WHERE ci_job_artifacts.id BETWEEN
#{
start_id
}
AND
#{
stop_id
}
AND ci_job_artifacts.file_type BETWEEN 5 and 8
ON CONFLICT (build_id, scan_type) DO NOTHING;
SQL
# Introduced in GitLab 12.9, will be removed as part of https://gitlab.com/gitlab-org/gitlab/-/issues/33124
::
Gitlab
::
Database
.
allow_cross_joins_across_databases
(
url:
'https://gitlab.com/gitlab-org/gitlab/-/issues/331248'
)
do
execute
<<~
SQL
INSERT INTO security_scans (created_at, updated_at, build_id, scan_type)
SELECT ci_job_artifacts.created_at, ci_job_artifacts.updated_at, ci_job_artifacts.job_id, ci_job_artifacts.file_type - 4
FROM ci_job_artifacts
WHERE ci_job_artifacts.id BETWEEN
#{
start_id
}
AND
#{
stop_id
}
AND ci_job_artifacts.file_type BETWEEN 5 and 8
ON CONFLICT (build_id, scan_type) DO NOTHING;
SQL
end
end
def
execute
(
sql
)
...
...
ee/lib/ee/gitlab/background_migration/populate_vulnerability_feedback_pipeline_id.rb
View file @
b7d1217d
...
...
@@ -38,7 +38,10 @@ module EE
AND "vulnerability_feedback"."project_id" = "pipelines_with_reports"."project_id";
SQL
connection
.
execute
(
update_feedback_pipeline_id_sql
)
# Introduced in GitLab 13.6, will be removed as part of https://gitlab.com/gitlab-org/gitlab/-/issues/331248
::
Gitlab
::
Database
.
allow_cross_joins_across_databases
(
url:
'https://gitlab.com/gitlab-org/gitlab/-/issues/331248'
)
do
connection
.
execute
(
update_feedback_pipeline_id_sql
)
end
end
def
pipelines_with_security_reports_subquery
(
project_ids
)
...
...
spec/support/database/cross-join-allowlist.yml
View file @
b7d1217d
...
...
@@ -9,11 +9,9 @@
-
"
./ee/spec/finders/ee/namespaces/projects_finder_spec.rb"
-
"
./ee/spec/graphql/ee/resolvers/namespace_projects_resolver_spec.rb"
-
"
./ee/spec/lib/ee/gitlab/background_migration/migrate_approver_to_approval_rules_spec.rb"
-
"
./ee/spec/lib/ee/gitlab/background_migration/migrate_security_scans_spec.rb"
-
"
./ee/spec/lib/ee/gitlab/background_migration/populate_latest_pipeline_ids_spec.rb"
-
"
./ee/spec/lib/ee/gitlab/background_migration/populate_resolved_on_default_branch_column_spec.rb"
-
"
./ee/spec/lib/ee/gitlab/background_migration/populate_uuids_for_security_findings_spec.rb"
-
"
./ee/spec/lib/ee/gitlab/background_migration/populate_vulnerability_feedback_pipeline_id_spec.rb"
-
"
./ee/spec/lib/ee/gitlab/usage_data_spec.rb"
-
"
./ee/spec/migrations/schedule_populate_resolved_on_default_branch_column_spec.rb"
-
"
./ee/spec/models/ci/build_spec.rb"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment