Skip to content

Commit 480f022

Browse files
committed
app ci github action first draft
1 parent 78d3c44 commit 480f022

File tree

5 files changed

+89
-0
lines changed

5 files changed

+89
-0
lines changed

.github/workflows/app-ci.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ jobs:
5454
jarversion=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
5555
originaljarname="$artifactid-$jarversion.jar"
5656
echo "Renaming $originaljarname to app.jar"
57+
# Renaming jas so it is auto detected by app service
5758
mv ./target/$originaljarname ./target/app.jar
5859
5960
- name: Upload artifacts for backend deployment jobs

README.md

+18
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,24 @@ Once in the web app:
104104
* Explore citations and sources
105105
* Click on "settings" to try different options, tweak prompts, etc.
106106

107+
## App Continuous Integration
108+
if you don't want to use azd to build and deploy the app, a GitHub automated CI pipeline is provided in `.github/workflows/app-ci.yml`. Some notes about the CI pipeline design:
109+
- It uses a "branch per environment approach". The deploy environment name is computed at 'runtime' based on a git branch. You can check branch/env-name mapping logic in the "set environment for branch" step (line 29). The current implemented logic maps everything to a dev like environment. Therefore on each git push on the `main branch` the pipeline is triggered trying to deploy to an environment called `Development`. For more info about GitHub environments and how to set specific env variables and secrets read [here](https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment).
110+
- GitHub environment variables and secrets are used to configure development environment specific configuration. They need to be configured manually in github repository settings:
111+
- `AZUREAPPSERVICE_PUBLISHPROFILE` is used to store the azure app service publish profile configuration securely.
112+
- `AZUREAPPSERVICE_APP_NAME` is used to store the azure web app resource name generated during infra arm deployment.
113+
114+
To properly configure automated build and deploy for both backend and frontend components follow below steps:
115+
116+
1. Go to your forked repository in GitHub and create an [environment]((https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment)) called 'Development' (yes this is the exact name; don't change it). If you want to change the environment name (also adding new branches and environments, change the current branch/env mapping) you can do that, but make sure to change the pipeline code accordingly in `.github/workflows/app-ci.yml` (starting line 29)
117+
2. Create 'Development' environment [secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) for the azure web app hosting both frontend and backend [publish profiles]((https://learn.microsoft.com/en-us/visualstudio/azure/how-to-get-publish-profile-from-azure-app-service?view=vs-2022)). You'll need to copy paste the xml content from the .PublishSettings file into the secret value:
118+
- Create a secret with name `AZUREAPPSERVICE_PUBLISHPROFILE` and set the Value field to publish profile of the azure web app
119+
3. Create 'Development' environment [variables](https://docs.github.com/en/actions/learn-github-actions/variables#creating-configuration-variables-for-an-environment) for azure web app resource name:
120+
- Create a variable with name `AZUREAPPSERVICE_APP_NAME` and set the Value field to the azure web app resource name
121+
4. For each commit you push check the status of the triggered pipeline in the GitHub Actions tab, you should see a pipeline has been triggered for the specific commit. If everything is ok you should see green checkmark on both build and deploy jobs in the pipeline detail like below:
122+
123+
![pipeline success](./docs/github-actions-pipeline-success.png)
124+
107125
## Resources
108126

109127
* [Revolutionize your Enterprise Data with ChatGPT: Next-gen Apps w/ Azure OpenAI and Cognitive Search](https://aka.ms/entgptsearchblog)
49.5 KB
Loading

infra/core/host/appservice.bicep

+16
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,22 @@ resource appService 'Microsoft.Web/sites@2022-03-01' = {
6060
httpsOnly: true
6161
}
6262

63+
resource ftpsPublishingCredentials 'basicPublishingCredentialsPolicies' = {
64+
name: 'ftp'
65+
kind: 'ftp'
66+
properties: {
67+
allow: true
68+
}
69+
}
70+
71+
resource scmPublishingCredentials 'basicPublishingCredentialsPolicies' = {
72+
name: 'scm'
73+
kind: 'scm'
74+
properties: {
75+
allow: true
76+
}
77+
}
78+
6379
identity: { type: managedIdentity ? 'SystemAssigned' : 'None' }
6480

6581
resource configAppSettings 'config' = {

infra/main.parameters.local.json

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
3+
"contentVersion": "1.0.0.0",
4+
"parameters": {
5+
"environmentName": {
6+
"value": "azure-search-openai-java-test"
7+
},
8+
"location": {
9+
"value": "eastus"
10+
},
11+
"principalId": {
12+
"value": "1a1f9195-9baf-4bb1-a741-7bf94bfc6d58"
13+
},
14+
"openAiServiceName": {
15+
"value": "cog-ouwyqrbiklxiq"
16+
},
17+
"openAiResourceGroupName": {
18+
"value": "rg-azure-search-openai-java-test"
19+
},
20+
"openAiSkuName": {
21+
"value": "S0"
22+
},
23+
"formRecognizerServiceName": {
24+
"value": "cog-fr-ouwyqrbiklxiq"
25+
},
26+
"formRecognizerResourceGroupName": {
27+
"value": "rg-azure-search-openai-java-test"
28+
},
29+
"formRecognizerSkuName": {
30+
"value": "S0"
31+
},
32+
"searchServiceName": {
33+
"value": "gptkb-ouwyqrbiklxiq"
34+
},
35+
"searchServiceResourceGroupName": {
36+
"value": "rg-azure-search-openai-java-test"
37+
},
38+
"searchServiceSkuName": {
39+
"value": "standard"
40+
},
41+
"storageAccountName": {
42+
"value": "stouwyqrbiklxiq"
43+
},
44+
"storageResourceGroupName": {
45+
"value": "rg-azure-search-openai-java-test"
46+
},
47+
"chatGptDeploymentName": {
48+
"value": "chat"
49+
},
50+
"gptDeploymentName": {
51+
"value": "davinci"
52+
}
53+
}
54+
}

0 commit comments

Comments
 (0)