Commit c7be549c authored by pataar's avatar pataar Committed by David Fernandez

Add option of 60 days to container image expiration policy

Allow the image tag cleanup policy to clean up tags that are older than 60 days.

Changelog: added
parent 487bc0b5
...@@ -73,6 +73,7 @@ export const OLDER_THAN_OPTIONS = [ ...@@ -73,6 +73,7 @@ export const OLDER_THAN_OPTIONS = [
{ key: 'SEVEN_DAYS', variable: 7, default: false }, { key: 'SEVEN_DAYS', variable: 7, default: false },
{ key: 'FOURTEEN_DAYS', variable: 14, default: false }, { key: 'FOURTEEN_DAYS', variable: 14, default: false },
{ key: 'THIRTY_DAYS', variable: 30, default: false }, { key: 'THIRTY_DAYS', variable: 30, default: false },
{ key: 'SIXTY_DAYS', variable: 60, default: false },
{ key: 'NINETY_DAYS', variable: 90, default: true }, { key: 'NINETY_DAYS', variable: 90, default: true },
]; ];
......
...@@ -6,6 +6,7 @@ module Types ...@@ -6,6 +6,7 @@ module Types
'7d': 'SEVEN_DAYS', '7d': 'SEVEN_DAYS',
'14d': 'FOURTEEN_DAYS', '14d': 'FOURTEEN_DAYS',
'30d': 'THIRTY_DAYS', '30d': 'THIRTY_DAYS',
'60d': 'SIXTY_DAYS',
'90d': 'NINETY_DAYS' '90d': 'NINETY_DAYS'
}.freeze }.freeze
......
...@@ -74,6 +74,7 @@ class ContainerExpirationPolicy < ApplicationRecord ...@@ -74,6 +74,7 @@ class ContainerExpirationPolicy < ApplicationRecord
'7d': _('%{days} days until tags are automatically removed') % { days: 7 }, '7d': _('%{days} days until tags are automatically removed') % { days: 7 },
'14d': _('%{days} days until tags are automatically removed') % { days: 14 }, '14d': _('%{days} days until tags are automatically removed') % { days: 14 },
'30d': _('%{days} days until tags are automatically removed') % { days: 30 }, '30d': _('%{days} days until tags are automatically removed') % { days: 30 },
'60d': _('%{days} days until tags are automatically removed') % { days: 60 },
'90d': _('%{days} days until tags are automatically removed') % { days: 90 } '90d': _('%{days} days until tags are automatically removed') % { days: 90 }
} }
end end
......
---
data_category: optional
key_path: counts.projects_with_expiration_policy_enabled_with_older_than_set_to_60d
description: A count of projects with the cleanup policy set delete tags older than
60 days
product_section: ops
product_stage: package
product_group: group::package
product_category: container registry
value_type: number
status: active
time_frame: all
data_source: database
distribution:
- ee
- ce
tier:
- free
- premium
- ultimate
performance_indicator_type: []
milestone: "14.4"
...@@ -15460,6 +15460,7 @@ Conan file types. ...@@ -15460,6 +15460,7 @@ Conan file types.
| <a id="containerexpirationpolicyolderthanenumfourteen_days"></a>`FOURTEEN_DAYS` | 14 days until tags are automatically removed. | | <a id="containerexpirationpolicyolderthanenumfourteen_days"></a>`FOURTEEN_DAYS` | 14 days until tags are automatically removed. |
| <a id="containerexpirationpolicyolderthanenumninety_days"></a>`NINETY_DAYS` | 90 days until tags are automatically removed. | | <a id="containerexpirationpolicyolderthanenumninety_days"></a>`NINETY_DAYS` | 90 days until tags are automatically removed. |
| <a id="containerexpirationpolicyolderthanenumseven_days"></a>`SEVEN_DAYS` | 7 days until tags are automatically removed. | | <a id="containerexpirationpolicyolderthanenumseven_days"></a>`SEVEN_DAYS` | 7 days until tags are automatically removed. |
| <a id="containerexpirationpolicyolderthanenumsixty_days"></a>`SIXTY_DAYS` | 60 days until tags are automatically removed. |
| <a id="containerexpirationpolicyolderthanenumthirty_days"></a>`THIRTY_DAYS` | 30 days until tags are automatically removed. | | <a id="containerexpirationpolicyolderthanenumthirty_days"></a>`THIRTY_DAYS` | 30 days until tags are automatically removed. |
### `ContainerRepositoryCleanupStatus` ### `ContainerRepositoryCleanupStatus`
......
...@@ -99,6 +99,12 @@ Array [ ...@@ -99,6 +99,12 @@ Array [
"label": "30 days", "label": "30 days",
"variable": 30, "variable": 30,
}, },
Object {
"default": false,
"key": "SIXTY_DAYS",
"label": "60 days",
"variable": 60,
},
Object { Object {
"default": true, "default": true,
"key": "NINETY_DAYS", "key": "NINETY_DAYS",
......
...@@ -44,7 +44,7 @@ exports[`Settings Form Keep Regex matches snapshot 1`] = ` ...@@ -44,7 +44,7 @@ exports[`Settings Form Keep Regex matches snapshot 1`] = `
exports[`Settings Form OlderThan matches snapshot 1`] = ` exports[`Settings Form OlderThan matches snapshot 1`] = `
<expiration-dropdown-stub <expiration-dropdown-stub
data-testid="older-than-dropdown" data-testid="older-than-dropdown"
formoptions="[object Object],[object Object],[object Object],[object Object],[object Object]" formoptions="[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]"
label="Remove tags older than:" label="Remove tags older than:"
name="older-than" name="older-than"
value="FOURTEEN_DAYS" value="FOURTEEN_DAYS"
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe GitlabSchema.types['ContainerExpirationPolicyOlderThanEnum'] do RSpec.describe GitlabSchema.types['ContainerExpirationPolicyOlderThanEnum'] do
let_it_be(:expected_values) { %w[SEVEN_DAYS FOURTEEN_DAYS THIRTY_DAYS NINETY_DAYS] } let_it_be(:expected_values) { %w[SEVEN_DAYS FOURTEEN_DAYS THIRTY_DAYS SIXTY_DAYS NINETY_DAYS] }
it_behaves_like 'exposing container expiration policy option', :older_than it_behaves_like 'exposing container expiration policy option', :older_than
end end
...@@ -40,6 +40,7 @@ RSpec.describe ContainerExpirationPoliciesHelper do ...@@ -40,6 +40,7 @@ RSpec.describe ContainerExpirationPoliciesHelper do
{ key: '7d', label: '7 days until tags are automatically removed' }, { key: '7d', label: '7 days until tags are automatically removed' },
{ key: '14d', label: '14 days until tags are automatically removed' }, { key: '14d', label: '14 days until tags are automatically removed' },
{ key: '30d', label: '30 days until tags are automatically removed' }, { key: '30d', label: '30 days until tags are automatically removed' },
{ key: '60d', label: '60 days until tags are automatically removed' },
{ key: '90d', label: '90 days until tags are automatically removed', default: true } { key: '90d', label: '90 days until tags are automatically removed', default: true }
] ]
......
...@@ -662,13 +662,13 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do ...@@ -662,13 +662,13 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
subject { described_class.data[:counts] } subject { described_class.data[:counts] }
it 'gathers usage data' do it 'gathers usage data' do
expect(subject[:projects_with_expiration_policy_enabled]).to eq 18 expect(subject[:projects_with_expiration_policy_enabled]).to eq 19
expect(subject[:projects_with_expiration_policy_disabled]).to eq 5 expect(subject[:projects_with_expiration_policy_disabled]).to eq 5
expect(subject[:projects_with_expiration_policy_enabled_with_keep_n_unset]).to eq 1 expect(subject[:projects_with_expiration_policy_enabled_with_keep_n_unset]).to eq 1
expect(subject[:projects_with_expiration_policy_enabled_with_keep_n_set_to_1]).to eq 1 expect(subject[:projects_with_expiration_policy_enabled_with_keep_n_set_to_1]).to eq 1
expect(subject[:projects_with_expiration_policy_enabled_with_keep_n_set_to_5]).to eq 1 expect(subject[:projects_with_expiration_policy_enabled_with_keep_n_set_to_5]).to eq 1
expect(subject[:projects_with_expiration_policy_enabled_with_keep_n_set_to_10]).to eq 12 expect(subject[:projects_with_expiration_policy_enabled_with_keep_n_set_to_10]).to eq 13
expect(subject[:projects_with_expiration_policy_enabled_with_keep_n_set_to_25]).to eq 1 expect(subject[:projects_with_expiration_policy_enabled_with_keep_n_set_to_25]).to eq 1
expect(subject[:projects_with_expiration_policy_enabled_with_keep_n_set_to_50]).to eq 1 expect(subject[:projects_with_expiration_policy_enabled_with_keep_n_set_to_50]).to eq 1
...@@ -676,9 +676,10 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do ...@@ -676,9 +676,10 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
expect(subject[:projects_with_expiration_policy_enabled_with_older_than_set_to_7d]).to eq 1 expect(subject[:projects_with_expiration_policy_enabled_with_older_than_set_to_7d]).to eq 1
expect(subject[:projects_with_expiration_policy_enabled_with_older_than_set_to_14d]).to eq 1 expect(subject[:projects_with_expiration_policy_enabled_with_older_than_set_to_14d]).to eq 1
expect(subject[:projects_with_expiration_policy_enabled_with_older_than_set_to_30d]).to eq 1 expect(subject[:projects_with_expiration_policy_enabled_with_older_than_set_to_30d]).to eq 1
expect(subject[:projects_with_expiration_policy_enabled_with_older_than_set_to_60d]).to eq 1
expect(subject[:projects_with_expiration_policy_enabled_with_older_than_set_to_90d]).to eq 14 expect(subject[:projects_with_expiration_policy_enabled_with_older_than_set_to_90d]).to eq 14
expect(subject[:projects_with_expiration_policy_enabled_with_cadence_set_to_1d]).to eq 14 expect(subject[:projects_with_expiration_policy_enabled_with_cadence_set_to_1d]).to eq 15
expect(subject[:projects_with_expiration_policy_enabled_with_cadence_set_to_7d]).to eq 1 expect(subject[:projects_with_expiration_policy_enabled_with_cadence_set_to_7d]).to eq 1
expect(subject[:projects_with_expiration_policy_enabled_with_cadence_set_to_14d]).to eq 1 expect(subject[:projects_with_expiration_policy_enabled_with_cadence_set_to_14d]).to eq 1
expect(subject[:projects_with_expiration_policy_enabled_with_cadence_set_to_1month]).to eq 1 expect(subject[:projects_with_expiration_policy_enabled_with_cadence_set_to_1month]).to eq 1
......
...@@ -112,6 +112,7 @@ module UsageDataHelpers ...@@ -112,6 +112,7 @@ module UsageDataHelpers
projects_with_expiration_policy_enabled_with_older_than_set_to_7d projects_with_expiration_policy_enabled_with_older_than_set_to_7d
projects_with_expiration_policy_enabled_with_older_than_set_to_14d projects_with_expiration_policy_enabled_with_older_than_set_to_14d
projects_with_expiration_policy_enabled_with_older_than_set_to_30d projects_with_expiration_policy_enabled_with_older_than_set_to_30d
projects_with_expiration_policy_enabled_with_older_than_set_to_60d
projects_with_expiration_policy_enabled_with_older_than_set_to_90d projects_with_expiration_policy_enabled_with_older_than_set_to_90d
projects_with_expiration_policy_enabled_with_cadence_set_to_1d projects_with_expiration_policy_enabled_with_cadence_set_to_1d
projects_with_expiration_policy_enabled_with_cadence_set_to_7d projects_with_expiration_policy_enabled_with_cadence_set_to_7d
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment