Skip to content

Commit

Permalink
Explain error when downloading Node Alpine ARM64 (#4822)
Browse files Browse the repository at this point in the history
Co-authored-by: Kirill Ivlev <[email protected]>
  • Loading branch information
DenisRumyantsev and kirill-ivlev authored Jun 3, 2024
1 parent 5aaa84f commit ac6247a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .vsts.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ parameters:
- name: alpine_arm64
type: boolean
displayName: Alpine (ARM64)
default: false
default: true
- name: macOS_x64
type: boolean
displayName: macOS (x64)
Expand Down
22 changes: 14 additions & 8 deletions src/Misc/externals.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,20 @@ else
fi

function failed() {
local error=${1:-Undefined error}
echo "Failed: $error" >&2
exit 1
local error=${1:-Undefined error}
local command_identifier=$2
echo "Failed: $error" >&2
if [[ $command_identifier == 'download_node_alpine_arm64' ]]; then
echo "Node for Alpine ARM64 not found in blob storage. If the version of Node (for tasks execution) has been updated, it should be built for Alpine ARM64 and uploaded to blob storage. Read documentation about the agent release for more info."
fi
exit 1
}

function checkRC() {
local rc=$?
local command_identifier=$2
if [ $rc -ne 0 ]; then
failed "${1} failed with return code $rc"
failed "${1} failed with return code $rc" $command_identifier
fi
}

Expand All @@ -56,6 +61,7 @@ function acquireExternalTool() {
# of the nested TEE-CLC-14.0.4 directory are moved up one directory, and then the empty directory
# TEE-CLC-14.0.4 is removed.
local dont_uncompress=$4
local tool_name=$5

# Extract the portion of the URL after the protocol. E.g. vstsagenttools.blob.core.windows.net/tools/pdbstr/1/pdbstr.zip
local relative_url="${download_source#*://}"
Expand Down Expand Up @@ -84,7 +90,7 @@ function acquireExternalTool() {
# -S Show error. With -s, make curl show errors when they occur
# -L Follow redirects (H)
# -o FILE Write to FILE instead of stdout
curl --retry 10 -fkSL -o "$partial_target" "$download_source" 2>"${download_target}_download.log" || checkRC 'curl'
curl --retry 10 -fkSL -o "$partial_target" "$download_source" 2>"${download_target}_download.log" || checkRC 'curl' "download_${tool_name}"

# Move the partial file to the download target.
mv "$partial_target" "$download_target" || checkRC 'mv'
Expand Down Expand Up @@ -205,11 +211,11 @@ else
ARCH="linux-arm64-musl"

if [[ "$INCLUDE_NODE10" == "true" ]]; then
acquireExternalTool "${CONTAINER_URL}/nodejs/${ARCH}/node-v${NODE10_VERSION}-${ARCH}.tar.gz" node10/bin fix_nested_dir
acquireExternalTool "${CONTAINER_URL}/nodejs/${ARCH}/node-v${NODE10_VERSION}-${ARCH}.tar.gz" node10/bin fix_nested_dir false node_alpine_arm64
fi

acquireExternalTool "${CONTAINER_URL}/nodejs/${ARCH}/node-v${NODE16_VERSION}-${ARCH}.tar.gz" node16/bin fix_nested_dir
acquireExternalTool "${CONTAINER_URL}/nodejs/${ARCH}/node-v${NODE20_VERSION}-${ARCH}.tar.gz" node20_1/bin fix_nested_dir
acquireExternalTool "${CONTAINER_URL}/nodejs/${ARCH}/node-v${NODE16_VERSION}-${ARCH}.tar.gz" node16/bin fix_nested_dir false node_alpine_arm64
acquireExternalTool "${CONTAINER_URL}/nodejs/${ARCH}/node-v${NODE20_VERSION}-${ARCH}.tar.gz" node20_1/bin fix_nested_dir false node_alpine_arm64
else
case $PACKAGERUNTIME in
"linux-musl-x64") ARCH="linux-x64-musl";;
Expand Down

0 comments on commit ac6247a

Please sign in to comment.