mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
fix(cache): handle empty cache gracefully in [ci-clear-cache]
When [ci-clear-cache] is used but no cache exists yet, grep returns exit code 1 which causes script failure with set -e. Add || echo "0" to handle case where no deltas exist to delete.
This commit is contained in:
@@ -106,7 +106,7 @@ runs:
|
|||||||
|
|
||||||
# Delete all delta layers for this key
|
# Delete all delta layers for this key
|
||||||
echo "Deleting all delta layers matching: ${CACHE_KEY}-delta-*"
|
echo "Deleting all delta layers matching: ${CACHE_KEY}-delta-*"
|
||||||
DELTA_COUNT=$(aws s3 ls "s3://${S3_BUCKET}/" --region "${S3_REGION}" | grep "${CACHE_KEY}-delta-" | wc -l)
|
DELTA_COUNT=$(aws s3 ls "s3://${S3_BUCKET}/" --region "${S3_REGION}" | grep "${CACHE_KEY}-delta-" | wc -l || echo "0")
|
||||||
if [ "${DELTA_COUNT}" -gt 0 ]; then
|
if [ "${DELTA_COUNT}" -gt 0 ]; then
|
||||||
aws s3 rm "s3://${S3_BUCKET}/" --recursive \
|
aws s3 rm "s3://${S3_BUCKET}/" --recursive \
|
||||||
--exclude "*" \
|
--exclude "*" \
|
||||||
|
|||||||
Reference in New Issue
Block a user