From bc09318c28ff156c48f896c50459847dfdfc4034 Mon Sep 17 00:00:00 2001 From: Travis Hilbert Date: Tue, 18 Mar 2025 14:26:14 -0700 Subject: [PATCH] AZD Updates --- .devcontainer/devcontainer.json | 24 ++++++++++++++ .github/workflows/azure-dev.yml | 33 ++++++++++++++++++ azure.yaml | 42 +++-------------------- infra/main.parameters.json | 59 +++++++++++++++++++++++++++++++++ 4 files changed, 120 insertions(+), 38 deletions(-) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .github/workflows/azure-dev.yml create mode 100644 infra/main.parameters.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..7b6b93d3 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,24 @@ +{ + "name": "azd-template", + "image": "mcr.microsoft.com/devcontainers/python:3.11-bullseye", + "forwardPorts": [50505], + "features": { + "ghcr.io/azure/azure-dev/azd:latest": {} + }, + "customizations": { + "vscode": { + "extensions": [ + "ms-azuretools.azure-dev", + "ms-azuretools.vscode-bicep", + "ms-python.python", + "ms-toolsai.jupyter", + "GitHub.vscode-github-actions" + ] + } + }, + "postStartCommand": "git pull origin main && python3 -m pip install -r ./src/frontend/requirements.txt && python3 -m pip install -r ./src/backend/requirements.txt", + "remoteUser": "vscode", + "hostRequirements": { + "memory": "4gb" + } +} \ No newline at end of file diff --git a/.github/workflows/azure-dev.yml b/.github/workflows/azure-dev.yml new file mode 100644 index 00000000..b453d13d --- /dev/null +++ b/.github/workflows/azure-dev.yml @@ -0,0 +1,33 @@ +name: Azure Template Validation +on: +# workflow_dispatch: +push: + branches: + - main +permissions: + contents: read + id-token: write + pull-requests: write +jobs: + template_validation_job: + runs-on: ubuntu-latest + name: Template validation + steps: + # Step 1: Checkout the code from your repository + - name: Checkout code + uses: actions/checkout@v4 + # Step 2: Validate the Azure template using microsoft/template-validation-action + - name: Validate Azure Template + uses: microsoft/template-validation-action@v0.3.5 + id: validation + env: + AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} + AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }} + AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} + AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + AZURE_ENV_NAME: ${{ secrets.AZURE_ENV_NAME }} + AZURE_LOCATION: ${{ secrets.AZURE_LOCATION }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Step 3: Print the result of the validation + - name: Print result + run: cat ${{ steps.validation.outputs.resultFile }} \ No newline at end of file diff --git a/azure.yaml b/azure.yaml index 7a19a21e..6cbf00c8 100644 --- a/azure.yaml +++ b/azure.yaml @@ -1,44 +1,10 @@ -# # yaml-language-server: $schema=https://raw.githubusercontent.com/Azure/azure-dev/main/schemas/v1.0/azure.yaml.json +# yaml-language-server: $schema=https://raw.githubusercontent.com/Azure/azure-dev/main/schemas/v1.0/azure.yaml.json -# name: accl-codegeneration-genericaccelerator-1 +name: modernize-your-code-solution-accelerator +#KEEP OFF UNTIL WE ARE READY TO PUBLISH ISH # metadata: # template: azd-init@1.13.0 -# services: -# backend: -# project: src/backend -# host: containerapp -# language: python -# frontend: -# project: src/frontend -# host: containerapp -# language: python - - - -environment: - name: accl-codegeneration-genericaccelerator-1 - location: eastus -name: accl-codegeneration-genericaccelerator-1 -metadata: - template: accl-codegeneration-genericaccelerator-1@1.0 - -parameters: - solutionPrefix: - type: string - default: bs-azdtest - otherLocation: - type: string - default: eastus2 -# baseUrl: -# type: string -# default: 'https://raw.githubusercontent.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/' deployment: mode: Incremental - template: ./infra/main2.bicep # Path to the main.bicep file inside the 'deployment' folder - parameters: - solutionPrefix: ${parameters.solutionPrefix} - otherLocation: ${parameters.otherLocation} - #baseUrl: ${parameters.baseUrl} - - \ No newline at end of file + template: ./infra/main.bicep # Path to the main.bicep file inside the 'deployment' folder \ No newline at end of file diff --git a/infra/main.parameters.json b/infra/main.parameters.json new file mode 100644 index 00000000..c7fc26a4 --- /dev/null +++ b/infra/main.parameters.json @@ -0,0 +1,59 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "environmentName": { + "value": "${AZURE_ENV_NAME}" + }, + "location": { + "value": "${AZURE_LOCATION}" + }, + "backendExists": { + "value": "${SERVICE_BACKEND_RESOURCE_EXISTS=false}" + }, + "backendDefinition": { + "value": { + "settings": [ + { + "name": "", + "value": "${VAR}", + "_comment_name": "The name of the environment variable when running in Azure. If empty, ignored.", + "_comment_value": "The value to provide. This can be a fixed literal, or an expression like ${VAR} to use the value of 'VAR' from the current environment." + }, + { + "name": "", + "value": "${VAR_S}", + "secret": true, + "_comment_name": "The name of the environment variable when running in Azure. If empty, ignored.", + "_comment_value": "The value to provide. This can be a fixed literal, or an expression like ${VAR_S} to use the value of 'VAR_S' from the current environment." + } + ] + } + }, + "frontendExists": { + "value": "${SERVICE_FRONTEND_RESOURCE_EXISTS=false}" + }, + "frontendDefinition": { + "value": { + "settings": [ + { + "name": "", + "value": "${VAR}", + "_comment_name": "The name of the environment variable when running in Azure. If empty, ignored.", + "_comment_value": "The value to provide. This can be a fixed literal, or an expression like ${VAR} to use the value of 'VAR' from the current environment." + }, + { + "name": "", + "value": "${VAR_S}", + "secret": true, + "_comment_name": "The name of the environment variable when running in Azure. If empty, ignored.", + "_comment_value": "The value to provide. This can be a fixed literal, or an expression like ${VAR_S} to use the value of 'VAR_S' from the current environment." + } + ] + } + }, + "principalId": { + "value": "${AZURE_PRINCIPAL_ID}" + } + } +}