Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding devcontainer definition #1118

Merged
merged 25 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f31b702
Adding devcontainer definition - #1095
aaronpowell Nov 9, 2022
d209f2c
Update ext/devcontainer/devcontainer-feature.json
aaronpowell Nov 10, 2022
fc31aca
adding workflow to publish devcontainer image
aaronpowell Nov 10, 2022
af2416d
Update ext/devcontainer/devcontainer-feature.json
aaronpowell Nov 11, 2022
b13557d
Update ext/devcontainer/README.md
aaronpowell Nov 13, 2022
af2e87b
adding tests and supporting the expected folder structure
aaronpowell Nov 13, 2022
031080d
ensuring curl is available and fixing tests
aaronpowell Nov 13, 2022
d83de94
Update ext/devcontainer/src/azd/install.sh
aaronpowell Nov 23, 2022
0362197
combining devcontainer workflows into a single workflow
aaronpowell Nov 25, 2022
8ab490d
Merge branch 'main' of github.com:Azure/azure-dev into aaronpowell/is…
vhvb1989 Mar 21, 2023
0475953
Updating based on some feedback
aaronpowell Jun 13, 2023
a1ce72e
Apply suggestions from code review
aaronpowell Jun 21, 2023
786390a
Apply suggestions from code review
aaronpowell Jun 21, 2023
9e3f46c
Update ext/devcontainer/src/azd/README.md
hemarina Jun 27, 2023
5fdc8f2
Update ext/devcontainer/src/azd/install.sh
hemarina Jun 27, 2023
567a94e
Update ext/devcontainer/src/azd/install.sh
aaronpowell Jun 28, 2023
f1c055b
Apply suggestions from code review
aaronpowell Jun 29, 2023
0685264
Update ext/devcontainer/src/azd/devcontainer-feature.json
hemarina Jun 29, 2023
f3935bf
Update ext/devcontainer/src/azd/README.md
hemarina Jun 29, 2023
4979a83
add xdg-utils/version due to local test/feedback
hemarina Jun 30, 2023
6f2cf57
remove since vscode-node-azure-pack contains it
hemarina Jul 3, 2023
e07e302
add auto pr for documentation update
hemarina Jul 3, 2023
d81d007
separate release and test, add permission
hemarina Jul 6, 2023
a647878
add workflow test yml
hemarina Jul 6, 2023
b943911
add PAT for release tag
hemarina Jul 6, 2023
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
106 changes: 106 additions & 0 deletions .github/workflows/devcontainer-feature-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Build dev container feature image

env:
IMAGE_NAME: ${{ github.repository }}
REGISTRY: ghcr.io

on:
danieljurek marked this conversation as resolved.
Show resolved Hide resolved
workflow_dispatch:

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

deploy:
hemarina marked this conversation as resolved.
Show resolved Hide resolved
if: ${{ github.ref == 'refs/heads/main' }}
danieljurek marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
needs: [test, test-global, test-scenarios]
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: "true"
hemarina marked this conversation as resolved.
Show resolved Hide resolved

- name: Create PR for Documentation
id: push_image_info
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
hemarina marked this conversation as resolved.
Show resolved Hide resolved
run: |
set -e
echo "Start."
# Configure git and Push updates
git config --global user.email [email protected]
git config --global user.name github-actions
git config pull.rebase false
branch=automated-documentation-update-$GITHUB_RUN_ID
git checkout -b $branch
message='Automated documentation update'
# Add / update and commit
git add */**/README.md
git commit -m 'Automated documentation update [skip ci]' || export NO_UPDATES=true
# Push
if [ "$NO_UPDATES" != "true" ] ; then
git push origin "$branch"
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
/repos/${GITHUB_REPOSITORY}/pulls \
-f title="$message" \
-f body="$message" \
-f head="$branch" \
-f base='main'
hemarina marked this conversation as resolved.
Show resolved Hide resolved
fi
25 changes: 25 additions & 0 deletions ext/devcontainer/src/azd/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Azure Developer CLI (azd)
hemarina marked this conversation as resolved.
Show resolved Hide resolved

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`
25 changes: 25 additions & 0 deletions ext/devcontainer/src/azd/devcontainer-feature.json
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"
aaronpowell marked this conversation as resolved.
Show resolved Hide resolved
]
}
}
}
26 changes: 26 additions & 0 deletions ext/devcontainer/src/azd/install.sh
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)
12 changes: 12 additions & 0 deletions ext/devcontainer/test/azd/test.sh
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