Skip to content

Commit

Permalink
tools/reaper: fatal when resources are not deleted
Browse files Browse the repository at this point in the history
When resources are found but not deleted, fail to help detect that stale
resources were found but not deleted.

Signed-off-by: Sunny <[email protected]>
  • Loading branch information
darkowlzz committed Nov 3, 2023
1 parent be59e43 commit f1c63de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tools/reaper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ compute.googleapis.com/InstanceTemplate: gke-flux-test-full-dove-default-pool-42
compute.googleapis.com/InstanceTemplate: gke-flux-test-full-dove-default-pool-dcded0bb
container.googleapis.com/Cluster: flux-test-full-dove
artifactregistry.googleapis.com/Repository: projects/darkowlzz-gcp/locations/us-central1/repositories/flux-test-full-dove
2023/11/04 00:49:45 resources found but not deleted
exit status 1
```

JSON output is also supported:
Expand Down
5 changes: 5 additions & 0 deletions tools/reaper/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@ func main() {
}
}
}
} else if !*delete && len(resources) > 0 {
// Exit with non-zero exit code when resources are found but not
// deleted. This is to help detect stale resources when run in CI by
// failing the job.
log.Fatal("resources found but not deleted")
}
}

Expand Down

0 comments on commit f1c63de

Please sign in to comment.