Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add azd devcontainer feature (#1118)
* Adding devcontainer definition - #1095 * Update ext/devcontainer/devcontainer-feature.json * adding workflow to publish devcontainer image * Update ext/devcontainer/devcontainer-feature.json * Update ext/devcontainer/README.md * adding tests and supporting the expected folder structure * ensuring curl is available and fixing tests * Update ext/devcontainer/src/azd/install.sh Co-authored-by: Daniel Jurek <djurek@microsoft.com> * combining devcontainer workflows into a single workflow - test jobs need to pass before deploy passes - deploy job linked to environment for approval * Updating based on some feedback Turns out that the script being run was uninstall not install, whoops * Apply suggestions from code review Co-authored-by: hemarina <104857065+hemarina@users.noreply.github.com> * Apply suggestions from code review * Update ext/devcontainer/src/azd/README.md Co-authored-by: Aaron Powell <me@aaron-powell.com> * Update ext/devcontainer/src/azd/install.sh Co-authored-by: Aaron Powell <me@aaron-powell.com> * Update ext/devcontainer/src/azd/install.sh Co-authored-by: hemarina <104857065+hemarina@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: hemarina <104857065+hemarina@users.noreply.github.com> * Update ext/devcontainer/src/azd/devcontainer-feature.json Co-authored-by: Matt Ellis <matt.ellis@microsoft.com> * Update ext/devcontainer/src/azd/README.md * add xdg-utils/version due to local test/feedback * remove since vscode-node-azure-pack contains it * add auto pr for documentation update * separate release and test, add permission * add workflow test yml * add PAT for release tag --------- Co-authored-by: Daniel Jurek <djurek@microsoft.com> Co-authored-by: Victor Vazquez <vhvb1989@gmail.com> Co-authored-by: hemarina <104857065+hemarina@users.noreply.github.com> Co-authored-by: Matt Ellis <matt.ellis@microsoft.com> Co-authored-by: hemarina <hemarina@microsoft.com>
- Loading branch information
1 parent
5384149
commit fa3412e
Showing
6 changed files
with
184 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Release dev container feature image | ||
|
||
env: | ||
IMAGE_NAME: ${{ github.repository }} | ||
REGISTRY: ghcr.io | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
call-workflow-test: | ||
uses: ".github/workflows/devcontainer-feature-test.yml" | ||
|
||
deploy: | ||
if: ${{ github.ref == 'refs/heads/main' }} | ||
runs-on: ubuntu-latest | ||
needs: call-workflow-test | ||
permissions: | ||
contents: write | ||
packages: write | ||
pull-requests: write | ||
environment: | ||
name: deploy-devcontainer-feature | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: "Publish Features" | ||
uses: devcontainers/action@v1 | ||
with: | ||
publish-features: "true" | ||
base-path-to-features: "./ext/devcontainer" | ||
generate-docs: "false" | ||
|
||
env: | ||
GITHUB_TOKEN: ${{ secrets.PAT }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Test dev container feature | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
paths: | ||
- "ext/devcontainer/**" | ||
- ".github/workflows/devcontainer-feature-test.yml" | ||
branches: [main] | ||
workflow_call: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
continue-on-error: true | ||
strategy: | ||
matrix: | ||
baseImage: | ||
[ | ||
"ubuntu:focal", | ||
"ubuntu:jammy", | ||
"ubuntu:bionic", | ||
"debian:11", | ||
"debian:10", | ||
"mcr.microsoft.com/devcontainers/base:ubuntu", | ||
"mcr.microsoft.com/devcontainers/base:debian", | ||
] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: "Install latest devcontainer CLI" | ||
run: npm install -g @devcontainers/cli | ||
|
||
- name: "Generating tests for 'azd' against '${{ matrix.baseImage }}'" | ||
run: devcontainer features test -f azd -i ${{ matrix.baseImage }} . | ||
working-directory: ./ext/devcontainer | ||
|
||
test-scenarios: | ||
runs-on: ubuntu-latest | ||
continue-on-error: true | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: "Install latest devcontainer CLI" | ||
run: npm install -g @devcontainers/cli | ||
|
||
- name: "Testing 'azd' scenarios" | ||
run: devcontainer features test -f azd --skip-autogenerated . | ||
working-directory: ./ext/devcontainer | ||
|
||
test-global: | ||
runs-on: ubuntu-latest | ||
continue-on-error: true | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: "Install latest devcontainer CLI" | ||
run: npm install -g @devcontainers/cli | ||
|
||
- name: "Testing global scenarios" | ||
run: devcontainer features test --global-scenarios-only . | ||
working-directory: ./ext/devcontainer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Azure Developer CLI (azd) | ||
|
||
Installs the [Azure Developer CLI](https://github.com/Azure/azure-dev) along with needed dependencies. | ||
|
||
## Example Usage | ||
|
||
```json | ||
"features": { | ||
"ghcr.io/azure/azure-dev/azd:1": { | ||
"version": "stable" | ||
} | ||
} | ||
``` | ||
|
||
## Options | ||
|
||
| Options Id | Description | Type | Default Value | | ||
|-----|-----|-----|-----| | ||
| version | Select or enter an Azure Developer CLI version. (Available versions may vary by Linux distribution.) | string | stable | | ||
|
||
## Customizations | ||
|
||
### VS Code Extensions | ||
|
||
- `ms-azuretools.azure-dev` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"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.)" | ||
} | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"ms-azuretools.vscode-bicep", | ||
"ms-vscode.vscode-node-azure-pack" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
#------------------------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. | ||
#------------------------------------------------------------------------------------------------------------- | ||
|
||
AZD_VERSION=${VERSION:-"stable"} | ||
|
||
check_packages() { | ||
if ! dpkg -s "$@" > /dev/null 2>&1; then | ||
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then | ||
echo "Running apt-get update..." | ||
apt-get update -y | ||
fi | ||
apt-get -y install --no-install-recommends "$@" | ||
fi | ||
} | ||
|
||
echo "(*) Ensuring dependencies are installed" | ||
|
||
check_packages apt-transport-https curl ca-certificates xdg-utils | ||
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# Optional: Import test library | ||
source dev-container-features-test-lib | ||
|
||
# Definition specific tests | ||
check "version" azd version | ||
|
||
# Report result | ||
reportResults |