mirror of
https://github.com/goharbor/harbor.git
synced 2025-02-03 05:21:38 +01:00
add details for gc dry-run (#19050)
* add details for gc dry-run fixes 19040 Gives the make details for the dry-run Signed-off-by: wang yan <wangyan@vmware.com> * Update details column for gc history (#164) 1.Fixes #19038 Signed-off-by: AllForNothing <sshijun@vmware.com> --------- Signed-off-by: wang yan <wangyan@vmware.com> Signed-off-by: AllForNothing <sshijun@vmware.com> Co-authored-by: Shijun Sun <30999793+AllForNothing@users.noreply.github.com>
This commit is contained in:
parent
ae33dbd801
commit
638c26c41a
@ -230,6 +230,9 @@ func (gc *GarbageCollector) mark(ctx job.Context) error {
|
||||
blobs = append(blobs, orphanBlobs...)
|
||||
}
|
||||
if len(blobs) == 0 {
|
||||
if err := saveGCRes(ctx, int64(0), int64(0), int64(0)); err != nil {
|
||||
gc.logger.Errorf("failed to save the garbage collection results, errMsg=%v", err)
|
||||
}
|
||||
gc.logger.Info("no need to execute GC as there is no non referenced artifacts.")
|
||||
return nil
|
||||
}
|
||||
@ -269,6 +272,12 @@ func (gc *GarbageCollector) mark(ctx job.Context) error {
|
||||
}
|
||||
gc.logger.Infof("%d blobs and %d manifests eligible for deletion", blobCt, mfCt)
|
||||
gc.logger.Infof("The GC could free up %d MB space, the size is a rough estimation.", makeSize/1024/1024)
|
||||
|
||||
if gc.dryRun {
|
||||
if err := saveGCRes(ctx, makeSize, int64(blobCt), int64(mfCt)); err != nil {
|
||||
gc.logger.Errorf("failed to save the garbage collection results, errMsg=%v", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -52,54 +52,26 @@
|
||||
job.job_status.toUpperCase() | translate
|
||||
}}</clr-dg-cell>
|
||||
<clr-dg-cell>
|
||||
<div>
|
||||
<span
|
||||
*ngIf="
|
||||
getBlobs(job?.job_parameters) &&
|
||||
getManifest(job?.job_parameters)
|
||||
"
|
||||
>{{
|
||||
'GC.DELETE_BLOB_AND_MANIFEST'
|
||||
| translate
|
||||
: {
|
||||
blob: getBlobs(job?.job_parameters),
|
||||
manifest: getManifest(job?.job_parameters)
|
||||
}
|
||||
}}</span
|
||||
>
|
||||
<span
|
||||
*ngIf="
|
||||
getBlobs(job?.job_parameters) &&
|
||||
!getManifest(job?.job_parameters)
|
||||
"
|
||||
>{{
|
||||
'GC.DELETE_BLOB'
|
||||
| translate
|
||||
: {
|
||||
blob: getBlobs(job?.job_parameters),
|
||||
}
|
||||
}}</span
|
||||
>
|
||||
<span
|
||||
*ngIf="
|
||||
!getBlobs(job?.job_parameters) &&
|
||||
getManifest(job?.job_parameters)
|
||||
"
|
||||
>{{
|
||||
'GC.DELETE_MANIFEST'
|
||||
| translate
|
||||
: {
|
||||
manifest: getManifest(job?.job_parameters)
|
||||
}
|
||||
}}</span
|
||||
>
|
||||
</div>
|
||||
<div *ngIf="getSize(job?.job_parameters)">
|
||||
{{
|
||||
'GC.FREE_UP_SIZE'
|
||||
| translate : { size: getSize(job?.job_parameters) }
|
||||
}}
|
||||
</div>
|
||||
<ng-container *ngIf="shouldShowDetails(job?.job_status)">
|
||||
<span *ngIf="isDryRun(job?.job_parameters) === NO">{{
|
||||
'GC.DELETE_DETAIL'
|
||||
| translate
|
||||
: {
|
||||
blob: getBlobs(job?.job_parameters),
|
||||
manifest: getManifest(job?.job_parameters),
|
||||
size: getSize(job?.job_parameters)
|
||||
}
|
||||
}}</span>
|
||||
<span *ngIf="isDryRun(job?.job_parameters) === YES">{{
|
||||
'GC.DELETE_DETAIL_DRY_RUN'
|
||||
| translate
|
||||
: {
|
||||
blob: getBlobs(job?.job_parameters),
|
||||
manifest: getManifest(job?.job_parameters),
|
||||
size: getSize(job?.job_parameters)
|
||||
}
|
||||
}}</span>
|
||||
</ng-container>
|
||||
</clr-dg-cell>
|
||||
<clr-dg-cell>{{
|
||||
job.creation_time | harborDatetime : 'medium'
|
||||
|
@ -46,6 +46,8 @@ export class GcHistoryComponent implements OnInit, OnDestroy {
|
||||
selectedRow: GCHistory[] = [];
|
||||
isStopOnGoing: boolean = false;
|
||||
subscription: Subscription;
|
||||
protected readonly NO = NO;
|
||||
protected readonly YES = YES;
|
||||
constructor(
|
||||
private gcService: GcService,
|
||||
private errorHandler: ErrorHandler,
|
||||
@ -154,6 +156,8 @@ export class GcHistoryComponent implements OnInit, OnDestroy {
|
||||
item2.job_status = item.job_status;
|
||||
item2.update_time =
|
||||
item.update_time;
|
||||
item2.job_parameters =
|
||||
item.job_parameters;
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -230,7 +234,7 @@ export class GcHistoryComponent implements OnInit, OnDestroy {
|
||||
return formatSize(paramObj.freed_space);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return '0';
|
||||
}
|
||||
|
||||
getLogLink(id): string {
|
||||
@ -265,4 +269,8 @@ export class GcHistoryComponent implements OnInit, OnDestroy {
|
||||
);
|
||||
this.confirmationDialogService.openComfirmDialog(StopExecutionsMessage);
|
||||
}
|
||||
|
||||
shouldShowDetails(status: string): boolean {
|
||||
return status !== JOB_STATUS.PENDING && status !== JOB_STATUS.RUNNING;
|
||||
}
|
||||
}
|
||||
|
@ -1233,10 +1233,8 @@
|
||||
"EXPLAIN": "Speicherbereinigung (Garbage Collection / GC) ist eine rechenintensive Operation, die die Registry-Leistung beeinflussen kann",
|
||||
"EXPLAIN_TIME_WINDOW": "Artifacts uploaded in the past 2 hours(the default window) are excluded from garbage collection",
|
||||
"DRY_RUN_SUCCESS": "Probelauf erfolgreich gestartet",
|
||||
"DELETE_BLOB_AND_MANIFEST": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted",
|
||||
"DELETE_BLOB": "{{blob}} blob(s) deleted",
|
||||
"DELETE_MANIFEST": "{{manifest}} manifest(s) deleted",
|
||||
"FREE_UP_SIZE": "{{size}} space freed up",
|
||||
"DELETE_DETAIL": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted, {{size}} space freed up",
|
||||
"DELETE_DETAIL_DRY_RUN": "{{blob}} blob(s) and {{manifest}} manifest(s) could be deleted, {{size}} space could be freed up",
|
||||
"WORKERS_TOOLTIP": "Set the number of workers that can execute GC tasks in parallel, the default value is 1."
|
||||
},
|
||||
"RETAG": {
|
||||
|
@ -1234,10 +1234,8 @@
|
||||
"EXPLAIN": "GC is a compute intensive operation that may impact registry performance",
|
||||
"EXPLAIN_TIME_WINDOW": "Artifacts uploaded in the past 2 hours(the default window) are excluded from garbage collection",
|
||||
"DRY_RUN_SUCCESS": "Triggered dry run successfully",
|
||||
"DELETE_BLOB_AND_MANIFEST": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted",
|
||||
"DELETE_BLOB": "{{blob}} blob(s) deleted",
|
||||
"DELETE_MANIFEST": "{{manifest}} manifest(s) deleted",
|
||||
"FREE_UP_SIZE": "{{size}} space freed up",
|
||||
"DELETE_DETAIL": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted, {{size}} space freed up",
|
||||
"DELETE_DETAIL_DRY_RUN": "{{blob}} blob(s) and {{manifest}} manifest(s) could be deleted, {{size}} space could be freed up",
|
||||
"WORKERS_TOOLTIP": "Set the number of workers that can execute GC tasks in parallel, the default value is 1."
|
||||
},
|
||||
"RETAG": {
|
||||
|
@ -1230,10 +1230,8 @@
|
||||
"EXPLAIN": "GC is a compute intensive operation that may impact registry performance",
|
||||
"EXPLAIN_TIME_WINDOW": "Artifacts uploaded in the past 2 hours(the default window) are excluded from garbage collection",
|
||||
"DRY_RUN_SUCCESS": "Triggered dry run successfully",
|
||||
"DELETE_BLOB_AND_MANIFEST": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted",
|
||||
"DELETE_BLOB": "{{blob}} blob(s) deleted",
|
||||
"DELETE_MANIFEST": "{{manifest}} manifest(s) deleted",
|
||||
"FREE_UP_SIZE": "{{size}} space freed up",
|
||||
"DELETE_DETAIL": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted, {{size}} space freed up",
|
||||
"DELETE_DETAIL_DRY_RUN": "{{blob}} blob(s) and {{manifest}} manifest(s) could be deleted, {{size}} space could be freed up",,
|
||||
"WORKERS_TOOLTIP": "Set the number of workers that can execute GC tasks in parallel, the default value is 1."
|
||||
},
|
||||
"RETAG": {
|
||||
|
@ -1200,10 +1200,8 @@
|
||||
"EXPLAIN": "GC est une opération gourmande en puissance de calcul qui peut impacter les performances du registre",
|
||||
"EXPLAIN_TIME_WINDOW": "Artifacts uploaded in the past 2 hours(the default window) are excluded from garbage collection",
|
||||
"DRY_RUN_SUCCESS": "Exécution à blanc déclenchée avec succès",
|
||||
"DELETE_BLOB_AND_MANIFEST": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted",
|
||||
"DELETE_BLOB": "{{blob}} blob(s) deleted",
|
||||
"DELETE_MANIFEST": "{{manifest}} manifest(s) deleted",
|
||||
"FREE_UP_SIZE": "{{size}} space freed up",
|
||||
"DELETE_DETAIL": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted, {{size}} space freed up",
|
||||
"DELETE_DETAIL_DRY_RUN": "{{blob}} blob(s) and {{manifest}} manifest(s) could be deleted, {{size}} space could be freed up",
|
||||
"WORKERS_TOOLTIP": "Set the number of workers that can execute GC tasks in parallel, the default value is 1."
|
||||
},
|
||||
"RETAG": {
|
||||
|
@ -1230,10 +1230,8 @@
|
||||
"EXPLAIN": "A limpeza exige recursos computacionais e pode impactar performance.",
|
||||
"EXPLAIN_TIME_WINDOW": "Artifacts uploaded in the past 2 hours(the default window) are excluded from garbage collection",
|
||||
"DRY_RUN_SUCCESS": "Teste executado com sucesso",
|
||||
"DELETE_BLOB_AND_MANIFEST": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted",
|
||||
"DELETE_BLOB": "{{blob}} blob(s) deleted",
|
||||
"DELETE_MANIFEST": "{{manifest}} manifest(s) deleted",
|
||||
"FREE_UP_SIZE": "{{size}} space freed up",
|
||||
"DELETE_DETAIL": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted, {{size}} space freed up",
|
||||
"DELETE_DETAIL_DRY_RUN": "{{blob}} blob(s) and {{manifest}} manifest(s) could be deleted, {{size}} space could be freed up",
|
||||
"WORKERS_TOOLTIP": "Set the number of workers that can execute GC tasks in parallel, the default value is 1."
|
||||
},
|
||||
"RETAG": {
|
||||
|
@ -1233,10 +1233,8 @@
|
||||
"EXPLAIN": "GC is a compute intensive operation that may impact registry performance",
|
||||
"EXPLAIN_TIME_WINDOW": "Artifacts uploaded in the past 2 hours(the default window) are excluded from garbage collection",
|
||||
"DRY_RUN_SUCCESS": "Triggered dry run successfully",
|
||||
"DELETE_BLOB_AND_MANIFEST": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted",
|
||||
"DELETE_BLOB": "{{blob}} blob(s) deleted",
|
||||
"DELETE_MANIFEST": "{{manifest}} manifest(s) deleted",
|
||||
"FREE_UP_SIZE": "{{size}} space freed up",
|
||||
"DELETE_DETAIL": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted, {{size}} space freed up",
|
||||
"DELETE_DETAIL_DRY_RUN": "{{blob}} blob(s) and {{manifest}} manifest(s) could be deleted, {{size}} space could be freed up",
|
||||
"WORKERS_TOOLTIP": "Set the number of workers that can execute GC tasks in parallel, the default value is 1."
|
||||
},
|
||||
"RETAG": {
|
||||
|
@ -1230,10 +1230,8 @@
|
||||
"EXPLAIN": "垃圾回收是一个计算密集型操作,可能会影响仓库性能",
|
||||
"EXPLAIN_TIME_WINDOW": "在最近的两小时(默认窗口期)内被推送的 Artifacts 不会被当做垃圾回收的目标",
|
||||
"DRY_RUN_SUCCESS": "触发模拟运行成功",
|
||||
"DELETE_BLOB_AND_MANIFEST": "{{blob}}个 blob(s) 和 {{manifest}}个 manifest(s) 已删除",
|
||||
"DELETE_BLOB": "{{blob}}个 blob(s) 已删除",
|
||||
"DELETE_MANIFEST": "{{manifest}}个 manifest(s) 已删除",
|
||||
"FREE_UP_SIZE": "{{size}}的空间已清理",
|
||||
"DELETE_DETAIL": "{{blob}}个 blob(s) 和 {{manifest}}个 manifest(s) 已删除,{{size}}的空间已清理",
|
||||
"DELETE_DETAIL_DRY_RUN": "{{blob}}个 blob(s) 和 {{manifest}}个 manifest(s) 将被删除,{{size}}的空间将被清理",
|
||||
"WORKERS_TOOLTIP": "设置可并行执行垃圾回收任务的工作者数量,默认值为1。"
|
||||
},
|
||||
"RETAG": {
|
||||
|
@ -1222,10 +1222,8 @@
|
||||
"EXPLAIN": "清理垃圾是一個計算密集的操作,可能影響註冊表的效能",
|
||||
"EXPLAIN_TIME_WINDOW": "Artifacts uploaded in the past 2 hours(the default window) are excluded from garbage collection",
|
||||
"DRY_RUN_SUCCESS": "成功觸發測試執行",
|
||||
"DELETE_BLOB_AND_MANIFEST": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted",
|
||||
"DELETE_BLOB": "{{blob}} blob(s) deleted",
|
||||
"DELETE_MANIFEST": "{{manifest}} manifest(s) deleted",
|
||||
"FREE_UP_SIZE": "{{size}} space freed up",
|
||||
"DELETE_DETAIL": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted, {{size}} space freed up",
|
||||
"DELETE_DETAIL_DRY_RUN": "{{blob}} blob(s) and {{manifest}} manifest(s) could be deleted, {{size}} space could be freed up",
|
||||
"WORKERS_TOOLTIP": "Set the number of workers that can execute GC tasks in parallel, the default value is 1."
|
||||
},
|
||||
"RETAG": {
|
||||
|
Loading…
Reference in New Issue
Block a user