Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't download nodeup if already in the AMI #11524

Merged
merged 2 commits into from
May 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions pkg/model/resources/nodeup.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,20 @@ function ensure-install-dir() {
cd ${INSTALL_DIR}
}

# Retry a download until we get it. args: name, sha, url1, url2...
# Retry a download until we get it. args: name, sha, urls
download-or-bust() {
local -r file="$1"
local -r hash="$2"
shift 2
local -r urls=( $(split-commas "$3") )

if [[ -f "${file}" ]]; then
if ! validate-hash "${file}" "${hash}"; then
rm -f "${file}"
else
return
fi
fi

urls=( $* )
while true; do
for url in "${urls[@]}"; do
commands=(
Expand Down Expand Up @@ -105,15 +112,6 @@ function split-commas() {
echo $1 | tr "," "\n"
}

function try-download-release() {
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )

echo "Downloading nodeup (${nodeup_urls[@]})"
download-or-bust nodeup "${NODEUP_HASH}" "${nodeup_urls[@]}"

chmod +x nodeup
}

function download-release() {
case "$(uname -m)" in
x86_64*|i?86_64*|amd64*)
Expand All @@ -131,7 +129,9 @@ function download-release() {
esac

cd ${INSTALL_DIR}/bin
try-download-release
download-or-bust nodeup "${NODEUP_HASH}" "${NODEUP_URL}"

chmod +x nodeup

echo "Running nodeup"
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
Expand Down
26 changes: 13 additions & 13 deletions pkg/model/tests/data/bootstrapscript_0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,20 @@ function ensure-install-dir() {
cd ${INSTALL_DIR}
}

# Retry a download until we get it. args: name, sha, url1, url2...
# Retry a download until we get it. args: name, sha, urls
download-or-bust() {
local -r file="$1"
local -r hash="$2"
shift 2
local -r urls=( $(split-commas "$3") )

if [[ -f "${file}" ]]; then
if ! validate-hash "${file}" "${hash}"; then
rm -f "${file}"
else
return
fi
fi

urls=( $* )
while true; do
for url in "${urls[@]}"; do
commands=(
Expand Down Expand Up @@ -95,15 +102,6 @@ function split-commas() {
echo $1 | tr "," "\n"
}

function try-download-release() {
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )

echo "Downloading nodeup (${nodeup_urls[@]})"
download-or-bust nodeup "${NODEUP_HASH}" "${nodeup_urls[@]}"

chmod +x nodeup
}

function download-release() {
case "$(uname -m)" in
x86_64*|i?86_64*|amd64*)
Expand All @@ -121,7 +119,9 @@ function download-release() {
esac

cd ${INSTALL_DIR}/bin
try-download-release
download-or-bust nodeup "${NODEUP_HASH}" "${NODEUP_URL}"

chmod +x nodeup

echo "Running nodeup"
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
Expand Down
26 changes: 13 additions & 13 deletions pkg/model/tests/data/bootstrapscript_1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,20 @@ function ensure-install-dir() {
cd ${INSTALL_DIR}
}

# Retry a download until we get it. args: name, sha, url1, url2...
# Retry a download until we get it. args: name, sha, urls
download-or-bust() {
local -r file="$1"
local -r hash="$2"
shift 2
local -r urls=( $(split-commas "$3") )

if [[ -f "${file}" ]]; then
if ! validate-hash "${file}" "${hash}"; then
rm -f "${file}"
else
return
fi
fi

urls=( $* )
while true; do
for url in "${urls[@]}"; do
commands=(
Expand Down Expand Up @@ -95,15 +102,6 @@ function split-commas() {
echo $1 | tr "," "\n"
}

function try-download-release() {
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )

echo "Downloading nodeup (${nodeup_urls[@]})"
download-or-bust nodeup "${NODEUP_HASH}" "${nodeup_urls[@]}"

chmod +x nodeup
}

function download-release() {
case "$(uname -m)" in
x86_64*|i?86_64*|amd64*)
Expand All @@ -121,7 +119,9 @@ function download-release() {
esac

cd ${INSTALL_DIR}/bin
try-download-release
download-or-bust nodeup "${NODEUP_HASH}" "${NODEUP_URL}"

chmod +x nodeup

echo "Running nodeup"
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
Expand Down
26 changes: 13 additions & 13 deletions pkg/model/tests/data/bootstrapscript_2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,20 @@ function ensure-install-dir() {
cd ${INSTALL_DIR}
}

# Retry a download until we get it. args: name, sha, url1, url2...
# Retry a download until we get it. args: name, sha, urls
download-or-bust() {
local -r file="$1"
local -r hash="$2"
shift 2
local -r urls=( $(split-commas "$3") )

if [[ -f "${file}" ]]; then
if ! validate-hash "${file}" "${hash}"; then
rm -f "${file}"
else
return
fi
fi

urls=( $* )
while true; do
for url in "${urls[@]}"; do
commands=(
Expand Down Expand Up @@ -95,15 +102,6 @@ function split-commas() {
echo $1 | tr "," "\n"
}

function try-download-release() {
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )

echo "Downloading nodeup (${nodeup_urls[@]})"
download-or-bust nodeup "${NODEUP_HASH}" "${nodeup_urls[@]}"

chmod +x nodeup
}

function download-release() {
case "$(uname -m)" in
x86_64*|i?86_64*|amd64*)
Expand All @@ -121,7 +119,9 @@ function download-release() {
esac

cd ${INSTALL_DIR}/bin
try-download-release
download-or-bust nodeup "${NODEUP_HASH}" "${NODEUP_URL}"

chmod +x nodeup

echo "Running nodeup"
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
Expand Down
26 changes: 13 additions & 13 deletions pkg/model/tests/data/bootstrapscript_3.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,20 @@ function ensure-install-dir() {
cd ${INSTALL_DIR}
}

# Retry a download until we get it. args: name, sha, url1, url2...
# Retry a download until we get it. args: name, sha, urls
download-or-bust() {
local -r file="$1"
local -r hash="$2"
shift 2
local -r urls=( $(split-commas "$3") )

if [[ -f "${file}" ]]; then
if ! validate-hash "${file}" "${hash}"; then
rm -f "${file}"
else
return
fi
fi

urls=( $* )
while true; do
for url in "${urls[@]}"; do
commands=(
Expand Down Expand Up @@ -95,15 +102,6 @@ function split-commas() {
echo $1 | tr "," "\n"
}

function try-download-release() {
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )

echo "Downloading nodeup (${nodeup_urls[@]})"
download-or-bust nodeup "${NODEUP_HASH}" "${nodeup_urls[@]}"

chmod +x nodeup
}

function download-release() {
case "$(uname -m)" in
x86_64*|i?86_64*|amd64*)
Expand All @@ -121,7 +119,9 @@ function download-release() {
esac

cd ${INSTALL_DIR}/bin
try-download-release
download-or-bust nodeup "${NODEUP_HASH}" "${NODEUP_URL}"

chmod +x nodeup

echo "Running nodeup"
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
Expand Down
26 changes: 13 additions & 13 deletions pkg/model/tests/data/bootstrapscript_4.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,20 @@ function ensure-install-dir() {
cd ${INSTALL_DIR}
}

# Retry a download until we get it. args: name, sha, url1, url2...
# Retry a download until we get it. args: name, sha, urls
download-or-bust() {
local -r file="$1"
local -r hash="$2"
shift 2
local -r urls=( $(split-commas "$3") )

if [[ -f "${file}" ]]; then
if ! validate-hash "${file}" "${hash}"; then
rm -f "${file}"
else
return
fi
fi

urls=( $* )
while true; do
for url in "${urls[@]}"; do
commands=(
Expand Down Expand Up @@ -95,15 +102,6 @@ function split-commas() {
echo $1 | tr "," "\n"
}

function try-download-release() {
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )

echo "Downloading nodeup (${nodeup_urls[@]})"
download-or-bust nodeup "${NODEUP_HASH}" "${nodeup_urls[@]}"

chmod +x nodeup
}

function download-release() {
case "$(uname -m)" in
x86_64*|i?86_64*|amd64*)
Expand All @@ -121,7 +119,9 @@ function download-release() {
esac

cd ${INSTALL_DIR}/bin
try-download-release
download-or-bust nodeup "${NODEUP_HASH}" "${NODEUP_URL}"

chmod +x nodeup

echo "Running nodeup"
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
Expand Down
26 changes: 13 additions & 13 deletions pkg/model/tests/data/bootstrapscript_5.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,20 @@ function ensure-install-dir() {
cd ${INSTALL_DIR}
}

# Retry a download until we get it. args: name, sha, url1, url2...
# Retry a download until we get it. args: name, sha, urls
download-or-bust() {
local -r file="$1"
local -r hash="$2"
shift 2
local -r urls=( $(split-commas "$3") )

if [[ -f "${file}" ]]; then
if ! validate-hash "${file}" "${hash}"; then
rm -f "${file}"
else
return
fi
fi

urls=( $* )
while true; do
for url in "${urls[@]}"; do
commands=(
Expand Down Expand Up @@ -95,15 +102,6 @@ function split-commas() {
echo $1 | tr "," "\n"
}

function try-download-release() {
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )

echo "Downloading nodeup (${nodeup_urls[@]})"
download-or-bust nodeup "${NODEUP_HASH}" "${nodeup_urls[@]}"

chmod +x nodeup
}

function download-release() {
case "$(uname -m)" in
x86_64*|i?86_64*|amd64*)
Expand All @@ -121,7 +119,9 @@ function download-release() {
esac

cd ${INSTALL_DIR}/bin
try-download-release
download-or-bust nodeup "${NODEUP_HASH}" "${NODEUP_URL}"

chmod +x nodeup

echo "Running nodeup"
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
Expand Down
Loading