fix(ci): retry go module download in env image
This commit is contained in:
@@ -884,8 +884,9 @@ function envReuseDockerfile(baseImage, labels = [], recipe, service = null) {
|
||||
["GOPROXY", goProxy],
|
||||
["GOTOOLCHAIN", normalizedRecipe.goToolchain || "local"]
|
||||
]) : "";
|
||||
const goDownloadRetryScript = `retry_go_mod_download() { attempts=6; n=1; while ! go mod download; do if [ "$n" -ge "$attempts" ]; then return 1; fi; echo "go mod download attempt $n/$attempts failed; retrying" >&2; n=$((n + 1)); sleep 5; done; }`;
|
||||
const goDownloadScript = goCacheEnabled
|
||||
? `RUN ${downloadEnvPrefix}${goBuildEnvPrefix}set -eu; mkdir -p ${shellQuote(normalizedRecipe.runtimeGoModCachePath)} ${shellQuote(normalizedRecipe.runtimeGoBuildCachePath)}; go mod download`
|
||||
? `RUN ${downloadEnvPrefix}${goBuildEnvPrefix}set -eu; mkdir -p ${shellQuote(normalizedRecipe.runtimeGoModCachePath)} ${shellQuote(normalizedRecipe.runtimeGoBuildCachePath)}; ${goDownloadRetryScript}; retry_go_mod_download`
|
||||
: null;
|
||||
const goReadiness = goCacheEnabled
|
||||
? `; mkdir -p ${shellQuote(normalizedRecipe.runtimeGoModCachePath)} ${shellQuote(normalizedRecipe.runtimeGoBuildCachePath)}; command -v go >/dev/null; go version >/tmp/hwlab-env-go-version.txt`
|
||||
|
||||
Reference in New Issue
Block a user