Skip to content

Commit 85c0b43

Browse files
committed
Fix arm64 architecture detection
1 parent 322e3ed commit 85c0b43

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/azure-cli/azure/cli/command_modules/resource/_bicep.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,26 +285,30 @@ def _get_bicep_installed_version(bicep_executable_path):
285285
return _extract_version(installed_version_output)
286286

287287

288+
def _is_arm_architecture(machine):
289+
return machine in ("arm64", "aarch64", "aarch64_be", "armv8b", "armv8l")
290+
291+
288292
def _has_musl_library_only():
289293
return os.path.exists("/lib/ld-musl-x86_64.so.1") and not os.path.exists("/lib/x86_64-linux-gnu/libc.so.6")
290294

291295

292296
def _get_bicep_download_url(system, machine, release_tag, target_platform=None):
293297
if not target_platform:
294-
if system == "Windows" and machine == "arm64":
298+
if system == "Windows" and _is_arm_architecture(machine):
295299
target_platform = "win-arm64"
296300
elif system == "Windows":
297301
# default to x64
298302
target_platform = "win-x64"
299-
elif system == "Linux" and machine == "arm64":
303+
elif system == "Linux" and _is_arm_architecture(machine):
300304
target_platform = "linux-arm64"
301305
elif system == "Linux" and _has_musl_library_only():
302306
# check for alpine linux
303307
target_platform = "linux-musl-x64"
304308
elif system == "Linux":
305309
# default to x64
306310
target_platform = "linux-x64"
307-
elif system == "Darwin" and machine == "arm64":
311+
elif system == "Darwin" and _is_arm_architecture(machine):
308312
target_platform = "osx-arm64"
309313
elif system == "Darwin":
310314
# default to x64

src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_bicep.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,9 @@ def test_get_bicep_download_url_returns_correct_urls(self):
220220
download_url = _get_bicep_download_url("Linux", "arm64", "v0.26.54")
221221
self.assertEqual(download_url, "https://downloads.bicep.azure.com/v0.26.54/bicep-linux-arm64")
222222

223+
download_url = _get_bicep_download_url("Linux", "aarch64", "v0.26.54")
224+
self.assertEqual(download_url, "https://downloads.bicep.azure.com/v0.26.54/bicep-linux-arm64")
225+
223226
download_url = _get_bicep_download_url("Linux", "x64", "v0.26.54")
224227
self.assertEqual(download_url, "https://downloads.bicep.azure.com/v0.26.54/bicep-linux-x64")
225228

0 commit comments

Comments
 (0)