Skip to content

Commit

Permalink
Merge pull request #14 from pamelafox/main
Browse files Browse the repository at this point in the history
Add CI/CD pipeline
  • Loading branch information
pamelafox authored Jun 16, 2023
2 parents b498a33 + de3215e commit f097382
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"extensions": [
"ms-azuretools.azure-dev",
"ms-azuretools.vscode-bicep",
"ms-python.python"
"ms-python.python",
"GitHub.vscode-github-actions"
]
}
},
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/azure-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ jobs:
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}

- name: Provision Infrastructure
run: azd provision --no-prompt
run: |
azd env set CREATE_ROLE_FOR_USER false --no-prompt
azd provision --no-prompt
env:
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }}
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
Expand Down
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ If you're not using one of those options for opening the project, then you'll ne
pre-commit install
```

### Deployment
## Deployment

This repo is set up for deployment on Azure Container Apps using the configuration files in the `infra` folder.

#### Prerequisites for deployment
### Prerequisites for deployment

1. Sign up for a [free Azure account](https://azure.microsoft.com/free/) and create an Azure Subscription.
2. Request access to Azure OpenAI Service by completing the form at [https://aka.ms/oai/access](https://aka.ms/oai/access) and awaiting approval.
2. Install the [Azure Developer CLI](https://learn.microsoft.com/azure/developer/azure-developer-cli/install-azd). (If you open this repository in Codespaces or with the VS Code Dev Containers extension, that part will be done for you.)

#### Deployment from scratch
### Deployment from scratch

1. Login to Azure:

Expand All @@ -62,7 +62,7 @@ This repo is set up for deployment on Azure Container Apps using the configurati
azd deploy
```

#### Deployment with existing resources
### Deployment with existing resources

If you already have an OpenAI resource and would like to re-use it, first follow these steps.

Expand All @@ -77,6 +77,16 @@ If you already have an OpenAI resource and would like to re-use it, first follow
```
3. Then follow the steps for deployment above.
### CI/CD pipeline
This project includes a Github workflow for deploying the resources to Azure
on every push to main. That workflow requires several Azure-related authentication secrets
to be stored as Github action secrets. To set that up, run:
```shell
azd pipeline config
```
### Costs
Pricing varies per region and usage, so it isn't possible to predict exact costs for your usage.
Expand Down
5 changes: 4 additions & 1 deletion infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ param location string
@description('Id of the user or app to assign application roles')
param principalId string = ''

@description('Flag to decide where to create OpenAI role for current user')
param createRoleForUser bool = true

param acaExists bool = false

param openAiResourceName string = ''
Expand Down Expand Up @@ -102,7 +105,7 @@ module aca 'aca.bicep' = {
}


module openAiRoleUser 'core/security/role.bicep' = {
module openAiRoleUser 'core/security/role.bicep' = if (createRoleForUser) {
scope: openAiResourceGroup
name: 'openai-role-user'
params: {
Expand Down
3 changes: 3 additions & 0 deletions infra/main.parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
"openAiSkuName": {
"value": "${AZURE_OPENAI_SKU_NAME}"
},
"createRoleForUser": {
"value": "${CREATE_ROLE_FOR_USER=true}"
},
"acaExists": {
"value": "${SERVICE_ACA_RESOURCE_EXISTS=false}"
}
Expand Down

0 comments on commit f097382

Please sign in to comment.