Skip to content

Update container_expiration_policies defaults

Steve Abrams requested to merge 218464-expiration-policy-defaults into master

What does this MR do?

This MR updates the default values for container expiration policies to what is expected to be default.

Previously, container_expiration_policies were disabled by default. The frontend displayed default values in the form, so when a user enabled them (saved the form), the default values would be applied. We recently updated to set enabled = true by default, so when the policy is created, it is created without the expected default values, even though they are still displayed on the front end (because the form will display the default on nil values). This adds the correct defaults to the database.

Future MRs will remove the defaults from the mentioned helpers and clean up empty enabled container expiration policies.

Database

Up migration

== 20200519194042 UpdateContainerExpirationPoliciesDefaults: migrating ========
-- change_column_default(:container_expiration_policies, :cadence, "1d")
   -> 0.0123s
-- change_column_default(:container_expiration_policies, :keep_n, 10)
   -> 0.0034s
-- change_column_default(:container_expiration_policies, :older_than, "90d")
   -> 0.0025s
== 20200519194042 UpdateContainerExpirationPoliciesDefaults: migrated (0.0293s)

Down migration

== 20200519194042 UpdateContainerExpirationPoliciesDefaults: reverting ========
-- change_column_default(:container_expiration_policies, :cadence, "7d")
   -> 0.0033s
-- change_column_default(:container_expiration_policies, :keep_n, nil)
   -> 0.0016s
-- change_column_default(:container_expiration_policies, :older_than, nil)
   -> 0.0014s
== 20200519194042 UpdateContainerExpirationPoliciesDefaults: reverted (0.0127s)

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 #218464 (closed)

Edited by Yorick Peterse

Merge request reports