Hash check and retry for pictrs binary (#5345)

* Hash check and retry for pictrs binary

* retry limit
This commit is contained in:
Nutomic 2025-01-23 13:05:47 +00:00 committed by GitHub
parent a531e384b1
commit 4e46332bf4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -13,13 +13,25 @@ export RUST_LOG="warn,lemmy_server=$LEMMY_LOG_LEVEL,lemmy_federate=$LEMMY_LOG_LE
export LEMMY_TEST_FAST_FEDERATION=1 # by default, the persistent federation queue has delays in the scale of 30s-5min export LEMMY_TEST_FAST_FEDERATION=1 # by default, the persistent federation queue has delays in the scale of 30s-5min
# pictrs setup PICTRS_PATH="api_tests/pict-rs"
if [ ! -f "api_tests/pict-rs" ]; then PICTRS_EXPECTED_HASH="8feb52c0dee1dd0b41caa0e92afd9d5e597fbb4d7174d7bba22a1ba72fa01dbc pict-rs"
# Pictrs setup. Download file with hash check and up to 3 retries.
if [ ! -f "$PICTRS_PATH" ]; then
retry=true
count=0
while $retry && [ "$count" -lt 3 ]
do
# This one sometimes goes down # This one sometimes goes down
# curl "https://git.asonix.dog/asonix/pict-rs/releases/download/v0.5.16/pict-rs-linux-amd64" -o api_tests/pict-rs # curl "https://git.asonix.dog/asonix/pict-rs/releases/download/v0.5.16/pict-rs-linux-amd64" -o "$PICTRS_PATH"
curl "https://codeberg.org/asonix/pict-rs/releases/download/v0.5.6/pict-rs-linux-amd64" -o api_tests/pict-rs curl "https://codeberg.org/asonix/pict-rs/releases/download/v0.5.5/pict-rs-linux-amd64" -o "$PICTRS_PATH"
chmod +x api_tests/pict-rs PICTRS_HASH=$(sha256sum "$PICTRS_PATH")
[[ "$PICTRS_HASH" != "$PICTRS_EXPECTED_HASH" ]] && retry=true || retry=false
let count=count+1
done
chmod +x "$PICTRS_PATH"
fi fi
./api_tests/pict-rs \ ./api_tests/pict-rs \
run -a 0.0.0.0:8080 \ run -a 0.0.0.0:8080 \
--danger-dummy-mode \ --danger-dummy-mode \