Cleanup policies UI do not show `nil` values
Summary
Cleanup policies have nil
able fields:
The problem is that the UI doesn't present those nil
values.
Here is a cleanup policy with nil
values for older_than
and keep_n
:
#<ContainerExpirationPolicy:0x00007fdcee48dd48
project_id: 390,
created_at: Tue, 13 Apr 2021 13:12:28 UTC +00:00,
updated_at: Tue, 01 Jun 2021 12:56:05 UTC +00:00,
next_run_at: Wed, 02 Jun 2021 12:56:05 UTC +00:00,
name_regex: ".*",
cadence: "1d",
older_than: nil,
keep_n: nil,
enabled: true,
name_regex_keep: nil>
and here is what the UI displays:
This is confusing and could lead to data loss. Users could think that container images will cleaned up until there are 10 tags left but with keep_n
nil
, the cleanup policy will actually remove all tags.
Crunching numbers
At the time of this writing, we have on gitlab.com :
-
~100 enabled cleanup policies linked to projects with container images and with
keep_n
set tonil
. -
~150 enabled cleanup policies linked to projects with container images and with
older_than
set tonil
.
Example Project
https://gitlab.com/10io/NugetInstall/-/settings/ci_cd
What is the current bug behavior?
The UI displays 10 tags and 90 days for keep_n
and older_than
respectively when set to nil
What is the expected correct behavior?
The UI should display a blank value.
Edited by David Fernandez