Skip to content

Commit

Permalink
Merge pull request #24 from fluxcd/reaper-exit-code
Browse files Browse the repository at this point in the history
tools/reaper: fatal when resources are not deleted
  • Loading branch information
darkowlzz authored Nov 9, 2023
2 parents ccce928 + f1c63de commit 0bc20e4
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 0bc20e4

Please sign in to comment.