Skip to content

Commit 24ccb0a

Browse files
committed
use retry
1 parent 37cb2ec commit 24ccb0a

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

.github/workflows/pr-deploy.yaml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,19 +222,28 @@ jobs:
222222
--namespace "pr${{ env.PR_NUMBER }}" \
223223
--set url="https://pr${{ env.PR_NUMBER }}.${{ secrets.PR_DEPLOYMENTS_DOMAIN }}"
224224
225-
- name: Wait 30 seconds
226-
run: |
227-
sleep 30
228-
229225
- name: Get Coder binary
230226
run: |
231227
set -euxo pipefail
232228
ARCH="$(arch)"
233229
PLATFORM="$(uname | tr '[:upper:]' '[:lower:]')"
234230
DEST="${HOME}/coder"
231+
URL="${{ env.PR_DEPLOYMENT_ACCESS_URL }}/bin/coder-${PLATFORM}-${ARCH}"
235232
236233
mkdir -p "$(dirname ${DEST})"
237-
curl -fsSL "${{ env.PR_DEPLOYMENT_ACCESS_URL }}/bin/coder-${PLATFORM}-${ARCH}" -o "${DEST}"
234+
235+
COUNT=0
236+
until $(curl --output /dev/null --silent --head --fail "$URL"); do
237+
printf '.'
238+
sleep 5
239+
COUNT=$((COUNT+1))
240+
if [ $COUNT -ge 60 ]; then
241+
echo "Timed out waiting for URL to be available"
242+
exit 1
243+
fi
244+
done
245+
246+
curl -fsSL "$URL" -o "${DEST}"
238247
chmod +x "${DEST}"
239248
"${DEST}" version
240249

0 commit comments

Comments
 (0)