Direct Transfer - ERROR: duplicate key index_vuln_findings_on_uuid_including_vuln_id_1

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

During Direct Transfer of group (and project?), in some circumstances it raises the following errors:

Summary

Steps to reproduce

curl --request POST \
  --url "http://gdk.test:3000/api/v4/bulk_imports" \
  --header "content-type: application/json" \
  --header "PRIVATE-TOKEN: glpat-XXXXXXXXXXX" \
  --data "{
    \"configuration\": {
      \"url\": \"https://staging.gitlab.com/\",
      \"access_token\": \"glpat-YYYYYYYYYY\"
    },
    \"entities\": [
      {
        \"source_full_path\": \"ai-evaluation/etv\",
        \"source_type\": \"group_entity\",
        \"destination_slug\": \"etv4\",
        \"destination_namespace\": \"meir\",
        \"migrate_projects\": true
      }
    ]
  }"

It can probably be reproduced when importing a single project, instead of the whole group.

Example Project

What is the current bug behavior?

The import finishes successfully, but some errors appear.

vulnerabilities		ActiveRecord::RecordNotUnique
PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_vuln_findings_on_uuid_including_vuln_id_1" DETAIL: Key (uuid)=(e8c94a84-cec0-5bfb-a80b-75c18b1433b3) already exists.

What is the expected correct behavior?

Avoid errors.
Either by avoid importing duplicates, or by changing the computation of the uuid.

Relevant logs and/or screenshots

image

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

Edited by 🤖 GitLab Bot 🤖