diff options
author | Paul Yu <paul.d.yu@gmail.com> | 2022-11-23 23:18:22 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-23 23:18:22 +0300 |
commit | 133b4cf23c6e4d6679940a8806f76877790c7f45 (patch) | |
tree | 017c6027e84089f6f99e862dd9c7bc9858e9b3a2 /src/azure-cli/install.sh | |
parent | c4648ab98cdeeb520e7e629c5db4a471ec802954 (diff) |
Optionally install Azure Bicep as part of azure-cli feature (#305)
* Adding azure-cli bicep installer to correctly install on arm64 containers
* Adding a few updates following @joshspicer's review.
Diffstat (limited to 'src/azure-cli/install.sh')
-rwxr-xr-x | src/azure-cli/install.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/azure-cli/install.sh b/src/azure-cli/install.sh index 99b4af5..31bc6d8 100755 --- a/src/azure-cli/install.sh +++ b/src/azure-cli/install.sh @@ -14,6 +14,7 @@ rm -rf /var/lib/apt/lists/* AZ_VERSION=${VERSION:-"latest"} AZ_EXTENSIONS=${EXTENSIONS} +AZ_INSTALLBICEP=${INSTALLBICEP:-false} MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc" AZCLI_ARCHIVE_ARCHITECTURES="amd64" @@ -197,6 +198,30 @@ if [ ${#AZ_EXTENSIONS[@]} -gt 0 ]; then done fi +if [ "${AZ_INSTALLBICEP}" = "true" ]; then + # Install dependencies + check_packages apt-transport-https curl + + # Properly install Azure Bicep based on current architecture + # The `az bicep install` command installs the linux-x64 binary even on arm64 devcontainers + # 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 [ "${architecture}" = "arm64" ]; then + curl -Lo bicep https://github.com/Azure/bicep/releases/latest/download/bicep-linux-arm64 + else + curl -Lo bicep https://github.com/Azure/bicep/releases/latest/download/bicep-linux-x64 + fi + + chmod +x ./bicep + mv ./bicep /usr/local/bin/bicep + + # Add a symlink so bicep can be accessed as a standalone executable or as part of az + mkdir -p ${_REMOTE_USER_HOME}/.azure/bin + chown -hR ${_REMOTE_USER}:${_REMOTE_USER} ${_REMOTE_USER_HOME}/.azure + ln -s /usr/local/bin/bicep ${_REMOTE_USER_HOME}/.azure/bin/bicep +fi + # Clean up rm -rf /var/lib/apt/lists/* |