Pamela Fox commited on
Commit
31ced4c
·
1 Parent(s): 5b5177c

Update devcontainer and workflows

Browse files
.devcontainer/devcontainer.json CHANGED
@@ -6,13 +6,10 @@
6
  "service": "app",
7
  "workspaceFolder": "/workspace",
8
  "forwardPorts": [8000, 5432],
9
-
10
- "features": {
11
- "ghcr.io/devcontainers/features/github-cli:1": {
12
- "version": "latest"
13
- }
14
- },
15
-
16
  // Configure tool-specific properties.
17
  "customizations": {
18
  // Configure properties specific to VS Code.
@@ -56,15 +53,14 @@
56
  "ms-azuretools.azure-dev",
57
  "ms-python.python",
58
  "ms-python.vscode-pylance",
 
59
  "mtxr.sqltools",
60
  "mtxr.sqltools-driver-pg"
61
  ]
62
  }
63
  },
64
-
65
  // Use 'postCreateCommand' to run commands after the container is created.
66
  "postCreateCommand": "pip install -r requirements-dev.txt && pre-commit install",
67
-
68
  // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
69
  "remoteUser": "vscode"
70
  }
 
6
  "service": "app",
7
  "workspaceFolder": "/workspace",
8
  "forwardPorts": [8000, 5432],
9
+ "portsAttributes": {
10
+ "8000": {"label": "Django port", "onAutoForward": "notify"},
11
+ "5432": {"label": "PostgreSQL port", "onAutoForward": "silent"}
12
+ },
 
 
 
13
  // Configure tool-specific properties.
14
  "customizations": {
15
  // Configure properties specific to VS Code.
 
53
  "ms-azuretools.azure-dev",
54
  "ms-python.python",
55
  "ms-python.vscode-pylance",
56
+ "ms-azuretools.vscode-bicep",
57
  "mtxr.sqltools",
58
  "mtxr.sqltools-driver-pg"
59
  ]
60
  }
61
  },
 
62
  // Use 'postCreateCommand' to run commands after the container is created.
63
  "postCreateCommand": "pip install -r requirements-dev.txt && pre-commit install",
 
64
  // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
65
  "remoteUser": "vscode"
66
  }
.github/workflows/azure-bicep-validate.yaml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Validate bicep scripts
2
+ on:
3
+ workflow_dispatch:
4
+ push:
5
+ branches:
6
+ - main
7
+ - master
8
+ pull_request:
9
+ branches:
10
+ - main
11
+ - master
12
+
13
+ jobs:
14
+ build:
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - name: Checkout
18
+ uses: actions/checkout@v2
19
+
20
+ - name: Azure CLI script
21
+ uses: azure/CLI@v1
22
+ with:
23
+ inlineScript: az config set bicep.use_binary_from_path=false && az bicep build -f infra/main.bicep
.github/workflows/azure-dev.yaml ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Azure Developer CLI
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ push:
6
+ branches:
7
+ - main
8
+
9
+ permissions:
10
+ id-token: write
11
+ contents: read
12
+
13
+ jobs:
14
+ build:
15
+ runs-on: ubuntu-latest
16
+ container:
17
+ image: mcr.microsoft.com/azure-dev-cli-apps:latest
18
+ env:
19
+ AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
20
+ AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
21
+ AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
22
+ AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
23
+ steps:
24
+ - name: Checkout
25
+ uses: actions/checkout@v2
26
+
27
+ - name: Log in with Azure (Federated Credentials)
28
+ if: ${{ env.AZURE_CLIENT_ID != '' }}
29
+ run: |
30
+ azd login `
31
+ --client-id "$Env:AZURE_CLIENT_ID" `
32
+ --federated-credential-provider "github" `
33
+ --tenant-id "$Env:AZURE_TENANT_ID"
34
+ shell: pwsh
35
+
36
+ - name: Log in with Azure (Client Credentials)
37
+ if: ${{ env.AZURE_CREDENTIALS != '' }}
38
+ run: |
39
+ $info = $Env:AZURE_CREDENTIALS | ConvertFrom-Json -AsHashtable;
40
+ Write-Host "::add-mask::$($info.clientSecret)"
41
+ azd login `
42
+ --client-id "$($info.clientId)" `
43
+ --client-secret "$($info.clientSecret)" `
44
+ --tenant-id "$($info.tenantId)"
45
+ shell: pwsh
46
+ env:
47
+ AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
48
+
49
+ - name: Azure Dev Provision
50
+ run: azd provision --no-prompt
51
+ env:
52
+ AZURE_ENV_NAME: ${{ secrets.AZURE_ENV_NAME }}
53
+ AZURE_LOCATION: ${{ secrets.AZURE_LOCATION }}
54
+ AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
55
+
56
+ - name: Azure Dev Deploy
57
+ run: azd deploy --no-prompt
58
+ env:
59
+ AZURE_ENV_NAME: ${{ secrets.AZURE_ENV_NAME }}
60
+ AZURE_LOCATION: ${{ secrets.AZURE_LOCATION }}
61
+ AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
README.md CHANGED
@@ -6,12 +6,6 @@ An example Django app that serves quizzes and lets people know how they scored.
6
  Quizzes and their questions are stored in a PostGreSQL database.
7
  There is no user authentication or per-user data stored.
8
 
9
- Try it out at:
10
-
11
- ```
12
- https://django-example-quizsite.azurewebsites.net/quizzes/
13
- ```
14
-
15
  ## Local development
16
 
17
  Install the requirements and Git hooks:
 
6
  Quizzes and their questions are stored in a PostGreSQL database.
7
  There is no user authentication or per-user data stored.
8
 
 
 
 
 
 
 
9
  ## Local development
10
 
11
  Install the requirements and Git hooks:
azure.yaml CHANGED
@@ -1,7 +1,8 @@
1
  # yaml-language-server: $schema=https://raw.githubusercontent.com/Azure/azure-dev/main/schemas/v1.0/azure.yaml.json
2
 
3
- name: flask-db-quiz-example
4
-
 
5
  services:
6
  web:
7
  project: .
 
1
  # yaml-language-server: $schema=https://raw.githubusercontent.com/Azure/azure-dev/main/schemas/v1.0/azure.yaml.json
2
 
3
+ name: django-quiz-app
4
+ metadata:
5
+ template: [email protected]
6
  services:
7
  web:
8
  project: .