Package cleanup policies: remove packages older then n days (backend) (package creation date)

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

Context

As part of &5152 (closed), GitLab is adding policies to manage your storage usage with the Package Registry. As an MVC we added the ability to programmatically delete package assets (or files).

Problem to solve

Thinking beyond the MVC, we will need to add the ability to delete the packages themselves, not just the assets. This will allow users to better manage storage and maintain a tidy workspace.

Scope of this issue

Add an additional section in project settings where the user can set a policy to remove packages older than n days

Screen_Shot_2022-11-01_at_15.43.56

🎨 Figma, including responsive designs

Designs also include state where #378342 is also completed.

Considerations

Eventually, cleanup policies will be on its own page with a more complex UI (design), for example having a preview of items to be deleted. However, to keep the scope of this issue small, I propose adding a small section to the main package settings page with the knowledge that eventually we will rework it.

⚙️ backend changes

  1. Update the database models to support this new rule.
  2. Expose this rule in the GraphQL endpoints.
  3. Update the background job to execute this rule.
Edited by 🤖 GitLab Bot 🤖