Skip to content

Commit b045bc4

Browse files
chore: use retries for flakey hashicorp go downloads (#247)
Signed-off-by: Mathew Wicks <5735406+thesuperzapper@users.noreply.github.com>
1 parent 3b4bed9 commit b045bc4

2 files changed

Lines changed: 26 additions & 2 deletions

File tree

components/access-management/Dockerfile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,19 @@ RUN go mod edit -replace=github.com/kubeflow/dashboard/components/profile-contro
1919
# Force download and extract all HashiCorp modules so they exist under /go/pkg/mod
2020
RUN set -e; cd /workspace; \
2121
for m in $(go list -m all | awk '/^github.com\/hashicorp\// {print $1 "@" $2}'); do \
22-
go mod download "$m"; \
22+
# download with retry (these downloads are flakey) \
23+
for i in $(seq 1 5); do \
24+
if go mod download "$m"; then \
25+
echo "INFO: Successfully downloaded $m"; \
26+
break; \
27+
fi; \
28+
if [ $i -eq 5 ]; then \
29+
echo "ERROR: Failed to download $m after $i attempts"; \
30+
exit 1; \
31+
fi; \
32+
echo "WARN: Retrying download of $m (attempt $i)"; \
33+
sleep $((i * 2)); \
34+
done; \
2335
pkg="${m%@*}"; \
2436
go list "$pkg/..." >/dev/null 2>&1 || true; \
2537
done

components/profile-controller/Dockerfile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,19 @@ RUN go mod download
1515
# Force download and extract all HashiCorp modules so they exist under /go/pkg/mod
1616
RUN set -e; cd /workspace; \
1717
for m in $(go list -m all | awk '/^github.com\/hashicorp\// {print $1 "@" $2}'); do \
18-
go mod download "$m"; \
18+
# download with retry (these downloads are flakey) \
19+
for i in $(seq 1 5); do \
20+
if go mod download "$m"; then \
21+
echo "INFO: Successfully downloaded $m"; \
22+
break; \
23+
fi; \
24+
if [ $i -eq 5 ]; then \
25+
echo "ERROR: Failed to download $m after $i attempts"; \
26+
exit 1; \
27+
fi; \
28+
echo "WARN: Retrying download of $m (attempt $i)"; \
29+
sleep $((i * 2)); \
30+
done; \
1931
pkg="${m%@*}"; \
2032
go list "$pkg/..." >/dev/null 2>&1 || true; \
2133
done

0 commit comments

Comments
 (0)