aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChuck Lantz <clantz@microsoft.com>2022-11-14 22:41:32 +0300
committerGitHub <noreply@github.com>2022-11-14 22:41:32 +0300
commit17580ee22f38b3a16e6531a8139629fd2fd8234a (patch)
treed18d553e14e92dec4ccfe9b6ca3e4ccb6a1ec50f
parent258b107b39db9f28703bf6bfeed3102d54e1cafe (diff)
Add .NET 7, drop .NET 5 (#269)
* Add .NET 7, drop .NET 5 * Add libssl3 to common-utils for jammy * Handle lts/latest hard coding * Fix, improve tests * Bump version * Fix situation where version could come from either MS repo or OS * Remove unused option * Bump common version * Remove unused function * Restore DOTNET_ROOT per feedback
-rw-r--r--src/common-utils/devcontainer-feature.json2
-rwxr-xr-xsrc/common-utils/install.sh7
-rw-r--r--src/dotnet/devcontainer-feature.json4
-rwxr-xr-xsrc/dotnet/install.sh138
-rw-r--r--test/dotnet/install_additional_dotnet.sh10
-rw-r--r--test/dotnet/install_dotnet_3.sh8
-rw-r--r--test/dotnet/install_dotnet_5.sh14
-rw-r--r--test/dotnet/install_dotnet_6_bullseye.sh17
-rw-r--r--test/dotnet/install_dotnet_6_focal.sh17
-rw-r--r--test/dotnet/install_dotnet_7_bullseye.sh17
-rw-r--r--test/dotnet/install_dotnet_7_jammy.sh17
-rw-r--r--test/dotnet/install_dotnet_latest.sh17
-rw-r--r--test/dotnet/install_dotnet_lts.sh17
-rw-r--r--test/dotnet/install_wo_apt.sh17
-rw-r--r--test/dotnet/scenarios.json53
-rwxr-xr-xtest/dotnet/test.sh6
16 files changed, 262 insertions, 99 deletions
diff --git a/src/common-utils/devcontainer-feature.json b/src/common-utils/devcontainer-feature.json
index c5f8621..9a135d5 100644
--- a/src/common-utils/devcontainer-feature.json
+++ b/src/common-utils/devcontainer-feature.json
@@ -1,6 +1,6 @@
{
"id": "common-utils",
- "version": "1.1.3",
+ "version": "1.1.4",
"name": "Common Debian Utilities",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/common-utils",
"description": "Installs a set of common command line utilities, Oh My Zsh!, and sets up a non-root user.",
diff --git a/src/common-utils/install.sh b/src/common-utils/install.sh
index 2d51a0b..8ac0a7c 100755
--- a/src/common-utils/install.sh
+++ b/src/common-utils/install.sh
@@ -140,7 +140,12 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then
if [[ ! -z $(apt-cache --names-only search ^libssl1.1$) ]]; then
package_list="${package_list} libssl1.1"
fi
-
+
+ # Install libssl3 if available
+ if [[ ! -z $(apt-cache --names-only search ^libssl3$) ]]; then
+ package_list="${package_list} libssl3"
+ fi
+
# Install appropriate version of libssl1.0.x if available
libssl_package=$(dpkg-query -f '${db:Status-Abbrev}\t${binary:Package}\n' -W 'libssl1\.0\.?' 2>&1 || echo '')
if [ "$(echo "$LIlibssl_packageBSSL" | grep -o 'libssl1\.0\.[0-9]:' | uniq | sort | wc -l)" -eq 0 ]; then
diff --git a/src/dotnet/devcontainer-feature.json b/src/dotnet/devcontainer-feature.json
index ce8ef06..42eb1c2 100644
--- a/src/dotnet/devcontainer-feature.json
+++ b/src/dotnet/devcontainer-feature.json
@@ -1,6 +1,6 @@
{
"id": "dotnet",
- "version": "1.0.8",
+ "version": "1.1.0",
"name": "Dotnet CLI",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/dotnet",
"description": "Installs the .NET CLI. Provides option of installing sdk or runtime, and option of versions to install. Uses latest version of .NET sdk as defaults to install.",
@@ -9,8 +9,8 @@
"type": "string",
"proposals": [
"latest",
+ "7",
"6",
- "5",
"3.1"
],
"default": "latest",
diff --git a/src/dotnet/install.sh b/src/dotnet/install.sh
index fe4f58d..78cd691 100755
--- a/src/dotnet/install.sh
+++ b/src/dotnet/install.sh
@@ -12,6 +12,9 @@ DOTNET_RUNTIME_ONLY=${RUNTIMEONLY:-"false"}
OVERRIDE_DEFAULT_VERSION=${OVERRIDEDEFAULTVERSION:-"true"}
INSTALL_USING_APT=${INSTALLUSINGAPT:-"true"}
+DOTNET_LATEST="7"
+DOTNET_LTS="6"
+
USERNAME=${USERNAME:-"automatic"}
UPDATE_RC=${UPDATE_RC:-"true"}
TARGET_DOTNET_ROOT=${TARGET_DOTNET_ROOT:-"/usr/local/dotnet"}
@@ -84,21 +87,6 @@ cleanup() {
}
trap cleanup EXIT
-# Get central common setting
-get_common_setting() {
- if [ "${common_settings_file_loaded}" != "true" ]; then
- curl -sfL "https://aka.ms/vscode-dev-containers/script-library/settings.env" 2>/dev/null -o /tmp/vsdc-settings.env || echo "Could not download settings file. Skipping."
- common_settings_file_loaded=true
- fi
- if [ -f "/tmp/vsdc-settings.env" ]; then
- local multi_line=""
- if [ "$2" = "true" ]; then multi_line="-z"; fi
- local result="$(grep ${multi_line} -oP "$1=\"?\K[^\"]+" /tmp/vsdc-settings.env | tr -d '\0')"
- if [ ! -z "${result}" ]; then declare -g $1="${result}"; fi
- fi
- echo "$1=${!1}"
-}
-
# Add dotnet directory to PATH in bashrc/zshrc files if OVERRIDE_DEFAULT_VERSION=true.
updaterc() {
if [ "${UPDATE_RC}" = "true" ]; then
@@ -194,72 +182,75 @@ apt_cache_package_and_version_soft_match() {
}
# Install .NET CLI using apt-get package installer
-install_using_apt_from_microsoft_repo() {
+install_using_apt() {
local sdk_or_runtime="$1"
- local dotnet_major_minor_version
- export DOTNET_PACKAGE="dotnet-${sdk_or_runtime}"
-
- # Install dependencies
- check_packages apt-transport-https curl ca-certificates gnupg2 dirmngr
-
- # Import key safely and import Microsoft apt repo
- get_common_setting MICROSOFT_GPG_KEYS_URI
- curl -sSL ${MICROSOFT_GPG_KEYS_URI} | gpg --dearmor > /usr/share/keyrings/microsoft-archive-keyring.gpg
- echo "deb [arch=${architecture} signed-by=/usr/share/keyrings/microsoft-archive-keyring.gpg] https://packages.microsoft.com/repos/microsoft-${ID}-${VERSION_CODENAME}-prod ${VERSION_CODENAME} main" > /etc/apt/sources.list.d/microsoft.list
- apt-get update -y
+ local target_dotnet_version="$2"
+ local use_msft_repo="$3"
+
+ if [ "${use_msft_repo}" = "true" ]; then
+ # Install dependencies
+ check_packages apt-transport-https curl ca-certificates gnupg2 dirmngr
+ # Import key safely and import Microsoft apt repo
+ curl -sSL ${MICROSOFT_GPG_KEYS_URI} | gpg --dearmor > /usr/share/keyrings/microsoft-archive-keyring.gpg
+ echo "deb [arch=${architecture} signed-by=/usr/share/keyrings/microsoft-archive-keyring.gpg] https://packages.microsoft.com/repos/microsoft-${ID}-${VERSION_CODENAME}-prod ${VERSION_CODENAME} main" > /etc/apt/sources.list.d/microsoft.list
+ apt-get update -y
+ fi
- if [ "${DOTNET_VERSION}" = "latest" ] || [ "${DOTNET_VERSION}" = "lts" ]; then
- DOTNET_VERSION=""
- DOTNET_PACKAGE="${DOTNET_PACKAGE}-6.0"
- else
- # Sets DOTNET_VERSION and DOTNET_PACKAGE if matches found.
- apt_cache_package_and_version_soft_match DOTNET_VERSION DOTNET_PACKAGE false
- if [ "$?" != 0 ]; then
- echo "Failed to find requested version."
- return 1
- fi
+ # .NET 7 is not a LTS version, so handle latest and LTS versions differently
+ export APT_DOTNET_VERSION="$target_dotnet_version"
+ if [ "${APT_DOTNET_VERSION}" = "latest" ]; then
+ APT_DOTNET_VERSION="${DOTNET_LATEST}.0"
+ elif [ "${APT_DOTNET_VERSION}" = "lts" ]; then
+ APT_DOTNET_VERSION="${DOTNET_LTS}.0"
+ fi
- if [[ $(dotnet --version) == *"${DOTNET_VERSION}"* ]] ; then
- echo "Dotnet version ${DOTNET_VERSION} is already installed"
- return 1
- fi
+ # Sets target_dotnet_version and dotnet_package if matches found.
+ local base_dotnet_package="dotnet-${sdk_or_runtime}"
+ export DOTNET_PACKAGE="${base_dotnet_package}"
+ apt_cache_package_and_version_soft_match APT_DOTNET_VERSION DOTNET_PACKAGE false
+ if [ "$?" != 0 ] || [ ${DOTNET_PACKAGE} == "${base_dotnet_package}" ]; then
+ echo "Failed to find requested version."
+ return 1
+ fi
+ if type dotnet > /dev/null 2>&1 && [[ "$(dotnet --version)" == *"${APT_DOTNET_VERSION}"* ]] ; then
+ echo "dotnet version ${APT_DOTNET_VERSION} is already installed"
+ return 1
fi
- echo "Installing '${DOTNET_PACKAGE}${DOTNET_VERSION}'..."
- apt-get install -yq ${DOTNET_PACKAGE}${DOTNET_VERSION}
+ echo "Installing '${DOTNET_PACKAGE}${APT_DOTNET_VERSION}'..."
+ apt-get install -yq ${DOTNET_PACKAGE}${APT_DOTNET_VERSION}
if [ "$?" != 0 ]; then
- echo "Failed to complete apt install of ${DOTNET_PACKAGE}${DOTNET_VERSION}"
+ echo "Failed to complete apt install of ${DOTNET_PACKAGE}${TARGET_DOTNET_VERSION}"
return 1
fi
-}
-
-install_using_default_apt_repo() {
- DOTNET_PACKAGE="dotnet6"
- apt_get_update
-
- if [[ "${DOTNET_VERSION}" = "latest" ]] || [[ "${DOTNET_VERSION}" = "lts" ]] || [[ ${DOTNET_VERSION} = "6"* ]]; then
- if ! (apt-get install -yq ${DOTNET_PACKAGE}); then
- echo "Failed to install 'dotnet6' package from default apt repo."
- return 1
- fi
+ # Add symlink for current
+ CURRENT_DIR="${TARGET_DOTNET_ROOT}/current"
+ if [[ -d "${CURRENT_DIR}" ]]; then
+ rm -rf "${CURRENT_DIR}"
+ fi
+ mkdir -p "${TARGET_DOTNET_ROOT}"
+ local dotnet_installed_version="$(dotnet --version)"
+ # See if its the distro version
+ if [[ "$(dotnet --info)" == *"Base Path: /usr/lib/dotnet/dotnet${dotnet_installed_version:0:1}-${dotnet_installed_version}"* ]]; then
+ ln -s "/usr/lib/dotnet/dotnet${dotnet_installed_version:0:1}" "${CURRENT_DIR}"
else
- echo "The provided dotnet version is not distributed in this distro's default apt repo."
- return 1
+ # Location used by MS repo versions
+ ln -s "/usr/share/dotnet" "${CURRENT_DIR}"
fi
}
# Find and extract .NET binary download details based on user-requested version
# args:
# sdk_or_runtime $1
+# dotnet_version_to_download $2
# exports:
# DOTNET_DOWNLOAD_URL
# DOTNET_DOWNLOAD_HASH
# DOTNET_DOWNLOAD_NAME
get_full_version_details() {
local sdk_or_runtime="$1"
- local VERSION="$2"
local architecture
local dotnet_channel_version
local dotnet_releases_url
@@ -267,6 +258,7 @@ get_full_version_details() {
local dotnet_latest_version
local dotnet_download_details
+ export DOTNET_DOWNLOAD_VERSION="$2"
export DOTNET_DOWNLOAD_URL
export DOTNET_DOWNLOAD_HASH
export DOTNET_DOWNLOAD_NAME
@@ -275,11 +267,11 @@ get_full_version_details() {
architecture="$(get_architecture_name_for_target_os)"
# Set VERSION to empty string to ensure jq includes all .NET versions in reverse sort below
- if [ "${VERSION}" = "latest" ]; then
- VERSION=""
+ if [ "${DOTNET_DOWNLOAD_VERSION}" = "latest" ]; then
+ DOTNET_DOWNLOAD_VERSION=""
fi
- dotnet_patchless_version="$(echo "${VERSION}" | cut -d "." --field=1,2)"
+ dotnet_patchless_version="$(echo "${DOTNET_DOWNLOAD_VERSION}" | cut -d "." --field=1,2)"
set +e
dotnet_channel_version="$(curl -s "${DOTNET_CDN_FEED_URI}/dotnet/release-metadata/releases-index.json" | jq -r --arg channel_version "${dotnet_patchless_version}" '[."releases-index"[]] | sort_by(."channel-version") | reverse | map( select(."channel-version" | startswith($channel_version))) | first | ."channel-version"')"
@@ -299,22 +291,22 @@ get_full_version_details() {
if [ -n "${dotnet_releases_json}" ] && [[ ! "${dotnet_releases_json}" = *"Error"* ]]; then
dotnet_latest_version="$(echo "${dotnet_releases_json}" | jq -r --arg sdk_or_runtime "${sdk_or_runtime}" '."latest-\($sdk_or_runtime)"')"
# If user-specified version has 2 or more dots, use it as is. Otherwise use latest version.
- if [ "$(echo "${VERSION}" | grep -o "\." | wc -l)" -lt "2" ]; then
- VERSION="${dotnet_latest_version}"
+ if [ "$(echo "${DOTNET_DOWNLOAD_VERSION}" | grep -o "\." | wc -l)" -lt "2" ]; then
+ DOTNET_DOWNLOAD_VERSION="${dotnet_latest_version}"
fi
- dotnet_download_details="$(echo "${dotnet_releases_json}" | jq -r --arg sdk_or_runtime "${sdk_or_runtime}" --arg dotnet_version "${VERSION}" --arg arch "${architecture}" '.releases[]."\($sdk_or_runtime)" | select(.version==$dotnet_version) | .files[] | select(.name=="dotnet-\($sdk_or_runtime)-linux-\($arch).tar.gz")')"
+ dotnet_download_details="$(echo "${dotnet_releases_json}" | jq -r --arg sdk_or_runtime "${sdk_or_runtime}" --arg dotnet_version "${DOTNET_DOWNLOAD_VERSION}" --arg arch "${architecture}" '.releases[]."\($sdk_or_runtime)" | select(.version==$dotnet_version) | .files[] | select(.name=="dotnet-\($sdk_or_runtime)-linux-\($arch).tar.gz")')"
if [ -n "${dotnet_download_details}" ]; then
- echo "Found .NET binary version ${VERSION}"
+ echo "Found .NET binary version ${DOTNET_DOWNLOAD_VERSION}"
DOTNET_DOWNLOAD_URL="$(echo "${dotnet_download_details}" | jq -r '.url')"
DOTNET_DOWNLOAD_HASH="$(echo "${dotnet_download_details}" | jq -r '.hash')"
DOTNET_DOWNLOAD_NAME="$(echo "${dotnet_download_details}" | jq -r '.name')"
else
- err "Unable to find .NET binary for version ${VERSION}"
+ err "Unable to find .NET binary for version ${DOTNET_DOWNLOAD_VERSION}"
exit 1
fi
else
- err "Unable to find .NET release details for version ${VERSION} at ${dotnet_releases_url}"
+ err "Unable to find .NET release details for version ${DOTNET_DOWNLOAD_VERSION} at ${dotnet_releases_url}"
exit 1
fi
}
@@ -322,7 +314,7 @@ get_full_version_details() {
# Install .NET CLI using the .NET releases url
install_using_dotnet_releases_url() {
local sdk_or_runtime="$1"
- local VERSION="$2"
+ local version="$2"
# Check listed package dependecies and install them if they are not already installed.
# NOTE: icu-devtools is a small package with similar dependecies to .NET.
@@ -336,14 +328,14 @@ install_using_dotnet_releases_url() {
if [[ "${DOTNET_VERSION_CODENAMES_REQUIRE_OLDER_LIBSSL_1}" = *"${VERSION_CODENAME}"* ]]; then
check_packages libssl1.1
else
- check_packages libssl3.0
+ check_packages libssl3
fi
- get_full_version_details "${sdk_or_runtime}" "${VERSION}"
+ get_full_version_details "${sdk_or_runtime}" "${version}"
- DOTNET_INSTALL_PATH="${TARGET_DOTNET_ROOT}/${VERSION}"
+ DOTNET_INSTALL_PATH="${TARGET_DOTNET_ROOT}/${DOTNET_DOWNLOAD_VERSION}"
if [ -d "${DOTNET_INSTALL_PATH}" ]; then
- echo "(!) Dotnet version ${VERSION} already exists."
+ echo "(!) Dotnet version ${DOTNET_DOWNLOAD_VERSION} already exists."
exit 1
fi
# exports DOTNET_DOWNLOAD_URL, DOTNET_DOWNLOAD_HASH, DOTNET_DOWNLOAD_NAME
@@ -432,7 +424,7 @@ CHANGE_OWNERSHIP="false"
if [[ "${DOTNET_ARCHIVE_ARCHITECTURES}" = *"${architecture}"* ]] && [[ "${DOTNET_ARCHIVE_VERSION_CODENAMES}" = *"${VERSION_CODENAME}"* ]] && [[ "${INSTALL_USING_APT}" = "true" ]]; then
echo "Detected ${VERSION_CODENAME} on ${architecture}. Attempting to install dotnet from apt"
- install_using_default_apt_repo || install_using_apt_from_microsoft_repo "${DOTNET_SDK_OR_RUNTIME}"
+ install_using_apt "${DOTNET_SDK_OR_RUNTIME}" "${DOTNET_VERSION}" false || install_using_apt "${DOTNET_SDK_OR_RUNTIME}" "${DOTNET_VERSION}" true
if [ "$?" != 0 ]; then
echo "Could not install requested version from apt on current distribution."
exit 1
diff --git a/test/dotnet/install_additional_dotnet.sh b/test/dotnet/install_additional_dotnet.sh
index fdb2da7..e69c7dc 100644
--- a/test/dotnet/install_additional_dotnet.sh
+++ b/test/dotnet/install_additional_dotnet.sh
@@ -5,9 +5,13 @@ set -e
# Optional: Import test library
source dev-container-features-test-lib
-check "dotnet version 6.0.301 installed as default" dotnet --version | grep 6.0.301
-check "dotnet version 5.0 installed" ls -l /usr/local/dotnet | grep 5.0
-check "dotnet version 3.1.420 installed" ls -l /usr/local/dotnet | grep 3.1.420
+check "dotnet version 6.0.301 installed as default" bash -c "dotnet --version | grep 6.0.301"
+check "dotnet version 5.0 installed" bash -c "ls -l /usr/local/dotnet | grep 5.0"
+check "dotnet version 3.1.420 installed" bash -c "ls -l /usr/local/dotnet | grep 3.1.420"
+
+# Verify current symlink exists and works
+check "current link dotnet" /usr/local/dotnet/current/dotnet --info
+check "current link sdk" ls -l /usr/local/dotnet/current/sdk
# Report result
reportResults
diff --git a/test/dotnet/install_dotnet_3.sh b/test/dotnet/install_dotnet_3.sh
index 0d05215..51d871b 100644
--- a/test/dotnet/install_dotnet_3.sh
+++ b/test/dotnet/install_dotnet_3.sh
@@ -6,8 +6,12 @@ set -e
source dev-container-features-test-lib
check "dotnet sdks" dotnet --list-sdks
-check "some major version of dotnet 3 is installed" dotnet --list-sdks | grep '3\.[0-9]*\.[0-9]*'
-check "dotnet version 3 installed" ls -l /usr/share/dotnet/sdk | grep '3\.[0-9]*\.[0-9]*'
+check "some major version of dotnet 3 is installed" bash -c "dotnet --list-sdks | grep '3\.[0-9]*\.[0-9]*'"
+check "dotnet version 3 installed" bash -c "ls -l /usr/share/dotnet/sdk | grep '3\.[0-9]*\.[0-9]*'"
+
+# Verify current symlink exists and works
+check "current link dotnet" /usr/local/dotnet/current/dotnet --info
+check "current link sdk" ls -l /usr/local/dotnet/current/sdk
# Report result
reportResults
diff --git a/test/dotnet/install_dotnet_5.sh b/test/dotnet/install_dotnet_5.sh
deleted file mode 100644
index 5f48eb1..0000000
--- a/test/dotnet/install_dotnet_5.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/bash
-
-set -e
-
-# Optional: Import test library
-source dev-container-features-test-lib
-
-check "dotnet sdks" dotnet --list-sdks
-check "some major version of dotnet 5 is installed" dotnet --list-sdks | grep '5\.[0-9]*\.[0-9]*'
-check "dotnet version 5 installed" ls -l /usr/share/dotnet/sdk | grep '5\.[0-9]*\.[0-9]*'
-
-
-# Report result
-reportResults
diff --git a/test/dotnet/install_dotnet_6_bullseye.sh b/test/dotnet/install_dotnet_6_bullseye.sh
new file mode 100644
index 0000000..758f040
--- /dev/null
+++ b/test/dotnet/install_dotnet_6_bullseye.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+set -e
+
+# Optional: Import test library
+source dev-container-features-test-lib
+
+check "dotnet sdks" dotnet --list-sdks
+check "some major version of dotnet 6 is installed" bash -c "dotnet --list-sdks | grep '6\.[0-9]*\.[0-9]*'"
+check "dotnet version 6 installed" bash -c "ls -l /usr/share/dotnet/sdk | grep '6\.[0-9]*\.[0-9]*'"
+
+# Verify current symlink exists and works
+check "current link dotnet" /usr/local/dotnet/current/dotnet --info
+check "current link sdk" ls -l /usr/local/dotnet/current/sdk
+
+# Report result
+reportResults
diff --git a/test/dotnet/install_dotnet_6_focal.sh b/test/dotnet/install_dotnet_6_focal.sh
new file mode 100644
index 0000000..758f040
--- /dev/null
+++ b/test/dotnet/install_dotnet_6_focal.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+set -e
+
+# Optional: Import test library
+source dev-container-features-test-lib
+
+check "dotnet sdks" dotnet --list-sdks
+check "some major version of dotnet 6 is installed" bash -c "dotnet --list-sdks | grep '6\.[0-9]*\.[0-9]*'"
+check "dotnet version 6 installed" bash -c "ls -l /usr/share/dotnet/sdk | grep '6\.[0-9]*\.[0-9]*'"
+
+# Verify current symlink exists and works
+check "current link dotnet" /usr/local/dotnet/current/dotnet --info
+check "current link sdk" ls -l /usr/local/dotnet/current/sdk
+
+# Report result
+reportResults
diff --git a/test/dotnet/install_dotnet_7_bullseye.sh b/test/dotnet/install_dotnet_7_bullseye.sh
new file mode 100644
index 0000000..2c015fc
--- /dev/null
+++ b/test/dotnet/install_dotnet_7_bullseye.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+set -e
+
+# Optional: Import test library
+source dev-container-features-test-lib
+
+check "dotnet sdks" dotnet --list-sdks
+check "some major version of dotnet 7 is installed" bash -c "dotnet --list-sdks | grep '7\.[0-9]*\.[0-9]*'"
+check "dotnet version 7 installed" bash -c "ls -l /usr/share/dotnet/sdk | grep '7\.[0-9]*\.[0-9]*'"
+
+# Verify current symlink exists and works
+check "current link dotnet" /usr/local/dotnet/current/dotnet --info
+check "current link sdk" ls -l /usr/local/dotnet/current/sdk
+
+# Report result
+reportResults
diff --git a/test/dotnet/install_dotnet_7_jammy.sh b/test/dotnet/install_dotnet_7_jammy.sh
new file mode 100644
index 0000000..2c015fc
--- /dev/null
+++ b/test/dotnet/install_dotnet_7_jammy.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+set -e
+
+# Optional: Import test library
+source dev-container-features-test-lib
+
+check "dotnet sdks" dotnet --list-sdks
+check "some major version of dotnet 7 is installed" bash -c "dotnet --list-sdks | grep '7\.[0-9]*\.[0-9]*'"
+check "dotnet version 7 installed" bash -c "ls -l /usr/share/dotnet/sdk | grep '7\.[0-9]*\.[0-9]*'"
+
+# Verify current symlink exists and works
+check "current link dotnet" /usr/local/dotnet/current/dotnet --info
+check "current link sdk" ls -l /usr/local/dotnet/current/sdk
+
+# Report result
+reportResults
diff --git a/test/dotnet/install_dotnet_latest.sh b/test/dotnet/install_dotnet_latest.sh
new file mode 100644
index 0000000..2c015fc
--- /dev/null
+++ b/test/dotnet/install_dotnet_latest.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+set -e
+
+# Optional: Import test library
+source dev-container-features-test-lib
+
+check "dotnet sdks" dotnet --list-sdks
+check "some major version of dotnet 7 is installed" bash -c "dotnet --list-sdks | grep '7\.[0-9]*\.[0-9]*'"
+check "dotnet version 7 installed" bash -c "ls -l /usr/share/dotnet/sdk | grep '7\.[0-9]*\.[0-9]*'"
+
+# Verify current symlink exists and works
+check "current link dotnet" /usr/local/dotnet/current/dotnet --info
+check "current link sdk" ls -l /usr/local/dotnet/current/sdk
+
+# Report result
+reportResults
diff --git a/test/dotnet/install_dotnet_lts.sh b/test/dotnet/install_dotnet_lts.sh
new file mode 100644
index 0000000..758f040
--- /dev/null
+++ b/test/dotnet/install_dotnet_lts.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+set -e
+
+# Optional: Import test library
+source dev-container-features-test-lib
+
+check "dotnet sdks" dotnet --list-sdks
+check "some major version of dotnet 6 is installed" bash -c "dotnet --list-sdks | grep '6\.[0-9]*\.[0-9]*'"
+check "dotnet version 6 installed" bash -c "ls -l /usr/share/dotnet/sdk | grep '6\.[0-9]*\.[0-9]*'"
+
+# Verify current symlink exists and works
+check "current link dotnet" /usr/local/dotnet/current/dotnet --info
+check "current link sdk" ls -l /usr/local/dotnet/current/sdk
+
+# Report result
+reportResults
diff --git a/test/dotnet/install_wo_apt.sh b/test/dotnet/install_wo_apt.sh
new file mode 100644
index 0000000..a1745c5
--- /dev/null
+++ b/test/dotnet/install_wo_apt.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+set -e
+
+# Optional: Import test library
+source dev-container-features-test-lib
+
+check "dotnet sdks" dotnet --list-sdks
+check "some major version of dotnet 7 is installed" bash -c "dotnet --list-sdks | grep '7\.[0-9]*\.[0-9]*'"
+check "dotnet version 7 installed" bash -c "ls -l /usr/local/dotnet | grep '7\.[0-9]*\.[0-9]*'"
+
+# Verify current symlink exists and works
+check "current link dotnet" /usr/local/dotnet/current/dotnet --info
+check "current link sdk" ls -l /usr/local/dotnet/current/sdk
+
+# Report result
+reportResults
diff --git a/test/dotnet/scenarios.json b/test/dotnet/scenarios.json
index edf4a75..37f83d5 100644
--- a/test/dotnet/scenarios.json
+++ b/test/dotnet/scenarios.json
@@ -16,11 +16,60 @@
}
}
},
- "install_dotnet_5": {
+ "install_dotnet_6_bullseye": {
+ "image": "debian:bullseye",
+ "features": {
+ "dotnet": {
+ "version": "6"
+ }
+ }
+ },
+ "install_dotnet_6_focal": {
"image": "ubuntu:focal",
"features": {
"dotnet": {
- "version": "5"
+ "version": "6"
+ }
+ }
+ },
+ "install_dotnet_7_bullseye": {
+ "image": "debian:bullseye",
+ "features": {
+ "dotnet": {
+ "version": "7"
+ }
+ }
+ },
+ "install_dotnet_7_jammy": {
+ "image": "ubuntu:jammy",
+ "features": {
+ "dotnet": {
+ "version": "7"
+ }
+ }
+ },
+ "install_dotnet_latest": {
+ "image": "ubuntu:jammy",
+ "features": {
+ "dotnet": {
+ "version": "latest"
+ }
+ }
+ },
+ "install_dotnet_lts": {
+ "image": "ubuntu:focal",
+ "features": {
+ "dotnet": {
+ "version": "lts"
+ }
+ }
+ },
+ "install_wo_apt": {
+ "image": "ubuntu:jammy",
+ "features": {
+ "dotnet": {
+ "version": "7",
+ "installUsingApt": false
}
}
}
diff --git a/test/dotnet/test.sh b/test/dotnet/test.sh
index a16f91d..7eb0cf6 100755
--- a/test/dotnet/test.sh
+++ b/test/dotnet/test.sh
@@ -11,7 +11,11 @@ check "sdks" dotnet --list-sdks
check "version" dotnet --version
echo "Validating expected version present..."
-check "some major version of dotnet 6 is installed" dotnet --version | grep '6\.[0-9]*\.[0-9]*'
+check "some major version of dotnet 7 is installed" bash -c "dotnet --version | grep '7\.[0-9]*\.[0-9]*'"
+
+# Verify current symlink exists and works
+check "current link dotnet" /usr/local/dotnet/current/dotnet --info
+check "current link sdk" ls -l /usr/local/dotnet/current/sdk
# Report result
reportResults \ No newline at end of file