mirror of
https://github.com/actions/runner-images.git
synced 2025-12-15 06:08:07 +00:00
[Ubuntu] Rewrite function download_with_retry (#8912)
* [Ubuntu] Rewrite function download_with_retry * Fix loop exit condition
This commit is contained in:
committed by
GitHub
parent
7dba8776df
commit
abb81511d4
@@ -43,18 +43,16 @@ setEtcEnvironmentVariable "ANDROID_HOME" "${ANDROID_SDK_ROOT}"
|
||||
# Create android sdk directory
|
||||
mkdir -p ${ANDROID_SDK_ROOT}
|
||||
|
||||
cmdlineTools="android-cmdline-tools.zip"
|
||||
|
||||
# Download the latest command line tools so that we can accept all of the licenses.
|
||||
# See https://developer.android.com/studio/#command-tools
|
||||
cmdlineToolsVersion=$(get_toolset_value '.android."cmdline-tools"')
|
||||
if [[ $cmdlineToolsVersion == "latest" ]]; then
|
||||
repositoryXmlUrl="https://dl.google.com/android/repository/repository2-1.xml"
|
||||
download_with_retries $repositoryXmlUrl "/tmp" "repository2-1.xml"
|
||||
repository_xml_url="https://dl.google.com/android/repository/repository2-1.xml"
|
||||
repository_xml_file=$(download_with_retry "$repository_xml_url")
|
||||
cmdlineToolsVersion=$(
|
||||
yq -p=xml \
|
||||
'.sdk-repository.remotePackage[] | select(."+@path" == "cmdline-tools;latest" and .channelRef."+@ref" == "channel-0").archives.archive[].complete.url | select(contains("commandlinetools-linux"))' \
|
||||
/tmp/repository2-1.xml
|
||||
"${repository_xml_file}"
|
||||
)
|
||||
|
||||
if [[ -z $cmdlineToolsVersion ]]; then
|
||||
@@ -63,12 +61,10 @@ if [[ $cmdlineToolsVersion == "latest" ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
download_with_retries "https://dl.google.com/android/repository/${cmdlineToolsVersion}" "." $cmdlineTools
|
||||
|
||||
unzip -qq $cmdlineTools -d ${ANDROID_SDK_ROOT}/cmdline-tools
|
||||
archive_path=$(download_with_retry "https://dl.google.com/android/repository/${cmdlineToolsVersion}")
|
||||
unzip -qq "$archive_path" -d ${ANDROID_SDK_ROOT}/cmdline-tools
|
||||
# Command line tools need to be placed in ${ANDROID_SDK_ROOT}/sdk/cmdline-tools/latest to determine SDK root
|
||||
mv ${ANDROID_SDK_ROOT}/cmdline-tools/cmdline-tools ${ANDROID_SDK_ROOT}/cmdline-tools/latest
|
||||
rm -f $cmdlineTools
|
||||
|
||||
# Check sdk manager installation
|
||||
${SDKMANAGER} --list 1>/dev/null
|
||||
|
||||
Reference in New Issue
Block a user