Skip to content

Commit 10b6e71

Browse files
authored
Fix Azure-cli installation for trixie (#1489)
* For trixie fix azure-cli installation * rename file * missing shabang line * update version * add comments
1 parent 6e50893 commit 10b6e71

File tree

4 files changed

+42
-6
lines changed

4 files changed

+42
-6
lines changed

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.8",
3+
"version": "1.2.9",
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: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,15 @@ install_using_apt() {
9898
# Import key safely (new 'signed-by' method rather than deprecated apt-key approach) and install
9999
curl -sSL ${MICROSOFT_GPG_KEYS_URI} | gpg --dearmor > /usr/share/keyrings/microsoft-archive-keyring.gpg
100100
echo "deb [arch=${architecture} signed-by=/usr/share/keyrings/microsoft-archive-keyring.gpg] https://packages.microsoft.com/repos/azure-cli/ ${VERSION_CODENAME} main" > /etc/apt/sources.list.d/azure-cli.list
101-
apt-get update
101+
102+
# This is a workaround for the fact that Azure CLI is not yet a supported package for debian trixie. Once Azure CLI is supported we should revert to avoid script failure for non Azure CLI packages
103+
if ! (apt-get update); then
104+
echo "(!) Failed to update apt cache, removing repository file"
105+
rm -f /etc/apt/sources.list.d/azure-cli.list
106+
else
107+
echo "WARNING: apt-get update succeeded. The workaround for broken Azure CLI install on Debian Trixie may no longer be needed."
108+
echo "TODO: Consider reverting to a simple `apt-get update` if the Azure CLI repo works reliably for debian trixie"
109+
fi
102110

103111
if [ "${AZ_VERSION}" = "latest" ] || [ "${AZ_VERSION}" = "lts" ] || [ "${AZ_VERSION}" = "stable" ]; then
104112
# Empty, meaning grab the "latest" in the apt repo
@@ -135,7 +143,7 @@ install_using_pip_strategy() {
135143

136144
install_with_pipx() {
137145
echo "(*) Attempting to install globally with pipx..."
138-
local ver="$1"
146+
local ver="$1"
139147
export
140148
local
141149

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+
check "version" az --version
9+
10+
check "docker installed" bash -c "type docker"
11+
12+
# Report result
13+
reportResults

test/azure-cli/scenarios.json

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"extensions": "aks-preview,amg,containerapp"
99
}
1010
}
11-
},
11+
},
1212
"install_extensions": {
1313
"image": "mcr.microsoft.com/devcontainers/base:jammy",
1414
"user": "vscode",
@@ -39,7 +39,7 @@
3939
}
4040
}
4141
},
42-
"install_bicep_trixie": {
42+
"install_bicep_trixie": {
4343
"image": "mcr.microsoft.com/devcontainers/base:trixie",
4444
"user": "vscode",
4545
"features": {
@@ -68,7 +68,7 @@
6868
"installUsingPython": true
6969
}
7070
}
71-
},
71+
},
7272
"install_with_python_3_12_bookworm": {
7373
"image": "mcr.microsoft.com/devcontainers/python:1-3.12-bookworm",
7474
"user": "vscode",
@@ -87,5 +87,20 @@
8787
"installUsingPython": "true"
8888
}
8989
}
90+
},
91+
"install_azcli_dotnet_dockerindocker_trixie": {
92+
"image": "mcr.microsoft.com/devcontainers/dotnet:dev-10.0-preview-trixie",
93+
"user": "vscode",
94+
"features": {
95+
"azure-cli": {
96+
"version": "latest"
97+
},
98+
"dotnet": {
99+
"aspNetCoreRuntimeVersions": "8.0"
100+
},
101+
"docker-in-docker": {
102+
"moby": false
103+
}
104+
}
90105
}
91106
}

0 commit comments

Comments
 (0)