Skip to content

Commit 56a75a8

Browse files
authored
Merge pull request #172 from snyk/fix/curl-timeout
fix: add curl timeout and more logs
2 parents e866adb + 56d95e8 commit 56a75a8

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

scripts/publish-gh-pages.sh

+7-5
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,21 @@ git commit -m "${COMMIT_MESSAGE}"
4242
git push --quiet --set-upstream origin-pages gh-pages
4343

4444
# Wait up to 10 minutes for the new GH pages
45-
echo waiting for the new release to appear in github
46-
attempts=60
45+
echo "waiting for the new release to appear in github"
46+
attempts=6
4747
sleep_time=10
4848
for (( i=0; i<${attempts}; i++ )); do
4949
# Notice we must use "|| :" at the end of grep because when it doesn't find a match
5050
# it returns an exit code 1, which trips this script (it has "set -e").
51-
count=$(curl -s https://snyk.github.io/kubernetes-monitor/snyk-monitor/values.yaml | grep --line-buffered -c "tag: ${NEW_TAG}" || :)
51+
curl_response=$(curl -s --connect-timeout 10 --max-time 10 https://snyk.github.io/kubernetes-monitor/snyk-monitor/values.yaml)
52+
count=$(echo "$curl_response" | grep --line-buffered -c "tag: ${NEW_TAG}" || :)
5253
if [[ "$count" == "1" ]]; then
53-
attempts=${i}
54+
echo "ok, tag is updated, made $(( $i + 1 )) attempt(s)"
5455
break
5556
fi
57+
echo "attempt ${i}: did not find the expected tag ${NEW_TAG}, here is what curl returned"
58+
echo "$curl_response"
5659
sleep $sleep_time
5760
done
58-
echo it took github $(( $attempts * $sleep_time )) seconds to update the github pages
5961

6062
./scripts/slack-notify-push.sh "gh-pages"

0 commit comments

Comments
 (0)