Skip to content

Commit

Permalink
fix remove-unused-istags script
Browse files Browse the repository at this point in the history
Signed-off-by: Robert Cerven <rcerven@redhat.com>
  • Loading branch information
rcerven committed Nov 25, 2020
1 parent 0fb86a9 commit 4b57c2e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions templates/remove-unused-istags.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ autorebuild_imagestream_tags=$(

delete_threshold=$(date --date="7 days ago" --iso-8601=seconds --utc)

# chunk-size=0 is required to get all tags when there is a lot of tags
old_imagestream_tags=$(
$OC get imagestreamtags -o json | \
$OC get imagestreamtags --chunk-size=0 -o json | \
jq '.items[].metadata | select(.creationTimestamp < "'${delete_threshold}'") | .name' -r | \
sort -u
)
Expand All @@ -36,4 +37,4 @@ echo
count=$(wc -l <<<${unwanted_imagestream_tags})
echo "SUMMARY: ${count} ImageStreamTags will be removed"

$OC delete imagestreamtags ${unwanted_imagestream_tags}
echo ${unwanted_imagestream_tags} | xargs -n 10 $OC delete imagestreamtags

0 comments on commit 4b57c2e

Please sign in to comment.