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
fed72994
Commit
fed72994
authored
May 26, 2020
by
Steve Abrams
Committed by
Mayra Cabrera
May 26, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update migration to use change
Remove lock retries from migration
parent
4412bcc0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
10 deletions
+42
-10
changelogs/unreleased/218464-expiration-policy-defaults.yml
changelogs/unreleased/218464-expiration-policy-defaults.yml
+5
-0
db/migrate/20200519194042_update_container_expiration_policies_defaults.rb
...19194042_update_container_expiration_policies_defaults.rb
+23
-0
db/structure.sql
db/structure.sql
+4
-3
spec/lib/gitlab/usage_data_spec.rb
spec/lib/gitlab/usage_data_spec.rb
+10
-7
No files found.
changelogs/unreleased/218464-expiration-policy-defaults.yml
0 → 100644
View file @
fed72994
---
title
:
Update container expiration policy database defaults
merge_request
:
32600
author
:
type
:
fixed
db/migrate/20200519194042_update_container_expiration_policies_defaults.rb
0 → 100644
View file @
fed72994
# frozen_string_literal: true
class
UpdateContainerExpirationPoliciesDefaults
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
def
up
with_lock_retries
do
change_column_default
:container_expiration_policies
,
:cadence
,
'1d'
change_column_default
:container_expiration_policies
,
:keep_n
,
10
change_column_default
:container_expiration_policies
,
:older_than
,
'90d'
end
end
def
down
with_lock_retries
do
change_column_default
:container_expiration_policies
,
:cadence
,
'7d'
change_column_default
:container_expiration_policies
,
:keep_n
,
nil
change_column_default
:container_expiration_policies
,
:older_than
,
nil
end
end
end
db/structure.sql
View file @
fed72994
...
...
@@ -1978,9 +1978,9 @@ CREATE TABLE public.container_expiration_policies (
updated_at
timestamp
with
time
zone
NOT
NULL
,
next_run_at
timestamp
with
time
zone
,
name_regex
character
varying
(
255
),
cadence
character
varying
(
12
)
DEFAULT
'
7
d'
::
character
varying
NOT
NULL
,
older_than
character
varying
(
12
),
keep_n
integer
,
cadence
character
varying
(
12
)
DEFAULT
'
1
d'
::
character
varying
NOT
NULL
,
older_than
character
varying
(
12
)
DEFAULT
'90d'
::
character
varying
,
keep_n
integer
DEFAULT
10
,
enabled
boolean
DEFAULT
true
NOT
NULL
,
name_regex_keep
text
,
CONSTRAINT
container_expiration_policies_name_regex_keep
CHECK
((
char_length
(
name_regex_keep
)
<=
255
))
...
...
@@ -13932,6 +13932,7 @@ COPY "schema_migrations" (version) FROM STDIN;
20200515155620
20200519115908
20200519171058
20200519194042
20200525114553
20200525121014
20200526120714
...
...
spec/lib/gitlab/usage_data_spec.rb
View file @
fed72994
...
...
@@ -114,30 +114,33 @@ describe Gitlab::UsageData, :aggregate_failures do
end
end
let_it_be
(
'container_expiration_policy_with_keep_n_set_to_null'
)
{
create
(
:container_expiration_policy
,
keep_n:
nil
)
}
let_it_be
(
'container_expiration_policy_with_older_than_set_to_null'
)
{
create
(
:container_expiration_policy
,
older_than:
nil
)
}
let
(
:inactive_policies
)
{
::
ContainerExpirationPolicy
.
where
(
enabled:
false
)
}
let
(
:active_policies
)
{
::
ContainerExpirationPolicy
.
active
}
subject
{
described_class
.
data
[
:counts
]
}
it
'gathers usage data'
do
expect
(
subject
[
:projects_with_expiration_policy_enabled
]).
to
eq
2
0
expect
(
subject
[
:projects_with_expiration_policy_enabled
]).
to
eq
2
2
expect
(
subject
[
:projects_with_expiration_policy_disabled
]).
to
eq
1
expect
(
subject
[
:projects_with_expiration_policy_enabled_with_keep_n_unset
]).
to
eq
1
4
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_5
]).
to
eq
1
expect
(
subject
[
:projects_with_expiration_policy_enabled_with_keep_n_set_to_10
]).
to
eq
1
expect
(
subject
[
:projects_with_expiration_policy_enabled_with_keep_n_set_to_10
]).
to
eq
1
6
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_older_than_unset
]).
to
eq
1
6
expect
(
subject
[
:projects_with_expiration_policy_enabled_with_older_than_unset
]).
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_30d
]).
to
eq
1
expect
(
subject
[
:projects_with_expiration_policy_enabled_with_older_than_set_to_90d
]).
to
eq
1
expect
(
subject
[
:projects_with_expiration_policy_enabled_with_older_than_set_to_90d
]).
to
eq
1
8
expect
(
subject
[
:projects_with_expiration_policy_enabled_with_cadence_set_to_1d
]).
to
eq
1
2
expect
(
subject
[
:projects_with_expiration_policy_enabled_with_cadence_set_to_7d
]).
to
eq
5
expect
(
subject
[
:projects_with_expiration_policy_enabled_with_cadence_set_to_1d
]).
to
eq
1
8
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_1month
]).
to
eq
1
expect
(
subject
[
:projects_with_expiration_policy_enabled_with_cadence_set_to_3month
]).
to
eq
1
...
...
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