Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions ext/devcontainer/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.PHONY: test

help: ## show this help
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%s\033[0m|%s\n", $$1, $$2}' \
| column -t -s '|'

install-devcontainer-cli:
@if ! [ -x "$$(command -v devcontainer)" ]; then echo "Installing devcontainer CLI"; npm install -g @devcontainers/cli; else echo "devcontainer CLI is already installed"; fi

test: install-devcontainer-cli ## run tests
devcontainer features test --base-image mcr.microsoft.com/devcontainers/base:ubuntu
1 change: 1 addition & 0 deletions ext/devcontainer/src/azd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Select a specific `azd` version [here](https://github.com/Azure/azure-dev/releas
| Options Id | Description | Type | Default Value |
|-----|-----|-----|-----|
| version | Select or enter an Azure Developer CLI version. (Available versions may vary by Linux distribution.) | string | stable |
| extensions | Comma-separated list of Azure Developer CLI extensions to install. | string | (empty) |

## Customizations

Expand Down
49 changes: 27 additions & 22 deletions ext/devcontainer/src/azd/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
{
"id": "azd",
"version": "0.1.0",
"name": "Azure Developer CLI",
"documentationURL": "https://github.com/azure/azure-dev/tree/main/ext/devcontainer/src/azd",
"description": "Installs the Azure Developer CLI along with needed dependencies.",
"options": {
"version": {
"type": "string",
"proposals": [
"stable"
],
"default": "stable",
"description": "Select or enter an Azure Developer CLI version. (Available versions may vary by Linux distribution.)"
}
"id": "azd",
"version": "0.2.0",
"name": "Azure Developer CLI",
"documentationURL": "https://github.com/azure/azure-dev/tree/main/ext/devcontainer/src/azd",
"description": "Installs the Azure Developer CLI along with needed dependencies.",
"options": {
"version": {
"type": "string",
"proposals": [
"stable"
],
"default": "stable",
"description": "Select or enter an Azure Developer CLI version. (Available versions may vary by Linux distribution.)"
},
"customizations": {
"vscode": {
"extensions": [
"ms-azuretools.vscode-bicep",
"ms-vscode.vscode-node-azure-pack"
]
}
"extensions": {
"type": "string",
"default": "",
"description": "Optional comma separated list of Azure Developer CLI extensions to install."
}
}
},
"customizations": {
"vscode": {
"extensions": [
"ms-azuretools.vscode-bicep",
"ms-vscode.vscode-node-azure-pack"
]
}
}
}
13 changes: 13 additions & 0 deletions ext/devcontainer/src/azd/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#-------------------------------------------------------------------------------------------------------------

AZD_VERSION=${VERSION:-"stable"}
AZD_EXTENSIONS=${EXTENSIONS}

check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
Expand All @@ -24,3 +25,15 @@ check_packages $(apt-cache search '^libicu[0-9]+$' | cut -d' ' -f1)
echo "(*) Installing Azure Developer CLI"

curl -fsSL https://aka.ms/install-azd.sh | bash -s -- --version $AZD_VERSION -a $(dpkg --print-architecture)


# If Azure Developer CLI extensions are requested, loop through and install
if [ -n "${AZD_EXTENSIONS}" ]; then
echo "Installing Azure Developer CLI extensions: ${AZD_EXTENSIONS}"
extensions=(`echo "${AZD_EXTENSIONS}" | tr ',' ' '`)
for i in "${extensions[@]}"
do
echo "Installing ${i}"
su "${_REMOTE_USER}" -c "azd extension install ${i}" || continue
done
fi
10 changes: 10 additions & 0 deletions ext/devcontainer/test/azd/scenarios.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"with_extensions": {
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"azd": {
"extensions": "azure.coding-agent"
}
}
}
}
17 changes: 17 additions & 0 deletions ext/devcontainer/test/azd/with_extensions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

set -e

# Optional: Import test library
source dev-container-features-test-lib

# Definition specific tests
check "version" azd version

azd extension list --installed

matching_extension_count=$(azd extension list --installed | grep "^azure.coding-agent" | wc -l)
check "check extensions" bash -c "test \"$matching_extension_count\" -eq 1"

# Report result
reportResults
Loading