Skip to content

Commit 62151e5

Browse files
committed
check-lts: set +x; repeat curl and error if http json fails
1 parent 62d41ee commit 62151e5

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

build-constraints/check-lts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,24 @@
22

33
# Convenience script for checking constraints locally
44

5-
set -euxo pipefail
5+
set -euo pipefail +x
66

77
cd `dirname $0`
88

99
MAJOR=${1:-23}
10-
LTS=$(curl -s https://www.stackage.org/download/snapshots.json | jq -r '.["lts-'$MAJOR'"]')
10+
LTS=$(curl -f -s https://www.stackage.org/download/snapshots.json | jq -r '.["lts-'$MAJOR'"]')
1111

12-
echo "$LTS"
12+
# sometimes http fails
13+
if [ -z "$LTS" ]; then
14+
LTS=$(curl -f -s https://www.stackage.org/download/snapshots.json | jq -r '.["lts-'$MAJOR'"]')
15+
fi
16+
17+
if [ -z "$LTS" ]; then
18+
echo "failed to read lts minor version 2 times"
19+
exit 1
20+
else
21+
echo "$LTS"
22+
fi
1323

1424
export GHCVER=$(sed -n "s/^ghc-version: \"\(.*\)\"/\1/p" "lts-$MAJOR-build-constraints.yaml")
1525

0 commit comments

Comments
 (0)