Delete docs with old routing id on Projects/Groups transfer

What does this MR do and why?

Deletes ES docs with old routing on project and groups transfer

Screenshots or screen recordings

Before After

How to set up and validate locally

Setup:

  • To test this we require a Vulnerability Management feature and ee development license.
  • Ensure that local setup is running SASS mode, steps here, this feature is available only in SASS mode with ElasticSearch for now.
  • Create a new group test-group-1 and test-group-2 in the root namespace.
  • Create a new sub-group test-group-3 under the parent group test-group-1.
  • Observe the groups namespace_id in the namespaces PG table.
  • Lets say this is the observed ids test-group-1: 1, test-group-2: 2, test-group-3: 3.

Testing:

  • Import this project https://gitlab.com/bala.kumar/verify-419092 into local, under a project name verify-group-transfer into the group test-group-1 and run the CI/CD pipeline on the main branch this will create the vulnerabilities. Lets say the imported project_id is 70.
  • Run the below Kibana query to find the vulnerabilities created for that project.
GET gitlab-development-vulnerabilities/_search
{
  "query": {
    "bool": {
      "filter": {
        "term": {
          "project_id": 70
        }
      }
    }
  },
 // "_source": ["vulnerability_id", "identifier_names", "project_id"],
  "size": 10
}
  • It should show the _routing value as "routing": "group_1" and the document field for traversal_ids as "traversal_ids": "1-".

  • Transfer the project to group 2. Visit Settings -> General -> Transfer and choose the Namespace as test-group-2.

  • Wait for a minute and run the same ES query above. It should show the _routing value as "routing": "group_2" and the document field for traversal_ids as "traversal_ids": "2-".

  • Transfer the project to sub group group 3 under group 1. Visit Settings -> General -> Transfer and choose the Namespace as test-group-1/test-group-3.

  • Wait for a minute and run the same ES query above. It should show the _routing value as "routing": "group_1" and the document field for traversal_ids as "traversal_ids": "1-3-".

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #536534 (closed)

Edited by Bala Kumar

Merge request reports

Loading