fix(scripts): address cache-busting review feedback

Signed-off-by: Solomon Wakhungu <65043605+1solomonwakhungu@users.noreply.github.com>
pull/32339/head
Solomon Wakhungu 2 months ago
parent 5a30c7ae85
commit bbaf420a10

@ -114,8 +114,8 @@ verifySupported() {
checkDesiredVersion() { checkDesiredVersion() {
if [ "x$DESIRED_VERSION" == "x" ]; then if [ "x$DESIRED_VERSION" == "x" ]; then
# Get tag from release URL # Get tag from release URL
# Append a cache-busting query string to avoid CDN edge servers # The current CDN does not revalidate on the request no-cache directive,
# serving stale version files after a new release. # so use a unique query while retaining no-cache for compliant intermediaries.
local latest_release_url="https://get.helm.sh/helm3-latest-version?ts=$(date +%s)" local latest_release_url="https://get.helm.sh/helm3-latest-version?ts=$(date +%s)"
local latest_release_response="" local latest_release_response=""
if [ "${HAS_CURL}" == "true" ]; then if [ "${HAS_CURL}" == "true" ]; then

@ -114,12 +114,14 @@ verifySupported() {
checkDesiredVersion() { checkDesiredVersion() {
if [ "x$DESIRED_VERSION" == "x" ]; then if [ "x$DESIRED_VERSION" == "x" ]; then
# Get tag from release URL # Get tag from release URL
local latest_release_url="https://get.helm.sh/helm4-latest-version" # The current CDN does not revalidate on the request no-cache directive,
# so use a unique query while retaining no-cache for compliant intermediaries.
local latest_release_url="https://get.helm.sh/helm4-latest-version?ts=$(date +%s)"
local latest_release_response="" local latest_release_response=""
if [ "${HAS_CURL}" == "true" ]; then if [ "${HAS_CURL}" == "true" ]; then
latest_release_response=$( curl -L --silent --show-error --fail "$latest_release_url" 2>&1 || true ) latest_release_response=$( curl -L --silent --show-error --fail -H "Cache-Control: no-cache" "$latest_release_url" 2>&1 || true )
elif [ "${HAS_WGET}" == "true" ]; then elif [ "${HAS_WGET}" == "true" ]; then
latest_release_response=$( wget "$latest_release_url" -q -O - 2>&1 || true ) latest_release_response=$( wget "$latest_release_url" --header="Cache-Control: no-cache" -q -O - 2>&1 || true )
fi fi
TAG=$( echo "$latest_release_response" | grep '^v[0-9]' ) TAG=$( echo "$latest_release_response" | grep '^v[0-9]' )
if [ "x$TAG" == "x" ]; then if [ "x$TAG" == "x" ]; then

Loading…
Cancel
Save