Skip to content

Commit 72df8a5

Browse files
CopilotKaniska244
andauthored
fix: azure-cli falls back to pip on unknown Ubuntu codenames (#1668)
* Initial plan * fix: azure-cli falls back to pip on unknown codenames, add resolute support - Add 'resolute' (Ubuntu 26.04) to AZCLI_ARCHIVE_VERSION_CODENAMES - Add else branch to fall back to pip when codename/arch not in allowlist - Bump feature version to 1.3.0 - Add test scenario for Ubuntu resolute * test: add scenario for pip fallback on Ubuntu plucky (25.04) Ubuntu plucky's codename is not in the apt archive allowlist, so this scenario exercises the else-branch pip fallback path. * Correcting the fallback test --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Kaniska <kaniska244@github.com>
1 parent 8bd6ad7 commit 72df8a5

5 files changed

Lines changed: 49 additions & 2 deletions

File tree

src/azure-cli/devcontainer-feature.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "azure-cli",
3-
"version": "1.2.9",
3+
"version": "1.3.0",
44
"name": "Azure CLI",
55
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/azure-cli",
66
"description": "Installs the Azure CLI along with needed dependencies. Useful for base Dockerfiles that often are missing required install dependencies like gpg.",

src/azure-cli/install.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ AZ_BICEPVERSION=${BICEPVERSION:-latest}
1919
INSTALL_USING_PYTHON=${INSTALLUSINGPYTHON:-false}
2020
MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc"
2121
AZCLI_ARCHIVE_ARCHITECTURES="amd64 arm64"
22-
AZCLI_ARCHIVE_VERSION_CODENAMES="stretch bookworm buster bullseye bionic focal jammy noble trixie"
22+
AZCLI_ARCHIVE_VERSION_CODENAMES="stretch bookworm buster bullseye bionic focal jammy noble trixie resolute"
2323

2424
if [ "$(id -u)" -ne 0 ]; then
2525
echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
@@ -200,6 +200,9 @@ CACHED_AZURE_VERSION="${AZ_VERSION}" # In case we need to fallback to pip and th
200200
if [ "${INSTALL_USING_PYTHON}" != "true" ]; then
201201
if [[ "${AZCLI_ARCHIVE_ARCHITECTURES}" = *"${architecture}"* ]] && [[ "${AZCLI_ARCHIVE_VERSION_CODENAMES}" = *"${VERSION_CODENAME}"* ]]; then
202202
install_using_apt || use_pip="true"
203+
else
204+
echo "(*) Codename '${VERSION_CODENAME}' or architecture '${architecture}' not in apt archive list, falling back to pip installation."
205+
use_pip="true"
203206
fi
204207
else
205208
use_pip="true"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Import test library for `check` command
6+
source dev-container-features-test-lib
7+
8+
# Ubuntu plucky (25.04) is NOT in the apt archive codename allowlist,
9+
# so this test validates the pip fallback path.
10+
check "version" az --version
11+
12+
# Report result
13+
reportResults
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Import test library for `check` command
6+
source dev-container-features-test-lib
7+
8+
# Check to make sure the user is vscode
9+
check "user is vscode" whoami | grep vscode
10+
11+
check "version" az --version
12+
13+
# Report result
14+
reportResults

test/azure-cli/scenarios.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
{
2+
"install_fallback_pip_ubuntu_plucky": {
3+
"image": "ubuntu:plucky",
4+
"features": {
5+
"azure-cli": {
6+
"version": "latest"
7+
}
8+
}
9+
},
210
"install_extensions_trixie": {
311
"image": "mcr.microsoft.com/devcontainers/base:trixie",
412
"user": "vscode",
@@ -102,5 +110,14 @@
102110
"moby": false
103111
}
104112
}
113+
},
114+
"install_in_ubuntu_resolute": {
115+
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
116+
"user": "vscode",
117+
"features": {
118+
"azure-cli": {
119+
"version": "latest"
120+
}
121+
}
105122
}
106123
}

0 commit comments

Comments
 (0)