V4 - Use new .NET CDN URLs and update to latest install scripts (#566)

* Use new .NET CDN URL

* Update to latest install-dotnet scripts

* Use signed version of new `install-dotnet.ps1`

* Add fallback to old CDN URL
This commit is contained in:
Dylan 2024-12-26 14:21:39 -08:00 committed by GitHub
parent e4c228a841
commit 87b7050bc5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 1704 additions and 1608 deletions

11
dist/setup/index.js vendored
View File

@ -93806,7 +93806,13 @@ class DotnetVersionResolver {
allowRetries: true, allowRetries: true,
maxRetries: 3 maxRetries: 3
}); });
const response = yield httpClient.getJson(DotnetVersionResolver.DotnetCoreIndexUrl); let response;
try {
response = yield httpClient.getJson(DotnetVersionResolver.DotnetCoreIndexUrl);
}
catch (error) {
response = yield httpClient.getJson(DotnetVersionResolver.DotnetCoreIndexFallbackUrl);
}
const result = response.result || {}; const result = response.result || {};
const releasesInfo = result['releases-index']; const releasesInfo = result['releases-index'];
const releaseInfo = releasesInfo.find(info => { const releaseInfo = releasesInfo.find(info => {
@ -93821,7 +93827,8 @@ class DotnetVersionResolver {
} }
} }
exports.DotnetVersionResolver = DotnetVersionResolver; exports.DotnetVersionResolver = DotnetVersionResolver;
DotnetVersionResolver.DotnetCoreIndexUrl = 'https://dotnetcli.azureedge.net/dotnet/release-metadata/releases-index.json'; DotnetVersionResolver.DotnetCoreIndexUrl = 'https://builds.dotnet.microsoft.com/dotnet/release-metadata/releases-index.json';
DotnetVersionResolver.DotnetCoreIndexFallbackUrl = 'https://dotnetcli.azureedge.net/dotnet/release-metadata/releases-index.json';
class DotnetInstallScript { class DotnetInstallScript {
constructor() { constructor() {
this.scriptName = utils_1.IS_WINDOWS ? 'install-dotnet.ps1' : 'install-dotnet.sh'; this.scriptName = utils_1.IS_WINDOWS ? 'install-dotnet.ps1' : 'install-dotnet.sh';

File diff suppressed because it is too large Load Diff

View File

@ -1272,6 +1272,61 @@ downloadwget() {
return 0 return 0
} }
extract_stem() {
local url="$1"
# extract the protocol
proto="$(echo $1 | grep :// | sed -e's,^\(.*://\).*,\1,g')"
# remove the protocol
url="${1/$proto/}"
# extract the path (if any) - since we know all of our feeds have a first path segment, we can skip the first one. otherwise we'd use -f2- to get the full path
full_path="$(echo $url | grep / | cut -d/ -f2-)"
path="$(echo $full_path | cut -d/ -f2-)"
echo $path
}
check_url_exists() {
eval $invocation
local url="$1"
local code=""
if machine_has "curl"
then
code=$(curl --head -o /dev/null -w "%{http_code}" -s --fail "$url");
elif machine_has "wget"
then
# get the http response, grab the status code
server_response=$(wget -qO- --method=HEAD --server-response "$url" 2>&1)
code=$(echo "$server_response" | grep "HTTP/" | awk '{print $2}')
fi
if [ $code = "200" ]; then
return 0
else
return 1
fi
}
sanitize_redirect_url() {
eval $invocation
local url_stem
url_stem=$(extract_stem "$1")
say_verbose "Checking configured feeds for the asset at ${yellow:-}$url_stem${normal:-}"
for feed in "${feeds[@]}"
do
local trial_url="$feed/$url_stem"
say_verbose "Checking ${yellow:-}$trial_url${normal:-}"
if check_url_exists "$trial_url"; then
say_verbose "Found a match at ${yellow:-}$trial_url${normal:-}"
echo "$trial_url"
return 0
else
say_verbose "No match at ${yellow:-}$trial_url${normal:-}"
fi
done
return 1
}
get_download_link_from_aka_ms() { get_download_link_from_aka_ms() {
eval $invocation eval $invocation
@ -1324,6 +1379,11 @@ get_download_link_from_aka_ms() {
return 1 return 1
fi fi
sanitized_redirect_url=$(sanitize_redirect_url "$aka_ms_download_link")
if [[ -n "$sanitized_redirect_url" ]]; then
aka_ms_download_link="$sanitized_redirect_url"
fi
say_verbose "The redirect location retrieved: '$aka_ms_download_link'." say_verbose "The redirect location retrieved: '$aka_ms_download_link'."
return 0 return 0
else else
@ -1335,7 +1395,9 @@ get_download_link_from_aka_ms() {
get_feeds_to_use() get_feeds_to_use()
{ {
feeds=( feeds=(
"https://builds.dotnet.microsoft.com/dotnet"
"https://dotnetcli.azureedge.net/dotnet" "https://dotnetcli.azureedge.net/dotnet"
"https://ci.dot.net/public"
"https://dotnetbuilds.azureedge.net/public" "https://dotnetbuilds.azureedge.net/public"
) )

View File

@ -101,9 +101,18 @@ export class DotnetVersionResolver {
allowRetries: true, allowRetries: true,
maxRetries: 3 maxRetries: 3
}); });
const response = await httpClient.getJson<any>(
DotnetVersionResolver.DotnetCoreIndexUrl let response;
); try {
response = await httpClient.getJson<any>(
DotnetVersionResolver.DotnetCoreIndexUrl
);
} catch (error) {
response = await httpClient.getJson<any>(
DotnetVersionResolver.DotnetCoreIndexFallbackUrl
);
}
const result = response.result || {}; const result = response.result || {};
const releasesInfo: any[] = result['releases-index']; const releasesInfo: any[] = result['releases-index'];
@ -122,6 +131,8 @@ export class DotnetVersionResolver {
} }
static DotnetCoreIndexUrl = static DotnetCoreIndexUrl =
'https://builds.dotnet.microsoft.com/dotnet/release-metadata/releases-index.json';
static DotnetCoreIndexFallbackUrl =
'https://dotnetcli.azureedge.net/dotnet/release-metadata/releases-index.json'; 'https://dotnetcli.azureedge.net/dotnet/release-metadata/releases-index.json';
} }