mirror of
https://gitlab.archlinux.org/archlinux/infrastructure.git
synced 2026-03-07 11:31:39 +01:00
We watch over the database paths with a 'systemd.path' unit and invalidate the CDN cached files once the DBs on the origin are changed. Fixes https://gitlab.archlinux.org/archlinux/infrastructure/-/issues/778 Signed-off-by: Christian Heusel <christian@heusel.eu>
35 lines
883 B
Bash
35 lines
883 B
Bash
#!/bin/bash
|
|
|
|
set -o nounset -o errexit
|
|
|
|
if (( $# < 1 )); then
|
|
echo "Missing argument"
|
|
exit 0
|
|
fi
|
|
|
|
if [[ -z "$FASTLY_API_TOKEN" ]]; then
|
|
echo "'\$FASTLY_API_TOKEN' is empty"
|
|
exit 0
|
|
fi
|
|
|
|
FASTLY_MIRROR_URL="https://fastly.mirror.pkgbuild.com"
|
|
|
|
repo=$1
|
|
|
|
URLS=(
|
|
"${FASTLY_MIRROR_URL}/${repo}/os/x86_64/${repo}.db"
|
|
"${FASTLY_MIRROR_URL}/${repo}/os/x86_64/${repo}.db.tar.gz"
|
|
"${FASTLY_MIRROR_URL}/${repo}/os/x86_64/${repo}.db.tar.gz.old"
|
|
|
|
"${FASTLY_MIRROR_URL}/${repo}/os/x86_64/${repo}.files"
|
|
"${FASTLY_MIRROR_URL}/${repo}/os/x86_64/${repo}.files.tar.gz"
|
|
"${FASTLY_MIRROR_URL}/${repo}/os/x86_64/${repo}.files.tar.gz.old"
|
|
|
|
"${FASTLY_MIRROR_URL}/${repo}/os/x86_64/${repo}.links"
|
|
)
|
|
|
|
for URL in "${URLS[@]}"; do
|
|
echo "Purging URL '${URL}'"
|
|
curl --silent --show-error --fail -X PURGE -H @<(echo Fastly-Key: "${FASTLY_API_TOKEN}") "${URL}"
|
|
done
|