Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions images/dvcr-artifact/cmd/dvcr-cleaner/cmd/gc.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,14 @@ func autoCleanupHandler(cmd *cobra.Command, args []string) error {
errs = multierror.Append(errs, cleanupErr)
}

// Testing: sleep and print errors if present.
time.Sleep(time.Second * 30)
err = errs.ErrorOrNil()
if err != nil {
fmt.Printf("Error while cleaning up stale images after cleanup: %v\n", err)
}
// Testing end.

result := map[string]any{
"result": "success",
"startedAt": started,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ func (h LifeCycleHandler) Handle(ctx context.Context, req reconcile.Request, dep
// Put full result JSON into annotation on deployment.
annotations.AddAnnotation(deploy, annotations.AnnDVCRGarbageCollectionResult, h.dvcrService.GetGarbageCollectionResult(secret))
// It is now possible to delete a secret.
return reconcile.Result{}, h.dvcrService.DeleteGarbageCollectionSecret(ctx)
// Test: add delay to catch race condition delete secret -> hook change values -> helm apply new version of deploy/dvcr.
err = h.dvcrService.DeleteGarbageCollectionSecret(ctx)
time.Sleep(time.Second * 10)
return reconcile.Result{}, err
}

if h.dvcrService.IsGarbageCollectionStarted(secret) {
Expand Down
Loading