Skip to content

Commit

Permalink
[azure-cli]: add bicepVersion for use with installBicep
Browse files Browse the repository at this point in the history
Add `bicepVersion` parameter (defaulting to `latest`) to optionally
specify a specific Bicep version when `installBicep` is `true`.
  • Loading branch information
Jurjen Oskam authored and Jurjen Oskam committed Dec 19, 2024
1 parent 8e8e14f commit 183c016
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
10 changes: 9 additions & 1 deletion src/azure-cli/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "azure-cli",
"version": "1.2.5",
"version": "1.2.6",
"name": "Azure CLI",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/azure-cli",
"description": "Installs the Azure CLI along with needed dependencies. Useful for base Dockerfiles that often are missing required install dependencies like gpg.",
Expand All @@ -23,6 +23,14 @@
"description": "Optionally install Azure Bicep",
"default": false
},
"bicepVersion": {
"type": "string",
"proposals": [
"latest"
],
"default": "latest",
"description": "Select or enter a Bicep version. ('latest' or a specic version such as 'v0.31.92')"
},
"installUsingPython": {
"type": "boolean",
"description": "Install Azure CLI using Python instead of pipx",
Expand Down
11 changes: 9 additions & 2 deletions src/azure-cli/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ rm -rf /var/lib/apt/lists/*
AZ_VERSION=${VERSION:-"latest"}
AZ_EXTENSIONS=${EXTENSIONS}
AZ_INSTALLBICEP=${INSTALLBICEP:-false}
AZ_BICEPVERSION=${BICEPVERSION:-latest}
INSTALL_USING_PYTHON=${INSTALLUSINGPYTHON:-false}
MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc"
AZCLI_ARCHIVE_ARCHITECTURES="amd64 arm64"
Expand Down Expand Up @@ -229,10 +230,16 @@ if [ "${AZ_INSTALLBICEP}" = "true" ]; then
# The `az bicep install --target-platform` could be a solution; however, linux-arm64 is not an allowed value for this argument yet
# Manually installing Bicep and moving to the appropriate directory where az expects it to be

if [ "${BICEPVERSION}" = "latest" ]; then
bicep_download_path="https://github.com/Azure/bicep/releases/latest/download"
else
bicep_download_path="https://github.com/Azure/bicep/releases/download/${BICEPVERSION}"
fi

if [ "${architecture}" = "arm64" ]; then
curl -Lo bicep https://github.com/Azure/bicep/releases/latest/download/bicep-linux-arm64
curl -Lo bicep ${bicep_download_path}/bicep-linux-arm64
else
curl -Lo bicep https://github.com/Azure/bicep/releases/latest/download/bicep-linux-x64
curl -Lo bicep ${bicep_download_path}/bicep-linux-x64
fi

chmod +x ./bicep
Expand Down

0 comments on commit 183c016

Please sign in to comment.