generated from pascalvanderheiden/ais-apim-devops
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ea0982f
Showing
26 changed files
with
1,685 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/dotnet | ||
{ | ||
"name": "AIS (.NET Core 3)", | ||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile | ||
//"image": "mcr.microsoft.com/devcontainers/dotnet:0-7.0-bullseye", | ||
"image": "mcr.microsoft.com/azure-functions/dotnet:3.0-dotnet3-core-tools", | ||
"features": { | ||
"ghcr.io/devcontainers/features/azure-cli:1": {} | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
// Required extensions | ||
"GitHub.copilot", | ||
"GitHub.copilot-nightly", | ||
"ms-dotnettools.csharp", | ||
"ms-vscode.PowerShell", | ||
"ms-vscode.vscode-node-azure-pack", | ||
"VisualStudioExptTeam.vscodeintellicode", | ||
|
||
// Recommended extensions - Azure | ||
"Azurite.azurite", | ||
"ms-azuretools.vscode-bicep", | ||
"ms-vscode.azure-account", | ||
"ms-azuretools.vscode-azurecli", | ||
"ms-azuretools.vscode-azurestorage", | ||
"formulahendry.azure-storage-explorer", | ||
|
||
// Recommended extensions - Azure Integration Services | ||
"ms-azuretools.vscode-apimanagement", | ||
"ms-azuretools.vscode-logicapps", | ||
"ms-azuretools.vscode-azurelogicapps", | ||
"ms-azuretools.data-mapper-vscode-extension", | ||
"digital-molecules.service-bus-explorer", | ||
|
||
// Recommended extensions - Integration | ||
"humao.rest-client", | ||
"kirchner-trevor.shopify-liquid-preview", | ||
"sissel.shopify-liquid", | ||
"DotJoshJohnson.xml", | ||
"42Crunch.vscode-openapi", | ||
"GraphQL.vscode-graphql", | ||
"GraphQL.vscode-graphql-syntax", | ||
|
||
// Recommended extensions - Azure Data Services | ||
//"ms-azuretools.vscode-cosmosdb", | ||
//"ms-mssql.mssql", | ||
//"mtxr.sqltools", | ||
//"ms-mssql.data-workspace-vscode", | ||
|
||
// Recommended extensions - Azure Streaming Services | ||
//"Summer.azure-event-hub-explorer", | ||
//"ms-azuretools.vscode-azureeventhubs", | ||
//"ms-bigdatatools.vscode-asa", | ||
|
||
// Recommended extensions - Collaboration | ||
//"eamodio.gitlens", | ||
//"EditorConfig.EditorConfig", | ||
//"MS-vsliveshare.vsliveshare-pack", | ||
//"streetsidesoftware.code-spell-checker", | ||
|
||
// Recommended extensions - .NET | ||
//"Fudge.auto-using", | ||
//"jongrant.csharpsortusings", | ||
//"kreativ-software.csharpextensions", | ||
|
||
// Recommended extensions - Power Platform | ||
//"microsoft-IsvExpTools.powerplatform-vscode", | ||
|
||
// Recommended extensions - Markdown | ||
//"bierner.github-markdown-preview", | ||
//"DavidAnson.vscode-markdownlint", | ||
//"docsmsft.docs-linting", | ||
//"johnpapa.read-time", | ||
//"yzhang.markdown-all-in-one", | ||
], | ||
"settings": { | ||
// Uncomment if you want to use zsh as the default shell | ||
"terminal.integrated.defaultProfile.linux": "pwsh", | ||
"terminal.integrated.profiles.linux": { | ||
"zsh": { | ||
"path": "/usr/bin/zsh" | ||
}, | ||
"pwsh": { | ||
"path": "pwsh", | ||
"icon": "terminal-powershell" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
// "features": {}, | ||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [5000, 5001], | ||
// "portsAttributes": { | ||
// "5001": { | ||
// "protocol": "https" | ||
// } | ||
// } | ||
// Use 'postCreateCommand' to run commands after the container is created. | ||
// "postCreateCommand": "dotnet restore", | ||
// Configure tool-specific properties. | ||
// "customizations": {}, | ||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
// "remoteUser": "root" | ||
"postCreateCommand": "sudo chmod a+rwx /usr/share/dotnet" // avoids needing to run as 'sudo' when starting KernelHttpServer | ||
} | ||
// "features": { | ||
// "ghcr.io/devcontainers/features/node:1": {}, | ||
// "ghcr.io/devcontainers/features/dotnet:1": {}, | ||
// "ghcr.io/jlaundry/devcontainer-features/azure-functions-core-tools:1": {} | ||
// }, | ||
// "postCreateCommand": "sudo chmod a+rwx /usr/share/dotnet" // avoids needing to run as 'sudo' when starting KernelHttpServer | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Build | ||
|
||
env: | ||
# deploymentNameBuild: ${{ github.event.inputs.deploymentNameBuild }} | ||
# location: ${{ github.event.inputs.location }} | ||
buildBicepPath: './deploy/build/main.bicep' | ||
deploymentNameBuild: '${{ secrets.PREFIX }}build' | ||
|
||
on: | ||
# Triggers the workflow on push or pull request events but only for the main branch | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
# LOGIN TO AZURE. THE LOGGED IN SESSION IS ACTIVE TILL A LOGOUT ACTION IS CALLED (OR THE JOB FINISHED) | ||
- uses: azure/login@v1 | ||
with: | ||
creds: ${{ secrets.AZURE_CREDENTIALS }} | ||
enable-AzPSSession: true | ||
|
||
# SET CORRECT AZURE CONTEXT | ||
- name: 'Set context to subscription' | ||
uses: azure/powershell@v1 | ||
with: | ||
inlineScript: | | ||
Set-AzContext -Subscription ${{ secrets.AZURE_SUBSCRIPTION_ID }} | ||
azPSVersion: "latest" | ||
|
||
# DEPLOY THE SERVICES | ||
- name: 'Create / Update Azure resources' | ||
uses: azure/powershell@v1 | ||
with: | ||
inlineScript: | | ||
New-AzSubscriptionDeployment -name '${{ env.deploymentNameBuild }}' -namePrefix '${{ secrets.PREFIX }}' -location '${{ secrets.LOCATION }}' -TemplateFile '${{ env.buildBicepPath }}' | ||
azPSVersion: "latest" | ||
|
||
# LOGOUT | ||
- name: logout | ||
run: | | ||
az logout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: Release | ||
|
||
env: | ||
# deploymentNameBuild: ${{ github.event.inputs.deploymentNameBuild }} | ||
# location: ${{ github.event.inputs.location }} | ||
resourceGroup: '${{ secrets.PREFIX }}-rg' | ||
releaseAPIMBicepPath: './deploy/release/apim_apis.bicep' | ||
deploymentNameAPIMRelease: '${{ secrets.PREFIX }}apimrelease' | ||
|
||
on: | ||
# Only trigger, when the build workflow succeeded | ||
workflow_run: | ||
workflows: ["Build"] | ||
types: | ||
- completed | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
# inputs: | ||
# deploymentNameBuild: | ||
# description: 'Deployment Name Build' | ||
# required: true | ||
# location: | ||
# description: 'Location for deployment' | ||
# required: true | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
# LOGIN TO AZURE. THE LOGGED IN SESSION IS ACTIVE TILL A LOGOUT ACTION IS CALLED (OR THE JOB FINISHED) | ||
- uses: azure/login@v1 | ||
with: | ||
creds: ${{ secrets.AZURE_CREDENTIALS }} | ||
enable-AzPSSession: true | ||
|
||
# SET CORRECT AZURE CONTEXT | ||
- name: 'Set context to subscription' | ||
uses: azure/powershell@v1 | ||
with: | ||
inlineScript: | | ||
Set-AzContext -Subscription ${{ secrets.AZURE_SUBSCRIPTION_ID }} | ||
azPSVersion: "latest" | ||
|
||
# IMPORT MODULES | ||
- name: 'Import modules & extensions' | ||
uses: azure/powershell@v1 | ||
with: | ||
inlineScript: | | ||
az extension add --name application-insights | ||
azPSVersion: "latest" | ||
|
||
- name: 'Retrieve API Management Instance & Application Insights Name' | ||
uses: azure/powershell@v1 | ||
with: | ||
inlineScript: | | ||
$apimName = az apim list --resource-group '${{ env.resourceGroup }}' --subscription '${{ secrets.AZURE_SUBSCRIPTION_ID }}' --query '[].{Name:name}' -o tsv | ||
$appInsightsName = az monitor app-insights component show -g '${{ env.resourceGroup }}'--query "[].{applicationId:applicationId}" -o tsv | ||
echo "APIM_NAME=$apimName" >> $Env:GITHUB_ENV | ||
echo "APPINSIGHTS_NAME=$appInsightsName" >> $Env:GITHUB_ENV | ||
azPSVersion: "latest" | ||
|
||
- name: 'Release API definition to API Management' | ||
uses: azure/powershell@v1 | ||
with: | ||
inlineScript: | | ||
New-AzResourceGroupDeployment -Name '${{ env.deploymentNameAPIMRelease }}' -ResourceGroupName '${{ env.resourceGroup }}' -apimName '${{ env.APIM_NAME }}' -appInsightsName '${{ env.APPINSIGHTS_NAME }}' -TemplateFile '${{ env.releaseAPIMBicepPath }}' | ||
azPSVersion: "latest" | ||
|
||
# LOGOUT | ||
- name: logout | ||
run: | | ||
az logout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
local.deploy.ps1 | ||
local.tests.http |
Oops, something went wrong.