feat: JAR retention policy with nightly cleanup job
Per-environment "keep last N versions" setting (default 5, null for unlimited). Nightly scheduled job at 03:00 deletes old versions from both database and disk, skipping any version that is currently deployed. Full stack: - V6 migration: adds jar_retention_count column to environments - Environment record, repository, service, admin controller endpoint - JarRetentionJob: @Scheduled nightly, iterates environments and apps - UI: retention policy editor on admin Environments page with toggle between limited/unlimited and version count input - AppVersionRepository.delete() for version cleanup Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,7 @@ export interface Environment {
|
||||
production: boolean;
|
||||
enabled: boolean;
|
||||
defaultContainerConfig: Record<string, unknown>;
|
||||
jarRetentionCount: number | null;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
@@ -66,6 +67,18 @@ export function useUpdateDefaultContainerConfig() {
|
||||
});
|
||||
}
|
||||
|
||||
export function useUpdateJarRetention() {
|
||||
const qc = useQueryClient();
|
||||
return useMutation({
|
||||
mutationFn: ({ id, jarRetentionCount }: { id: string; jarRetentionCount: number | null }) =>
|
||||
adminFetch<Environment>(`/environments/${id}/jar-retention`, {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify({ jarRetentionCount }),
|
||||
}),
|
||||
onSuccess: () => qc.invalidateQueries({ queryKey: ['admin', 'environments'] }),
|
||||
});
|
||||
}
|
||||
|
||||
export function useDeleteEnvironment() {
|
||||
const qc = useQueryClient();
|
||||
return useMutation({
|
||||
|
||||
Reference in New Issue
Block a user