From 7ff1d71410bada57a47499504d37bb651ee568c3 Mon Sep 17 00:00:00 2001 From: sireeshajonnalagadda Date: Wed, 26 Mar 2025 05:57:19 +0000 Subject: [PATCH 1/4] added tdnf package manager and some checks for Azure linux --- test/common-utils/Azure-linux-CU.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 test/common-utils/Azure-linux-CU.sh diff --git a/test/common-utils/Azure-linux-CU.sh b/test/common-utils/Azure-linux-CU.sh new file mode 100644 index 000000000..eeba25d10 --- /dev/null +++ b/test/common-utils/Azure-linux-CU.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +set -e + +# Optional: Import test library +source dev-container-features-test-lib + +# Load Linux distribution info +. /etc/os-release + +# Check if the current user is root +check "root user" test "$(whoami)" = "root" + +# Check if the Linux distro is Azure Linux +check "azurelinux distro" test "$ID" = "azurelinux" + +# Definition specific tests +check "curl" curl --version +check "jq" jq --version + +# Report result +reportResults From 526ef43ae97b0e24f17f4b231ae7dd1b0cf5e363 Mon Sep 17 00:00:00 2001 From: sireeshajonnalagadda Date: Wed, 26 Mar 2025 06:16:22 +0000 Subject: [PATCH 2/4] added tdnf package manager and some checks for Azure linux --- src/common-utils/install.sh | 4 +++- src/common-utils/main.sh | 20 +++++++++++++------- test/common-utils/scenarios.json | 8 ++++++++ 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/common-utils/install.sh b/src/common-utils/install.sh index 8f1ece4d7..a89490347 100755 --- a/src/common-utils/install.sh +++ b/src/common-utils/install.sh @@ -31,6 +31,8 @@ fi if [ "${ID}" = "alpine" ]; then apk add --no-cache bash fi - +if [ "${ID}" = "azurelinux" ]; then + tdnf install -y curl git +fi exec /bin/bash "$(dirname $0)/main.sh" "$@" exit $? diff --git a/src/common-utils/main.sh b/src/common-utils/main.sh index b5fe11f57..652461a51 100644 --- a/src/common-utils/main.sh +++ b/src/common-utils/main.sh @@ -161,12 +161,18 @@ install_redhat_packages() { local package_list="" local remove_epel="false" local install_cmd=microdnf - if ! type microdnf > /dev/null 2>&1; then - install_cmd=dnf - if ! type dnf > /dev/null 2>&1; then - install_cmd=yum - fi - fi + if type microdnf > /dev/null 2>&1; then + install_cmd=dnf + elif type tdnf > /dev/null 2>&1; then + install_cmd=tdnf + elif type dnf > /dev/null 2>&1; then + install_cmd=dnf + elif type yum > /dev/null 2>&1; then + install_cmd=yum + else + echo "Unable to find 'tdnf', 'dnf', or 'yum' package manager. Exiting." + exit 1 +fi if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then package_list="${package_list} \ @@ -344,7 +350,7 @@ chmod +x /etc/profile.d/00-restore-env.sh # Get an adjusted ID independent of distro variants if [ "${ID}" = "debian" ] || [ "${ID_LIKE}" = "debian" ]; then ADJUSTED_ID="debian" -elif [[ "${ID}" = "rhel" || "${ID}" = "fedora" || "${ID}" = "mariner" || "${ID_LIKE}" = *"rhel"* || "${ID_LIKE}" = *"fedora"* || "${ID_LIKE}" = *"mariner"* ]]; then +elif [[ "${ID}" = "rhel" || "${ID}" = "fedora" || "${ID}" = "azurelinux" || "${ID}" = "mariner" || "${ID_LIKE}" = *"rhel"* || "${ID_LIKE}" = *"fedora"* || "${ID_LIKE}" = *"mariner"* ]]; then ADJUSTED_ID="rhel" VERSION_CODENAME="${ID}${VERSION_ID}" elif [ "${ID}" = "alpine" ]; then diff --git a/test/common-utils/scenarios.json b/test/common-utils/scenarios.json index a929f534a..05d8343fa 100644 --- a/test/common-utils/scenarios.json +++ b/test/common-utils/scenarios.json @@ -292,5 +292,13 @@ "features": { "common-utils": {} } + }, + "Azure-linux-CU": { + "image": "mcr.microsoft.com/dotnet/sdk:8.0-azurelinux3.0", + "features": { + "common-utils": { + "remoteUser": "vscode" + } + } } } \ No newline at end of file From 2a01aeeb765296a0d1cd771f4cb343af4abb1175 Mon Sep 17 00:00:00 2001 From: sireeshajonnalagadda Date: Wed, 26 Mar 2025 06:36:40 +0000 Subject: [PATCH 3/4] modified install_cmd --- src/common-utils/main.sh | 2 +- test/common-utils/scenarios.json | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/common-utils/main.sh b/src/common-utils/main.sh index 652461a51..aa3cef4ec 100644 --- a/src/common-utils/main.sh +++ b/src/common-utils/main.sh @@ -166,7 +166,7 @@ install_redhat_packages() { elif type tdnf > /dev/null 2>&1; then install_cmd=tdnf elif type dnf > /dev/null 2>&1; then - install_cmd=dnf + install_cmd=tdnf elif type yum > /dev/null 2>&1; then install_cmd=yum else diff --git a/test/common-utils/scenarios.json b/test/common-utils/scenarios.json index 05d8343fa..4ffbde1ac 100644 --- a/test/common-utils/scenarios.json +++ b/test/common-utils/scenarios.json @@ -296,9 +296,7 @@ "Azure-linux-CU": { "image": "mcr.microsoft.com/dotnet/sdk:8.0-azurelinux3.0", "features": { - "common-utils": { - "remoteUser": "vscode" - } + "common-utils": {} } } } \ No newline at end of file From 10d52e9b79aaee04f6706c715109690eaff5b163 Mon Sep 17 00:00:00 2001 From: sireeshajonnalagadda Date: Wed, 26 Mar 2025 06:50:27 +0000 Subject: [PATCH 4/4] modified install_cmd --- src/common-utils/main.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common-utils/main.sh b/src/common-utils/main.sh index aa3cef4ec..abef18430 100644 --- a/src/common-utils/main.sh +++ b/src/common-utils/main.sh @@ -162,11 +162,11 @@ install_redhat_packages() { local remove_epel="false" local install_cmd=microdnf if type microdnf > /dev/null 2>&1; then - install_cmd=dnf + install_cmd=microdnf elif type tdnf > /dev/null 2>&1; then install_cmd=tdnf elif type dnf > /dev/null 2>&1; then - install_cmd=tdnf + install_cmd=dnf elif type yum > /dev/null 2>&1; then install_cmd=yum else