Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 2 additions & 1 deletion .github/workflows/long-running-azure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,9 @@ jobs:
run: |
# Install the latest Radius CLI, including release candidates if available.
# INSTALL_DIR places rad directly into the workspace bin directory — no copy needed.
set -o pipefail
mkdir -p "$GITHUB_WORKSPACE/bin"
wget -q "https://raw.githubusercontent.com/radius-project/radius/main/deploy/install.sh" -O - | INSTALL_DIR="$GITHUB_WORKSPACE/bin" INCLUDE_RC=true /bin/bash
wget --no-verbose "https://raw.githubusercontent.com/radius-project/radius/main/deploy/install.sh" -O - | INSTALL_DIR="$GITHUB_WORKSPACE/bin" INCLUDE_RC=true /bin/bash

- name: Verify CLI installation
run: |
Expand Down
23 changes: 17 additions & 6 deletions deploy/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -262,15 +262,25 @@ getLatestRelease() {

if [[ "${INCLUDE_RC}" == "true" ]]; then
if [[ "${RADIUS_HTTP_REQUEST_CLI}" == "curl" ]]; then
latest_release=$(curl -s "${radReleaseUrl}" | grep \"tag_name\" | awk 'NR==1{print $2}' | sed -n 's/\"\(.*\)\",/\1/p')
latest_release=$(curl --fail --show-error --silent --location \
"${radReleaseUrl}" | grep \"tag_name\" | awk 'NR==1{print $2}' |
sed -n 's/\"\(.*\)\",/\1/p')
Comment thread
brooke-hamilton marked this conversation as resolved.
Outdated
else
latest_release=$(wget -q --header="Accept: application/json" -O - "${radReleaseUrl}" | grep \"tag_name\" | awk 'NR==1{print $2}' | sed -n 's/\"\(.*\)\",/\1/p')
latest_release=$(wget --no-verbose \
--header="Accept: application/json" -O - "${radReleaseUrl}" |
grep \"tag_name\" | awk 'NR==1{print $2}' |
sed -n 's/\"\(.*\)\",/\1/p')
fi
else
if [[ "${RADIUS_HTTP_REQUEST_CLI}" == "curl" ]]; then
latest_release=$(curl -s "${radReleaseUrl}" | grep \"tag_name\" | grep -v rc | awk 'NR==1{print $2}' | sed -n 's/\"\(.*\)\",/\1/p')
latest_release=$(curl --fail --show-error --silent --location \
"${radReleaseUrl}" | grep \"tag_name\" | grep -v rc |
awk 'NR==1{print $2}' | sed -n 's/\"\(.*\)\",/\1/p')
else
latest_release=$(wget -q --header="Accept: application/json" -O - "${radReleaseUrl}" | grep \"tag_name\" | grep -v rc | awk 'NR==1{print $2}' | sed -n 's/\"\(.*\)\",/\1/p')
latest_release=$(wget --no-verbose \
--header="Accept: application/json" -O - "${radReleaseUrl}" |
grep \"tag_name\" | grep -v rc | awk 'NR==1{print $2}' |
sed -n 's/\"\(.*\)\",/\1/p')
fi
fi

Expand Down Expand Up @@ -313,9 +323,10 @@ downloadFile() {

echo "Downloading ${download_url}..."
if [[ "${RADIUS_HTTP_REQUEST_CLI}" == "curl" ]]; then
curl -SsL "${download_url}" -o "${artifact_tmp_file}"
curl --fail --show-error --silent --location "${download_url}" \
-o "${artifact_tmp_file}"
else
wget -q -O "${artifact_tmp_file}" "${download_url}"
wget --no-verbose -O "${artifact_tmp_file}" "${download_url}"
fi
fi

Expand Down
34 changes: 34 additions & 0 deletions deploy/test-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,39 @@ test_edge_version_with_oras() {
assert_rad_installed "${dir}"
}

test_latest_release_curl_error_visible() {
local dir
dir=$(make_test_dir "latest-release-curl-error")
local bin_dir
bin_dir=$(make_test_dir "latest-release-curl-error-bin")
local tool tool_path
for tool in bash uname tr grep awk sed; do
tool_path=$(command -v "${tool}" 2>/dev/null) || continue
ln -sf "${tool_path}" "${bin_dir}/"
done

cat > "${bin_dir}/curl" << 'EOF'
#!/bin/bash
for argument in "$@"; do
if [[ "${argument}" == "--show-error" ]]; then
echo "curl: (22) simulated HTTP error" >&2
break
fi
done
exit 22
Comment thread
brooke-hamilton marked this conversation as resolved.
Outdated
EOF
chmod +x "${bin_dir}/curl"

echo " CMD: PATH=<failing-curl> ${INSTALLER} --install-dir ${dir}"
if LAST_OUTPUT=$(PATH="${bin_dir}" "${INSTALLER}" \
--install-dir "${dir}" 2>&1); then
echo " ASSERT FAILED: expected non-zero exit for HTTP error"
return 1
fi
echo "${LAST_OUTPUT}"
assert_contains "${LAST_OUTPUT}" "curl: (22) simulated HTTP error"
}

test_flag_overrides_install_dir_env() {
local env_dir flag_dir
env_dir=$(make_test_dir "env-dir-ignored")
Expand Down Expand Up @@ -499,6 +532,7 @@ run_test "PATH hint shown for non-PATH dir" test_path_hint_shown
run_test "version with v prefix" test_version_with_v_prefix
run_test "edge version without oras fails" test_edge_version_without_oras
run_test "edge version with oras succeeds" test_edge_version_with_oras
run_test "latest release curl error is visible" test_latest_release_curl_error_visible
run_test "--install-dir flag overrides INSTALL_DIR env" test_flag_overrides_install_dir_env
run_test "INSTALL_DIR env overrides RADIUS_INSTALL_DIR" test_install_dir_env_overrides_radius_install_dir
run_test "warning for existing rad elsewhere in PATH" test_warn_existing_rad_elsewhere
Expand Down
Loading