Skip to content

Commit 6d6615b

Browse files
authored
Merge branch 'main' into fix/code_spell_1139
2 parents 9c1204d + d9c2de0 commit 6d6615b

28 files changed

+381
-130
lines changed

src/dotnet/devcontainer-feature.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "dotnet",
3-
"version": "2.1.3",
3+
"version": "2.2.0",
44
"name": "Dotnet CLI",
55
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/dotnet",
66
"description": "This Feature installs the latest .NET SDK, which includes the .NET CLI and the shared runtime. Options are provided to choose a different version or additional versions.",

src/dotnet/scripts/dotnet-helpers.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ fetch_latest_version_in_channel() {
1818
local channel="$1"
1919
local runtime="$2"
2020
if [ "$runtime" = "dotnet" ]; then
21-
wget -qO- "https://dotnetcli.azureedge.net/dotnet/Runtime/$channel/latest.version"
21+
wget -qO- "https://builds.dotnet.microsoft.com/dotnet/Runtime/$channel/latest.version"
2222
elif [ "$runtime" = "aspnetcore" ]; then
23-
wget -qO- "https://dotnetcli.azureedge.net/dotnet/aspnetcore/Runtime/$channel/latest.version"
23+
wget -qO- "https://builds.dotnet.microsoft.com/dotnet/aspnetcore/Runtime/$channel/latest.version"
2424
else
25-
wget -qO- "https://dotnetcli.azureedge.net/dotnet/Sdk/$channel/latest.version"
25+
wget -qO- "https://builds.dotnet.microsoft.com/dotnet/Sdk/$channel/latest.version"
2626
fi
2727
}
2828

src/dotnet/scripts/vendor/dotnet-install.sh

Lines changed: 107 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -423,11 +423,17 @@ get_normalized_architecture_for_specific_sdk_version() {
423423
# args:
424424
# version or channel - $1
425425
is_arm64_supported() {
426-
#any channel or version that starts with the specified versions
427-
case "$1" in
428-
( "1"* | "2"* | "3"* | "4"* | "5"*)
429-
echo false
430-
return 0
426+
# Extract the major version by splitting on the dot
427+
major_version="${1%%.*}"
428+
429+
# Check if the major version is a valid number and less than 6
430+
case "$major_version" in
431+
[0-9]*)
432+
if [ "$major_version" -lt 6 ]; then
433+
echo false
434+
return 0
435+
fi
436+
;;
431437
esac
432438

433439
echo true
@@ -950,6 +956,37 @@ get_absolute_path() {
950956
return 0
951957
}
952958

959+
# args:
960+
# override - $1 (boolean, true or false)
961+
get_cp_options() {
962+
eval $invocation
963+
964+
local override="$1"
965+
local override_switch=""
966+
967+
if [ "$override" = false ]; then
968+
override_switch="-n"
969+
970+
# create temporary files to check if 'cp -u' is supported
971+
tmp_dir="$(mktemp -d)"
972+
tmp_file="$tmp_dir/testfile"
973+
tmp_file2="$tmp_dir/testfile2"
974+
975+
touch "$tmp_file"
976+
977+
# use -u instead of -n if it's available
978+
if cp -u "$tmp_file" "$tmp_file2" 2>/dev/null; then
979+
override_switch="-u"
980+
fi
981+
982+
# clean up
983+
rm -f "$tmp_file" "$tmp_file2"
984+
rm -rf "$tmp_dir"
985+
fi
986+
987+
echo "$override_switch"
988+
}
989+
953990
# args:
954991
# input_files - stdin
955992
# root_path - $1
@@ -961,15 +998,7 @@ copy_files_or_dirs_from_list() {
961998
local root_path="$(remove_trailing_slash "$1")"
962999
local out_path="$(remove_trailing_slash "$2")"
9631000
local override="$3"
964-
local osname="$(get_current_os_name)"
965-
local override_switch=$(
966-
if [ "$override" = false ]; then
967-
if [ "$osname" = "linux-musl" ]; then
968-
printf -- "-u";
969-
else
970-
printf -- "-n";
971-
fi
972-
fi)
1001+
local override_switch="$(get_cp_options "$override")"
9731002

9741003
cat | uniq | while read -r file_path; do
9751004
local path="$(remove_beginning_slash "${file_path#$root_path}")"
@@ -1243,6 +1272,61 @@ downloadwget() {
12431272
return 0
12441273
}
12451274

1275+
extract_stem() {
1276+
local url="$1"
1277+
# extract the protocol
1278+
proto="$(echo $1 | grep :// | sed -e's,^\(.*://\).*,\1,g')"
1279+
# remove the protocol
1280+
url="${1/$proto/}"
1281+
# 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
1282+
full_path="$(echo $url | grep / | cut -d/ -f2-)"
1283+
path="$(echo $full_path | cut -d/ -f2-)"
1284+
echo $path
1285+
}
1286+
1287+
check_url_exists() {
1288+
eval $invocation
1289+
local url="$1"
1290+
1291+
local code=""
1292+
if machine_has "curl"
1293+
then
1294+
code=$(curl --head -o /dev/null -w "%{http_code}" -s --fail "$url");
1295+
elif machine_has "wget"
1296+
then
1297+
# get the http response, grab the status code
1298+
server_response=$(wget -qO- --method=HEAD --server-response "$url" 2>&1)
1299+
code=$(echo "$server_response" | grep "HTTP/" | awk '{print $2}')
1300+
fi
1301+
if [ $code = "200" ]; then
1302+
return 0
1303+
else
1304+
return 1
1305+
fi
1306+
}
1307+
1308+
sanitize_redirect_url() {
1309+
eval $invocation
1310+
1311+
local url_stem
1312+
url_stem=$(extract_stem "$1")
1313+
say_verbose "Checking configured feeds for the asset at ${yellow:-}$url_stem${normal:-}"
1314+
1315+
for feed in "${feeds[@]}"
1316+
do
1317+
local trial_url="$feed/$url_stem"
1318+
say_verbose "Checking ${yellow:-}$trial_url${normal:-}"
1319+
if check_url_exists "$trial_url"; then
1320+
say_verbose "Found a match at ${yellow:-}$trial_url${normal:-}"
1321+
echo "$trial_url"
1322+
return 0
1323+
else
1324+
say_verbose "No match at ${yellow:-}$trial_url${normal:-}"
1325+
fi
1326+
done
1327+
return 1
1328+
}
1329+
12461330
get_download_link_from_aka_ms() {
12471331
eval $invocation
12481332

@@ -1295,6 +1379,11 @@ get_download_link_from_aka_ms() {
12951379
return 1
12961380
fi
12971381

1382+
sanitized_redirect_url=$(sanitize_redirect_url "$aka_ms_download_link")
1383+
if [[ -n "$sanitized_redirect_url" ]]; then
1384+
aka_ms_download_link="$sanitized_redirect_url"
1385+
fi
1386+
12981387
say_verbose "The redirect location retrieved: '$aka_ms_download_link'."
12991388
return 0
13001389
else
@@ -1306,7 +1395,9 @@ get_download_link_from_aka_ms() {
13061395
get_feeds_to_use()
13071396
{
13081397
feeds=(
1398+
"https://builds.dotnet.microsoft.com/dotnet"
13091399
"https://dotnetcli.azureedge.net/dotnet"
1400+
"https://ci.dot.net/public"
13101401
"https://dotnetbuilds.azureedge.net/public"
13111402
)
13121403

@@ -1735,7 +1826,7 @@ do
17351826
zip_path="$1"
17361827
;;
17371828
-?|--?|-h|--help|-[Hh]elp)
1738-
script_name="$(basename "$0")"
1829+
script_name="dotnet-install.sh"
17391830
echo ".NET Tools Installer"
17401831
echo "Usage:"
17411832
echo " # Install a .NET SDK of a given Quality from a given Channel"
@@ -1865,4 +1956,4 @@ fi
18651956

18661957
say "Note that the script does not resolve dependencies during installation."
18671958
say "To check the list of dependencies, go to https://learn.microsoft.com/dotnet/core/install, select your operating system and check the \"Dependencies\" section."
1868-
say "Installation finished successfully."
1959+
say "Installation finished successfully."

src/nvidia-cuda/devcontainer-feature.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "nvidia-cuda",
3-
"version": "1.1.3",
3+
"version": "1.2.0",
44
"name": "NVIDIA CUDA",
55
"description": "Installs shared libraries for NVIDIA CUDA.",
66
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/nvidia-cuda",
@@ -48,6 +48,7 @@
4848
"cudnnVersion": {
4949
"type": "string",
5050
"proposals": [
51+
"automatic",
5152
"8.9.5.29",
5253
"8.9.4.25",
5354
"8.9.3.28",
@@ -79,7 +80,7 @@
7980
"9.3.0.75",
8081
"9.4.0.58"
8182
],
82-
"default": "8.6.0.163",
83+
"default": "automatic",
8384
"description": "Version of cuDNN to install"
8485
}
8586
},

src/nvidia-cuda/install.sh

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,30 @@ apt-get update -yq
5959
cuda_pkg="cuda-libraries-${CUDA_VERSION/./-}"
6060
nvtx_pkg="cuda-nvtx-${CUDA_VERSION/./-}"
6161
toolkit_pkg="cuda-toolkit-${CUDA_VERSION/./-}"
62-
major_cudnn_version=$(echo "${CUDNN_VERSION}" | cut -d '.' -f 1)
63-
major_cuda_version=$(echo "${CUDA_VERSION}" | cut -d '.' -f 1)
6462
if ! apt-cache show "$cuda_pkg"; then
6563
echo "The requested version of CUDA is not available: CUDA $CUDA_VERSION"
6664
exit 1
6765
fi
6866

6967
echo "Installing CUDA libraries..."
7068
apt-get install -yq "$cuda_pkg"
69+
apt-get update -yq --fix-missing
70+
71+
# auto find recent cudnn version
72+
major_cuda_version=$(echo "${CUDA_VERSION}" | cut -d '.' -f 1)
73+
if [ "$CUDNN_VERSION" = "automatic" ]; then
74+
if [[ "$CUDA_VERSION" < "12.3" ]]; then
75+
CUDNN_VERSION=$(apt-cache policy libcudnn8 | grep "$CUDA_VERSION" | grep -Eo '^[^-1+]*' | sort -V | tail -n1 | xargs)
76+
else
77+
CUDNN_VERSION=$(apt-cache policy libcudnn9-cuda-$major_cuda_version | grep "Candidate" | awk '{print $2}' | grep -Eo '^[^-1+]*')
78+
fi
79+
fi
80+
major_cudnn_version=$(echo "${CUDNN_VERSION}" | cut -d '.' -f 1)
7181

7282
if [ "$INSTALL_CUDNN" = "true" ]; then
7383
# Ensure that the requested version of cuDNN is available AND compatible
74-
#if major cudnn version is 9, then we need to install libcudnn9-cuda-<major_version> package
75-
#else we need to install libcudnn8-cuda-<major_version> package
84+
#if major cudnn version is 9, then we need to install libcudnn9-cuda-<major_cuda_version>_<CUDNN_VERSION>-1 package
85+
#else we need to install libcudnn8_<CUDNN_VERSION>-1+cuda<CUDA_VERSION>" package
7686
if [[ $major_cudnn_version -ge "9" ]]
7787
then
7888
cudnn_pkg_version="libcudnn9-cuda-${major_cuda_version}=${CUDNN_VERSION}-1"
@@ -91,13 +101,14 @@ fi
91101

92102
if [ "$INSTALL_CUDNNDEV" = "true" ]; then
93103
# Ensure that the requested version of cuDNN development package is available AND compatible
104+
#if major cudnn version is 9, then we need to install libcudnn9-dev-cuda-<major_cuda_version>_<CUDNN_VERSION>-1 package
105+
#else we need to install libcudnn8-dev_<CUDNN_VERSION>-1+cuda<CUDA_VERSION>" package
94106
if [[ $major_cudnn_version -ge "9" ]]
95107
then
96108
cudnn_dev_pkg_version="libcudnn9-dev-cuda-${major_cuda_version}=${CUDNN_VERSION}-1"
97109
else
98110
cudnn_dev_pkg_version="libcudnn8-dev=${CUDNN_VERSION}-1+cuda${CUDA_VERSION}"
99111
fi
100-
101112
if ! apt-cache show "$cudnn_dev_pkg_version"; then
102113
echo "The requested version of cuDNN development package is not available: cuDNN $CUDNN_VERSION for CUDA $CUDA_VERSION"
103114
exit 1

src/oryx/devcontainer-feature.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "oryx",
3-
"version": "1.3.7",
3+
"version": "1.4.0",
44
"name": "Oryx",
55
"description": "Installs the oryx CLI",
66
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/oryx",

0 commit comments

Comments
 (0)