Wrap temp deletion err #2277

This commit is contained in:
Cody Rose 2024-01-08 12:48:58 -05:00 committed by GitHub
parent 6b8573d3ea
commit fd8e5e9df6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -100,13 +100,14 @@ func CleanTempArtifacts(ctx logContext.Context) error {
if shouldDelete {
path := filepath.Join(tempDir, entry.Name())
if entry.IsDir() {
isDir := entry.IsDir()
if isDir {
err = os.RemoveAll(path)
} else {
err = os.Remove(path)
}
if err != nil {
return fmt.Errorf("error deleting temp artifact: %s", path)
return fmt.Errorf("error deleting temp artifact (dir: %v) %s: %w", isDir, path, err)
}
ctx.Logger().V(4).Info("Deleted orphaned temp artifact", "artifact", path)