PREQ-5729: fix argument list too long in cache cleanup#61
Conversation
Pass delete JSON via file:// instead of inline argument to avoid exceeding ARG_MAX on repos with large caches (e.g. 1 TB+).
SummaryThis PR fixes the What changed:
This is a minimal, mechanical change that preserves all existing logic—only the mechanism for passing the JSON changes. What reviewers should knowStart here: Look at the Key implementation details:
Why this works: The AWS CLI's Testing note: The fix enables cleanup on repos with huge caches (1 TB+) where the argument size was previously exceeded.
|
Extend the EXIT trap to cover DELETE_FILE so it gets cleaned up even if jq or another command fails mid-loop under set -e. Reset DELETE_FILE after each successful rm to avoid stale paths.
|
|



Summary
Argument list too longerror when running cache cleanup on repos with large caches (e.g. sonar-enterprise with 1 TB+ cache)file://URI instead of inline shell argument, avoiding OSARG_MAXlimitsRoot cause
aws s3api delete-objects --delete "$DELETE_JSON"passes the entire JSON blob as a process argument. When S3 keys are long and there are up to 1000 per batch, this exceeds the kernel argument size limit (~2 MB on Linux).Fix
Use
file://as documented by AWS CLI:Test plan
Argument list too longerror