Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
2a1259f2
Commit
2a1259f2
authored
Feb 16, 2022
by
David Fernandez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove the `container_expiration_policies_historic_entry` feature flag
Changelog: other
parent
43298757
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
66 additions
and
192 deletions
+66
-192
app/helpers/container_expiration_policies_helper.rb
app/helpers/container_expiration_policies_helper.rb
+2
-3
app/helpers/packages_helper.rb
app/helpers/packages_helper.rb
+0
-2
app/views/projects/settings/packages_and_registries/show.html.haml
.../projects/settings/packages_and_registries/show.html.haml
+1
-1
config/feature_flags/development/container_expiration_policies_historic_entry.yml
...elopment/container_expiration_policies_historic_entry.yml
+0
-8
doc/user/packages/container_registry/reduce_container_registry_storage.md
...s/container_registry/reduce_container_registry_storage.md
+0
-14
spec/features/projects/settings/registry_settings_spec.rb
spec/features/projects/settings/registry_settings_spec.rb
+20
-19
spec/helpers/container_expiration_policies_helper_spec.rb
spec/helpers/container_expiration_policies_helper_spec.rb
+10
-13
spec/helpers/packages_helper_spec.rb
spec/helpers/packages_helper_spec.rb
+33
-132
No files found.
app/helpers/container_expiration_policies_helper.rb
View file @
2a1259f2
...
...
@@ -25,8 +25,7 @@ module ContainerExpirationPoliciesHelper
end
end
def
container_expiration_policies_historic_entry_enabled?
(
project
)
Gitlab
::
CurrentSettings
.
container_expiration_policies_enable_historic_entries
||
Feature
.
enabled?
(
:container_expiration_policies_historic_entry
,
project
)
def
container_expiration_policies_historic_entry_enabled?
Gitlab
::
CurrentSettings
.
container_expiration_policies_enable_historic_entries
end
end
app/helpers/packages_helper.rb
View file @
2a1259f2
...
...
@@ -50,8 +50,6 @@ module PackagesHelper
Gitlab
.
com?
&&
Gitlab
.
config
.
registry
.
enabled
&&
project
.
feature_available?
(
:container_registry
,
current_user
)
&&
!
Gitlab
::
CurrentSettings
.
container_expiration_policies_enable_historic_entries
&&
Feature
.
enabled?
(
:container_expiration_policies_historic_entry
,
project
)
&&
project
.
container_expiration_policy
.
nil?
&&
project
.
container_repositories
.
exists?
end
...
...
app/views/projects/settings/packages_and_registries/show.html.haml
View file @
2a1259f2
...
...
@@ -9,7 +9,7 @@
older_than_options:
older_than_options
.
to_json
,
is_admin:
current_user
&
.
admin
.
to_s
,
admin_settings_path:
ci_cd_admin_application_settings_path
(
anchor:
'js-registry-settings'
),
enable_historic_entries:
container_expiration_policies_historic_entry_enabled?
(
@project
)
.
to_s
,
enable_historic_entries:
container_expiration_policies_historic_entry_enabled?
.
to_s
,
help_page_path:
help_page_path
(
'user/packages/container_registry/reduce_container_registry_storage'
,
anchor:
'cleanup-policy'
),
show_cleanup_policy_on_alert:
show_cleanup_policy_on_alert
(
@project
).
to_s
,
tags_regex_help_page_path:
help_page_path
(
'user/packages/container_registry/reduce_container_registry_storage'
,
anchor:
'regex-pattern-examples'
)
}
}
config/feature_flags/development/container_expiration_policies_historic_entry.yml
deleted
100644 → 0
View file @
43298757
---
name
:
container_expiration_policies_historic_entry
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/44444
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/262639
milestone
:
'
13.5'
type
:
development
group
:
group::package
default_enabled
:
false
doc/user/packages/container_registry/reduce_container_registry_storage.md
View file @
2a1259f2
...
...
@@ -49,20 +49,6 @@ Cleanup policies can be run on all projects, with these exceptions:
There are performance risks with enabling it for all projects, especially if you
are using an
[
external registry
](
#use-with-external-container-registries
)
.
-
For self-managed GitLab instances, you can enable or disable the cleanup policy for a specific
project.
To enable it:
```
ruby
Feature
.
enable
(
:container_expiration_policies_historic_entry
,
Project
.
find
(
<
project
id
>
))
```
To disable it:
```
ruby
Feature
.
disable
(
:container_expiration_policies_historic_entry
,
Project
.
find
(
<
project
id
>
))
```
WARNING:
For performance reasons, enabled cleanup policies are automatically disabled for projects on
...
...
spec/features/projects/settings/registry_settings_spec.rb
View file @
2a1259f2
...
...
@@ -3,8 +3,6 @@
require
'spec_helper'
RSpec
.
describe
'Project > Settings > CI/CD > Container registry tag expiration policy'
,
:js
do
using
RSpec
::
Parameterized
::
TableSyntax
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:project
,
reload:
true
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
...
...
@@ -63,31 +61,34 @@ RSpec.describe 'Project > Settings > CI/CD > Container registry tag expiration p
end
context
'with a project without expiration policy'
do
where
(
:application_setting
,
:feature_flag
,
:result
)
do
true
|
true
|
:available_section
true
|
false
|
:available_section
false
|
true
|
:available_section
false
|
false
|
:disabled_message
before
do
project
.
container_expiration_policy
.
destroy!
end
context
'with container_expiration_policies_enable_historic_entries enabled'
do
before
do
stub_application_setting
(
container_expiration_policies_enable_historic_entries:
true
)
end
it
'displays the related section'
do
subject
within
'[data-testid="registry-settings-app"]'
do
expect
(
find
(
'[data-testid="enable-toggle"]'
)).
to
have_content
(
'Disabled - Tags will not be automatically deleted.'
)
end
end
end
with_them
do
context
'with container_expiration_policies_enable_historic_entries disabled'
do
before
do
project
.
container_expiration_policy
.
destroy!
stub_feature_flags
(
container_expiration_policies_historic_entry:
false
)
stub_application_setting
(
container_expiration_policies_enable_historic_entries:
application_setting
)
stub_feature_flags
(
container_expiration_policies_historic_entry:
project
)
if
feature_flag
stub_application_setting
(
container_expiration_policies_enable_historic_entries:
false
)
end
it
'd
isplays the expected result
'
do
it
'd
oes not display the related section
'
do
subject
within
'[data-testid="registry-settings-app"]'
do
case
result
when
:available_section
expect
(
find
(
'[data-testid="enable-toggle"]'
)).
to
have_content
(
'Disabled - Tags will not be automatically deleted.'
)
when
:disabled_message
expect
(
find
(
'.gl-alert-title'
)).
to
have_content
(
'Cleanup policy for tags is disabled'
)
end
expect
(
find
(
'.gl-alert-title'
)).
to
have_content
(
'Cleanup policy for tags is disabled'
)
end
end
end
...
...
spec/helpers/container_expiration_policies_helper_spec.rb
View file @
2a1259f2
...
...
@@ -3,8 +3,6 @@
require
'spec_helper'
RSpec
.
describe
ContainerExpirationPoliciesHelper
do
using
RSpec
::
Parameterized
::
TableSyntax
describe
'#keep_n_options'
do
it
'returns keep_n options formatted for dropdown usage'
do
expected_result
=
[
...
...
@@ -51,23 +49,22 @@ RSpec.describe ContainerExpirationPoliciesHelper do
describe
'#container_expiration_policies_historic_entry_enabled?'
do
let_it_be
(
:project
)
{
build_stubbed
(
:project
)
}
subject
{
helper
.
container_expiration_policies_historic_entry_enabled?
(
project
)
}
subject
{
helper
.
container_expiration_policies_historic_entry_enabled?
}
context
'when the application setting is enabled'
do
before
do
stub_application_setting
(
container_expiration_policies_enable_historic_entries:
true
)
end
where
(
:application_setting
,
:feature_flag
,
:expected_result
)
do
true
|
true
|
true
true
|
false
|
true
false
|
true
|
true
false
|
false
|
false
it
{
is_expected
.
to
be_truthy
}
end
with_them
do
context
'when the application setting is disabled'
do
before
do
stub_feature_flags
(
container_expiration_policies_historic_entry:
false
)
stub_application_setting
(
container_expiration_policies_enable_historic_entries:
application_setting
)
stub_feature_flags
(
container_expiration_policies_historic_entry:
project
)
if
feature_flag
stub_application_setting
(
container_expiration_policies_enable_historic_entries:
false
)
end
it
{
is_expected
.
to
eq
(
expected_result
)
}
it
{
is_expected
.
to
be_falsey
}
end
end
end
spec/helpers/packages_helper_spec.rb
View file @
2a1259f2
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment