Skip to content

Draft: Interate through all sandboxes for deletions

Tiffany Rea requested to merge iterate-through-all-sandbox-for-deletion into master

What does this MR do and why?

Describe in detail what your merge request does and why.

Per discussion https://gitlab.com/gitlab-org/quality/team-tasks/-/issues/1477#note_1112688210 - we want to run clean up job subsequently to delete-test-resources and delete-failed-test-resources job just in case there are still some groups/projects left behind for any reasons. But we have recently concatenate sandbox group name with the day of the week, so we need to update these script to look for all possible sandbox group when the tasks run.

Besides that, just cleaning up rubocop offenses and replace $stdout puts with Runtime::Logger.info.

New outputs should look like this

Projects

$ <blah> bundle exec rake delete_projects
warning: parser/current is loading parser/ruby27, which recognizes2.7.6-compliant syntax, but you are running 2.7.5.
Please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
[Sep 23 2022 12:22:18 PDT (QA Tests)] INFO  -- Fetching top-level sandbox group gitlab-qa-sandbox-group-1's id...
[Sep 23 2022 12:22:18 PDT (QA Tests)] INFO  -- Couldn't find top-level sandbox group gitlab-qa-sandbox-group-1
[Sep 23 2022 12:22:18 PDT (QA Tests)] INFO  -- Fetching top-level sandbox group gitlab-qa-sandbox-group-2's id...
[Sep 23 2022 12:22:19 PDT (QA Tests)] INFO  -- Number of projects to be deleted: 0
[Sep 23 2022 12:22:19 PDT (QA Tests)] INFO  -- Fetching top-level sandbox group gitlab-qa-sandbox-group-3's id...
[Sep 23 2022 12:22:19 PDT (QA Tests)] INFO  -- Number of projects to be deleted: 0
[Sep 23 2022 12:22:19 PDT (QA Tests)] INFO  -- Fetching top-level sandbox group gitlab-qa-sandbox-group-4's id...
[Sep 23 2022 12:22:20 PDT (QA Tests)] INFO  -- Number of projects to be deleted: 0
[Sep 23 2022 12:22:20 PDT (QA Tests)] INFO  -- Fetching top-level sandbox group gitlab-qa-sandbox-group-5's id...
[Sep 23 2022 12:22:20 PDT (QA Tests)] INFO  -- Number of projects to be deleted: 0
[Sep 23 2022 12:22:20 PDT (QA Tests)] INFO  -- Fetching top-level sandbox group gitlab-qa-sandbox-group-6's id...
[Sep 23 2022 12:22:21 PDT (QA Tests)] INFO  -- Number of projects to be deleted: 0
[Sep 23 2022 12:22:21 PDT (QA Tests)] INFO  -- Fetching top-level sandbox group gitlab-qa-sandbox-group-7's id...
[Sep 23 2022 12:22:21 PDT (QA Tests)] INFO  -- Couldn't find top-level sandbox group gitlab-qa-sandbox-group-7

Done

Groups

$ <blah> bundle exec rake delete_subgroups
warning: parser/current is loading parser/ruby27, which recognizes2.7.6-compliant syntax, but you are running 2.7.5.
Please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
[Sep 23 2022 12:22:31 PDT (QA Tests)] INFO  -- Fetching subgroups for deletion...
[Sep 23 2022 12:22:31 PDT (QA Tests)] INFO  -- Gathering subgroups of gitlab-qa-sandbox-group-1...
[Sep 23 2022 12:22:31 PDT (QA Tests)] INFO  -- Couldn't find top-level sandbox group gitlab-qa-sandbox-group-1
[Sep 23 2022 12:22:31 PDT (QA Tests)] INFO  -- Gathering subgroups of gitlab-qa-sandbox-group-2...
[Sep 23 2022 12:22:31 PDT (QA Tests)] INFO  -- Fetching subgroups' ids...
[Sep 23 2022 12:22:31 PDT (QA Tests)] INFO  -- Number of subgroups not already marked for deletion: 0
[Sep 23 2022 12:22:31 PDT (QA Tests)] INFO  -- Gathering subgroups of gitlab-qa-sandbox-group-3...
[Sep 23 2022 12:22:32 PDT (QA Tests)] INFO  -- Fetching subgroups' ids...
[Sep 23 2022 12:22:32 PDT (QA Tests)] INFO  -- Number of subgroups not already marked for deletion: 0
[Sep 23 2022 12:22:32 PDT (QA Tests)] INFO  -- Gathering subgroups of gitlab-qa-sandbox-group-4...
[Sep 23 2022 12:22:32 PDT (QA Tests)] INFO  -- Fetching subgroups' ids...
[Sep 23 2022 12:22:32 PDT (QA Tests)] INFO  -- Number of subgroups not already marked for deletion: 0
[Sep 23 2022 12:22:32 PDT (QA Tests)] INFO  -- Gathering subgroups of gitlab-qa-sandbox-group-5...
[Sep 23 2022 12:22:32 PDT (QA Tests)] INFO  -- Fetching subgroups' ids...
[Sep 23 2022 12:22:33 PDT (QA Tests)] INFO  -- Number of subgroups not already marked for deletion: 0
[Sep 23 2022 12:22:33 PDT (QA Tests)] INFO  -- Gathering subgroups of gitlab-qa-sandbox-group-6...
[Sep 23 2022 12:22:33 PDT (QA Tests)] INFO  -- Fetching subgroups' ids...
[Sep 23 2022 12:22:33 PDT (QA Tests)] INFO  -- Number of subgroups not already marked for deletion: 2
[Sep 23 2022 12:22:33 PDT (QA Tests)] INFO  -- Deleting 2 subgroups...
[Sep 23 2022 12:22:33 PDT (QA Tests)] INFO  -- Deleting subgroup gitlab-qa-sandbox-group-6/qa-test-2022-09-23-11-40-03-9596cbc944966ea7... SUCCESS
[Sep 23 2022 12:22:34 PDT (QA Tests)] INFO  -- Deleting subgroup gitlab-qa-sandbox-group-6/qa-test-2022-09-23-11-49-14-ca6adfcd081377e9... SUCCESS
[Sep 23 2022 12:22:34 PDT (QA Tests)] INFO  -- Gathering subgroups of gitlab-qa-sandbox-group-7...
[Sep 23 2022 12:22:34 PDT (QA Tests)] INFO  -- Couldn't find top-level sandbox group gitlab-qa-sandbox-group-7

Done

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Tiffany Rea

Merge request reports

Loading