Cleanup automatic cleanup policy disabling during its execution
Summary
- Container cleanup policies will be automatically disabled by the worker if they are not valid (https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/services/container_expiration_policy_service.rb#L7-10). Done in !34282 (merged).
- This part is done by using a custom exception class.
- Given that cleanup policies cadence is max
3months
and the above MR has been deployed on production on June 17th 2020 = all the policies have been executed at least once since the above MR merge = all the invalid policies have been disabled. - https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/services/container_expiration_policy_service.rb#L7-10 and the custom exception class is effectively dead code.
Improvements
- The worker should just check if the policy is valid (to keep a guard around policy validity) but not disable it.
- The "disable policy" part + the custom exception class should be removed from the code.
Risks
- This part is currently being refactoring to support throttling. #208193 (closed). Wait for that issue to be deployed before starting this one.
Involved components
- The cleanup policy worker
- The
InvalidPolicyError
custom error class.