Skip to content

Container Expiration Policies recurring jobs

Steve Abrams requested to merge 15398-recurring-job into master

What does this MR do?

Users have the ability to create expiration policies for their projects to clean up their container/docker images in the container registry (!20412 (merged)). This MR will enable those policies to actually run recurring cleanup jobs.

The attributes of a container_expiration_policy are provided as the params for CleanupContainerRepositoryWorker. The policy also has a cadence value for it to run at a regular interval (daily, weekly, monthly) via a cron job. This MR creates a new cron job that will run hourly, running the CleanupContainerRepositoryWorker for any policy that is due to run during that hour. This is a similar setup to how scheduled pipelines are run.

The CleanupContainerRepositoryWorker gets all enabled container_expiration_policies that are due to run, and passes them through the ContainerExpirationPolicyService, which will run the CleanupContainerRepositoryWorker for each container_repository in the project associated with the container_expiration_policy (a project has_one container_expiration_policy).

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team

Related #15398 (closed)

Edited by Steve Abrams

Merge request reports