Skip to content

Commit efbf5b1

Browse files
authored
ci: retry kubectl download a few times (#412)
Signed-off-by: Andrea Mazzotti <[email protected]>
1 parent 8b180e9 commit efbf5b1

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

justfile

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,18 @@ _download-kubectl: _create-out-dir
328328
set -euxo pipefail
329329
[ -z `which kubectl` ] || [ {{REFRESH_BIN}} != "0" ] || exit 0
330330
cd {{OUT_DIR}}
331-
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/{{ARCH}}/kubectl"
332-
chmod +x kubectl
331+
retries=3
332+
while ((retries > 0)); do
333+
if curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/{{ARCH}}/kubectl"; then
334+
chmod +x kubectl
335+
exit 0
336+
fi
337+
((retries --))
338+
sleep 10s
339+
done
340+
echo "Failed to install kubectl"
341+
exit 1
342+
333343

334344
[private]
335345
[macos]
@@ -338,5 +348,15 @@ _download-kubectl: _create-out-dir
338348
set -euxo pipefail
339349
[ -z `which kubectl` ] || [ {{REFRESH_BIN}} != "0" ] || exit 0
340350
cd {{OUT_DIR}}
341-
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/{{ARCH}}/kubectl"
342-
chmod +x kubectl
351+
retries=3
352+
while ((retries > 0)); do
353+
if curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/{{ARCH}}/kubectl"; then
354+
chmod +x kubectl
355+
exit 0
356+
fi
357+
((retries --))
358+
sleep 10s
359+
done
360+
echo "Failed to install kubectl"
361+
exit 1
362+

0 commit comments

Comments
 (0)