From 342796229a54d356615027e15bec899da5d24fd1 Mon Sep 17 00:00:00 2001 From: Amanda Kaufman Date: Wed, 18 May 2022 09:19:58 -0700 Subject: [PATCH 1/2] Add .vscode to gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index dfcfd56..5f6aeb5 100644 --- a/.gitignore +++ b/.gitignore @@ -348,3 +348,6 @@ MigrationBackup/ # Ionide (cross platform F# VS Code tools) working folder .ionide/ + +# VS Code +.vscode/ \ No newline at end of file From 0a7f5e4efdf005d59f9815426ab625a1e556acb7 Mon Sep 17 00:00:00 2001 From: Amanda Kaufman Date: Wed, 18 May 2022 15:28:08 -0700 Subject: [PATCH 2/2] Add files for dev container --- .devcontainer/Dockerfile | 5 +++++ .devcontainer/devcontainer-features.json | 16 ++++++++++++++ .devcontainer/devcontainer.json | 23 +++++++++++++++++++ .devcontainer/install.sh | 26 ++++++++++++++++++++++ .github/workflows/deploy-features.yml | 28 ++++++++++++++++++++++++ 5 files changed, 98 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer-features.json create mode 100644 .devcontainer/devcontainer.json create mode 100644 .devcontainer/install.sh create mode 100644 .github/workflows/deploy-features.yml diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..a7159e2 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,5 @@ +# [Choice] .NET version: 6.0, 5.0, 3.1, 6.0-bullseye, 5.0-bullseye, 3.1-bullseye, 6.0-focal, 5.0-focal, 3.1-focal +ARG VARIANT="6.0" +FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT} + +RUN pwsh -command Install-Module -Name Pester -Force -SkipPublisherCheck diff --git a/.devcontainer/devcontainer-features.json b/.devcontainer/devcontainer-features.json new file mode 100644 index 0000000..10f9134 --- /dev/null +++ b/.devcontainer/devcontainer-features.json @@ -0,0 +1,16 @@ +{ + "features": [ + { + "id": "azurebicep", + "name": "Azure Bicep", + "options": { + "version": { + "type": "string", + "default": "latest", + "description": "Specify a version of the Azure Bicep CLI" + } + }, + "entrypoint": "/usr/installbicep.sh" + } + ] +} \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..81e6c53 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,23 @@ +{ + "name": "C# (.NET)", + "build": { + "dockerfile": "Dockerfile", + "args": { + "VARIANT": "6.0", + "NODE_VERSION": "none" + } + }, + "settings": {}, + "extensions": [ + "ms-dotnettools.csharp" + ], + // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "vscode", + "features": { + "rchaganti/vsc-devcontainer-features/azurebicep" : { + "version": "latest" + }, + "azure-cli": "latest", + "powershell": "7.2" + } +} diff --git a/.devcontainer/install.sh b/.devcontainer/install.sh new file mode 100644 index 0000000..d0b4e14 --- /dev/null +++ b/.devcontainer/install.sh @@ -0,0 +1,26 @@ +#!/bin/bash +set -e + +set -a +. ./devcontainer-features.env +set +a + +if [ ! -z ${_BUILD_ARG_AZUREBICEP} ]; then + echo "Activating feature 'Azure Bicep'" + + # Azure Bicep CLI version + CLIVERSION=${_BUILD_ARG_AZUREBICEP_VERSION:-"latest"} + + if [ "${CLIVERSION}" = "latest" ]; then + CLIURL="https://github.com/Azure/bicep/releases/latest/download/bicep-linux-x64" + else + CLIURL="https://github.com/Azure/bicep/releases/download/${CLIVERSION}/bicep-linux-x64" + fi + + sudo tee /usr/installbicep.sh > /dev/null \ + << EOF + sudo curl -Lo /usr/local/bin/bicep ${CLIURL} + sudo chmod +x /usr/local/bin/bicep +EOF + sudo chmod +x /usr/installbicep.sh +fi \ No newline at end of file diff --git a/.github/workflows/deploy-features.yml b/.github/workflows/deploy-features.yml new file mode 100644 index 0000000..6ad0a81 --- /dev/null +++ b/.github/workflows/deploy-features.yml @@ -0,0 +1,28 @@ +name: 'Deploy Features' +on: + push: + tags: + - 'v*' + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Get tag name + id: get_tag_name + run: echo "::set-output name=tag::$(echo "${{ github.ref }}" | grep -oP 'refs/tags/\K(.+)')" + + - name: Publish dev container features + uses: microsoft/publish-dev-container-features-action@main + with: + path-to-features: '.' + + - name: Get or Create Release at current tag + uses: ncipollo/release-action@v1 + with: + allowUpdates: true # Lets us upload our own artifact from previous step + artifactErrorsFailBuild: true + artifacts: './devcontainer-features.tgz' + token: ${{ secrets.GITHUB_TOKEN }}