Skip to content

Commit 62981e0

Browse files
authored
Merge pull request #64 from vlsi/windows-choco-install-retry
Retry choco install on Windows to absorb transient download failures
2 parents 41a676a + 7a5e123 commit 62981e0

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

action.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,26 @@ runs:
7474
echo "$name=" >> $GITHUB_ENV
7575
done
7676
77-
choco install postgresql$INPUT_POSTGRES_VERSION \
78-
--params "/Password:$INPUT_PASSWORD" \
79-
--ia "--enable-components server,commandlinetools --extract-only 1" \
80-
--no-progress
77+
# Chocolatey downloads the PostgreSQL installer from
78+
# get.enterprisedb.com, which intermittently responds with HTTP 403
79+
# and aborts the install. Retry a few times to absorb such transient
80+
# download failures.
81+
for attempt in 1 2 3; do
82+
if choco install postgresql$INPUT_POSTGRES_VERSION \
83+
--params "/Password:$INPUT_PASSWORD" \
84+
--ia "--enable-components server,commandlinetools --extract-only 1" \
85+
--no-progress; then
86+
break
87+
fi
88+
89+
if [ "$attempt" -eq 3 ]; then
90+
echo "::error::Failed to install PostgreSQL after $attempt attempts."
91+
exit 1
92+
fi
93+
94+
echo "::warning::choco install failed (attempt $attempt), retrying in 15s..."
95+
sleep 15
96+
done
8197
8298
PG_BINDIR=$("$PROGRAMFILES/PostgreSQL/$INPUT_POSTGRES_VERSION/bin/pg_config.exe" --bindir)
8399
PG_LIBDIR=$("$PROGRAMFILES/PostgreSQL/$INPUT_POSTGRES_VERSION/bin/pg_config.exe" --libdir)

0 commit comments

Comments
 (0)