Commit ebf49c08 authored by David Fernandez's avatar David Fernandez Committed by Bob Van Landuyt

Add "expiration_policy_completed_at" support in container repositories

parent 59634e60
...@@ -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
......
---
title: Add expiration policy completed at support in container repositories
merge_request: 49924
author:
type: added
# 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
e991bf621a2eb047903f796256ee65b781e5dd34aff12449f2347480bf7791a7
\ No newline at end of file
...@@ -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
......
...@@ -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
......
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