Automated Manifest Update #2767

Merged
alexlebens merged 1 commits from auto/update-manifests into manifests 2025-12-20 22:30:16 +00:00

View File

@@ -11,41 +11,43 @@ data:
prune.sh: | prune.sh: |
DATE_RANGE=$(date -d @$(( $(date +%s) - $DATE_RANGE_SECONDS )) +%Y-%m-%dT%H:%M:%SZ); DATE_RANGE=$(date -d @$(( $(date +%s) - $DATE_RANGE_SECONDS )) +%Y-%m-%dT%H:%M:%SZ);
FILE_MATCH="${BUCKET}/cl01tl/etcd/cl01tl-${DATE_RANGE}.snap.age"; FILE_MATCH="${BUCKET}/cl01tl/etcd/cl01tl-${DATE_RANGE}.snap.age";
ERROR=false ERROR=false;
echo " " echo " ";
echo ">> Running S3 prune for Talos backup repository ${TARGET} ..."; echo ">> Running S3 prune for Talos backup repository ${TARGET} ...";
echo " " echo " ";
echo ">> Configured Date Range is $(date -u -d @${DATE_RANGE_SECONDS} +"%j days, %H hours, %M minutes")" echo ">> Configured Date Range is $(date -u -d @${DATE_RANGE_SECONDS} +"%j days, %H hours, %M minutes")";
echo ">> Backups prior to '$DATE_RANGE' will be removed"; echo ">> Backups prior to '$DATE_RANGE' will be removed";
echo " " echo " ";
echo ">> Backups to be removed:"; echo ">> Backups to be removed:";
s3cmd ls --no-check-certificate ${BUCKET}/cl01tl/etcd/ | $FILES=$(s3cmd ls --no-check-certificate ${BUCKET}/cl01tl/etcd/ |
awk -v file_match="$FILE_MATCH" '$4 < file_match {print $4}'
echo " "
echo ">> Deleting ..."
s3cmd ls --no-check-certificate ${BUCKET}/cl01tl/etcd/ |
awk -v file_match="$FILE_MATCH" '$4 < file_match {print $4}' | awk -v file_match="$FILE_MATCH" '$4 < file_match {print $4}' |
while read file; do grep . | sort -u);
echo "$FILES"
if [ -n "${FILES}" ]; then
echo " ";
echo ">> Deleting ...";
$FILES | while read file; do
s3cmd del --no-check-certificate -v "$file"; s3cmd del --no-check-certificate -v "$file";
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
ERROR=true ERROR=true;
echo ">> Detected error, will send message to ntfy" echo ">> Detected error, will send message to ntfy";
fi fi;
done; done;
fi;
if [ "$ERROR" = true ]; then if [ "$ERROR" = "true" ]; then
MAX_RETRIES=5 MAX_RETRIES=5;
SUCCESS=false SUCCESS=false;
echo " " echo " ";
echo ">> Sending message to ntfy using curl ..." echo ">> Sending message to ntfy using curl ...";
echo " " echo " ";
echo ">> Verifying required commands ..." echo ">> Verifying required commands ...";
for i in $(seq 1 "$MAX_RETRIES"); do for i in $(seq 1 "$MAX_RETRIES"); do
if apk update 2>&1 >/dev/null; then if apk update 2>&1 >/dev/null; then
@@ -74,8 +76,8 @@ data:
fi; fi;
fi; fi;
echo " " echo " ";
echo ">> Sending to NTFY ..." echo ">> Sending to NTFY ...";
HTTP_STATUS=$(curl \ HTTP_STATUS=$(curl \
--silent \ --silent \
--write-out '%{http_code}' \ --write-out '%{http_code}' \
@@ -85,10 +87,10 @@ data:
-H "X-Title: Talos Backup Failed for ${TARGET}" \ -H "X-Title: Talos Backup Failed for ${TARGET}" \
-d "$MESSAGE" \ -d "$MESSAGE" \
${NTFY_ENDPOINT}/${NTFY_TOPIC} ${NTFY_ENDPOINT}/${NTFY_TOPIC}
) );
echo ">> HTTP Status Code: $HTTP_STATUS" echo ">> HTTP Status Code: $HTTP_STATUS";
fi; fi;
echo " " echo " ";
echo ">> Completed S3 prune for Talos backup repository ${TARGET}" echo ">> Completed S3 prune for Talos backup repository ${TARGET}";