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
ebf49c08
Commit
ebf49c08
authored
Dec 15, 2020
by
David Fernandez
Committed by
Bob Van Landuyt
Dec 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add "expiration_policy_completed_at" support in container repositories
parent
59634e60
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
24 additions
and
2 deletions
+24
-2
app/services/container_expiration_policies/cleanup_service.rb
...services/container_expiration_policies/cleanup_service.rb
+2
-1
changelogs/unreleased/276479-add-expiration_policy_completed_at-to-container-repositories.yml
...iration_policy_completed_at-to-container-repositories.yml
+5
-0
db/migrate/20201214084105_add_expiration_policy_completed_at_to_container_repositories.rb
...piration_policy_completed_at_to_container_repositories.rb
+12
-0
db/schema_migrations/20201214084105
db/schema_migrations/20201214084105
+1
-0
db/structure.sql
db/structure.sql
+2
-1
spec/services/container_expiration_policies/cleanup_service_spec.rb
...ces/container_expiration_policies/cleanup_service_spec.rb
+2
-0
No files found.
app/services/container_expiration_policies/cleanup_service.rb
View file @
ebf49c08
...
@@ -20,7 +20,8 @@ module ContainerExpirationPolicies
...
@@ -20,7 +20,8 @@ module ContainerExpirationPolicies
if
result
[
:status
]
==
:success
if
result
[
:status
]
==
:success
repository
.
update!
(
repository
.
update!
(
expiration_policy_cleanup_status: :cleanup_unscheduled
,
expiration_policy_cleanup_status: :cleanup_unscheduled
,
expiration_policy_started_at:
nil
expiration_policy_started_at:
nil
,
expiration_policy_completed_at:
Time
.
zone
.
now
)
)
success
(
:finished
)
success
(
:finished
)
else
else
...
...
changelogs/unreleased/276479-add-expiration_policy_completed_at-to-container-repositories.yml
0 → 100644
View file @
ebf49c08
---
title
:
Add expiration policy completed at support in container repositories
merge_request
:
49924
author
:
type
:
added
db/migrate/20201214084105_add_expiration_policy_completed_at_to_container_repositories.rb
0 → 100644
View file @
ebf49c08
# frozen_string_literal: true
class
AddExpirationPolicyCompletedAtToContainerRepositories
<
ActiveRecord
::
Migration
[
6.0
]
DOWNTIME
=
false
def
up
add_column
(
:container_repositories
,
:expiration_policy_completed_at
,
:datetime_with_timezone
)
end
def
down
remove_column
(
:container_repositories
,
:expiration_policy_completed_at
)
end
end
db/schema_migrations/20201214084105
0 → 100644
View file @
ebf49c08
e991bf621a2eb047903f796256ee65b781e5dd34aff12449f2347480bf7791a7
\ No newline at end of file
db/structure.sql
View file @
ebf49c08
...
@@ -11432,7 +11432,8 @@ CREATE TABLE container_repositories (
...
@@ -11432,7 +11432,8 @@ CREATE TABLE container_repositories (
updated_at
timestamp
without
time
zone
NOT
NULL
,
updated_at
timestamp
without
time
zone
NOT
NULL
,
status
smallint
,
status
smallint
,
expiration_policy_started_at
timestamp
with
time
zone
,
expiration_policy_started_at
timestamp
with
time
zone
,
expiration_policy_cleanup_status
smallint
DEFAULT
0
NOT
NULL
expiration_policy_cleanup_status
smallint
DEFAULT
0
NOT
NULL
,
expiration_policy_completed_at
timestamp
with
time
zone
);
);
CREATE
SEQUENCE
container_repositories_id_seq
CREATE
SEQUENCE
container_repositories_id_seq
...
...
spec/services/container_expiration_policies/cleanup_service_spec.rb
View file @
ebf49c08
...
@@ -28,6 +28,7 @@ RSpec.describe ContainerExpirationPolicies::CleanupService do
...
@@ -28,6 +28,7 @@ RSpec.describe ContainerExpirationPolicies::CleanupService do
expect
(
ContainerRepository
.
waiting_for_cleanup
.
count
).
to
eq
(
0
)
expect
(
ContainerRepository
.
waiting_for_cleanup
.
count
).
to
eq
(
0
)
expect
(
repository
.
reload
.
cleanup_unscheduled?
).
to
be_truthy
expect
(
repository
.
reload
.
cleanup_unscheduled?
).
to
be_truthy
expect
(
repository
.
expiration_policy_started_at
).
to
eq
(
nil
)
expect
(
repository
.
expiration_policy_started_at
).
to
eq
(
nil
)
expect
(
repository
.
expiration_policy_completed_at
).
not_to
eq
(
nil
)
end
end
end
end
end
end
...
@@ -45,6 +46,7 @@ RSpec.describe ContainerExpirationPolicies::CleanupService do
...
@@ -45,6 +46,7 @@ RSpec.describe ContainerExpirationPolicies::CleanupService do
expect
(
ContainerRepository
.
waiting_for_cleanup
.
count
).
to
eq
(
1
)
expect
(
ContainerRepository
.
waiting_for_cleanup
.
count
).
to
eq
(
1
)
expect
(
repository
.
reload
.
cleanup_unfinished?
).
to
be_truthy
expect
(
repository
.
reload
.
cleanup_unfinished?
).
to
be_truthy
expect
(
repository
.
expiration_policy_started_at
).
not_to
eq
(
nil
)
expect
(
repository
.
expiration_policy_started_at
).
not_to
eq
(
nil
)
expect
(
repository
.
expiration_policy_completed_at
).
to
eq
(
nil
)
end
end
end
end
end
end
...
...
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