Skip to content

Commit 5cceb3f

Browse files
committed
fix(ci): bound openssh setup apt calls
1 parent 188b756 commit 5cceb3f

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

.github/actions/setup/action.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,19 @@ runs:
2424
- name: Install OpenSSH client
2525
shell: bash
2626
run: |
27+
if command -v ssh >/dev/null 2>&1 && command -v ssh-keygen >/dev/null 2>&1; then
28+
echo "OpenSSH client is already installed; skipping apt install"
29+
exit 0
30+
fi
31+
2732
for attempt in 1 2 3; do
2833
sudo rm -rf /var/lib/apt/lists/*
29-
if sudo apt-get -o Acquire::Retries=3 -o Acquire::By-Hash=force update; then
34+
if sudo timeout 120s apt-get \
35+
-o Acquire::Retries=3 \
36+
-o Acquire::By-Hash=force \
37+
-o Acquire::http::Timeout=20 \
38+
-o Acquire::https::Timeout=20 \
39+
update; then
3040
break
3141
fi
3242
if [[ "$attempt" == "3" ]]; then
@@ -36,7 +46,11 @@ runs:
3646
echo "apt-get update attempt ${attempt} failed; retrying..." >&2
3747
sleep $((attempt * 2))
3848
done
39-
sudo apt-get -o Acquire::Retries=3 install -y openssh-client
49+
sudo timeout 120s apt-get \
50+
-o Acquire::Retries=3 \
51+
-o Acquire::http::Timeout=20 \
52+
-o Acquire::https::Timeout=20 \
53+
install -y openssh-client
4054
- name: Install node-gyp
4155
shell: bash
4256
run: npm install -g node-gyp

0 commit comments

Comments
 (0)