-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented AppServices release (#2)
- App Service deployment - dotnet Core deployment - Resource Group deployment - Improvements on structure - Introduced variable files
- Loading branch information
1 parent
ebd1dc1
commit 376f85f
Showing
52 changed files
with
1,083 additions
and
27 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 |
---|---|---|
|
@@ -348,3 +348,4 @@ MigrationBackup/ | |
|
||
# Ionide (cross platform F# VS Code tools) working folder | ||
.ionide/ | ||
.vscode/settings.json |
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
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
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,19 @@ | ||
parameters: | ||
- name: resource | ||
type: object | ||
jobs: | ||
- job: | ||
displayName: IaC - Azure App Service Build Job | ||
steps: | ||
- powershell: | | ||
Get-ChildItem -Path env: | ||
- template: ../bicep/bicep-build-tasks.yml | ||
parameters: | ||
resourceType: appService | ||
|
||
- task: PublishPipelineArtifact@1 | ||
inputs: | ||
targetPath: '$(build.artifactstagingdirectory)' | ||
artifact: ${{ parameters.resource.runName }} | ||
publishLocation: 'pipeline' |
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,119 @@ | ||
parameters: | ||
- name: settings | ||
type: object | ||
- name: resource | ||
type: object | ||
- name: environment | ||
type: string | ||
|
||
|
||
jobs: | ||
|
||
- ${{ if and(eq(parameters.settings.deploy.infrastructure.enabled, 'true'), eq(parameters.resource.deploy.infrastructure.enabled, 'true')) }}: | ||
|
||
- deployment: ${{ replace(parameters.resource.runName,'-','') }}iac | ||
displayName: IaC - Azure App Service Deployment | ||
environment: ${{ parameters.environment }} | ||
dependsOn: resourceGroupDeploy | ||
strategy: | ||
runOnce: | ||
deploy: | ||
steps: | ||
|
||
- task: AzureResourceManagerTemplateDeployment@3 | ||
displayName: Creating App Service '${{ parameters.resource.name }}' by IaC | ||
inputs: | ||
azureResourceManagerConnection: '${{ parameters.settings.azure.subscription.serviceConnection }}' | ||
subscriptionId: ${{ parameters.settings.azure.subscription.subscriptionId }} | ||
action: 'Create Or Update Resource Group' | ||
resourceGroupName: ${{ parameters.settings.azure.resourceGroup.name }} | ||
location: ${{ parameters.settings.azure.resourceGroup.location }} | ||
templateLocation: 'Linked artifact' | ||
csmFile: '$(Pipeline.Workspace)/${{ parameters.resource.runName }}/infrastructure/appService.json' | ||
overrideParameters: > | ||
-servicePlanName ${{ parameters.resource.deploy.infrastructure.servicePlanName }} | ||
-siteName ${{ parameters.resource.name }} | ||
deploymentMode: 'Incremental' | ||
deploymentOutputs: 'ArmOutputs' | ||
|
||
- ${{ if and(eq(parameters.settings.deploy.application.enabled, 'true'),eq(parameters.resource.deploy.application.enabled, 'true')) }}: | ||
- deployment: | ||
displayName: App - Azure App Service Deployment | ||
environment: ${{ parameters.environment }} | ||
${{ if and(eq(parameters.settings.deploy.infrastructure.enabled, 'true'), eq(parameters.resource.deploy.infrastructure.enabled, 'true')) }}: | ||
dependsOn: ${{ replace(parameters.resource.runName,'-','') }}iac | ||
${{ else }}: | ||
dependsOn: resourceGroupDeploy | ||
strategy: | ||
runOnce: | ||
deploy: | ||
steps: | ||
|
||
- ${{ if ne( parameters.resource.type, 'appService') }}: | ||
- task: AzureWebApp@1 | ||
inputs: | ||
azureSubscription: ${{ parameters.settings.azure.subscription.serviceConnection }} | ||
appName: ${{ parameters.resource.name }} | ||
package: $(Pipeline.Workspace)/${{ parameters.resource.runName }}/**/*.zip | ||
|
||
# - deployment: | ||
# displayName: Azure App Service Deployment | ||
# environment: ${{ parameters.environment }} | ||
# dependsOn: resourceGroupDeploy | ||
|
||
# strategy: | ||
# runOnce: | ||
|
||
# # check if there is app and infrastructure deploy | ||
# # if there is infra only, the job must be preDeploy instead of deploy | ||
# ${{ if and(eq(parameters.settings.deploy.infrastructure.enabled, 'true'), eq(parameters.resource.deploy.infrastructure.enabled, 'true')) }}: | ||
|
||
# ${{ if and(eq(parameters.settings.deploy.application.enabled, 'true'),eq(parameters.resource.deploy.application.enabled, 'true')) }}: | ||
# preDeploy: | ||
# steps: | ||
# - task: AzureResourceManagerTemplateDeployment@3 | ||
# displayName: Creating App Service '${{ parameters.resource.name }}' by IaC | ||
# inputs: | ||
# azureResourceManagerConnection: '${{ parameters.settings.azure.subscription.serviceConnection }}' | ||
# subscriptionId: ${{ parameters.settings.azure.subscription.subscriptionId }} | ||
# action: 'Create Or Update Resource Group' | ||
# resourceGroupName: ${{ parameters.settings.azure.resourceGroup.name }} | ||
# location: ${{ parameters.settings.azure.resourceGroup.location }} | ||
# templateLocation: 'Linked artifact' | ||
# csmFile: '$(Pipeline.Workspace)/appService/infrastructure/appService.json' | ||
# overrideParameters: > | ||
# -servicePlanName ${{ parameters.resource.deploy.infrastructure.servicePlanName }} | ||
# -siteName ${{ parameters.resource.name }} | ||
# deploymentMode: 'Incremental' | ||
# deploymentOutputs: 'ArmOutputs' | ||
|
||
# ${{ else }}: | ||
# deploy: | ||
# steps: | ||
# - task: AzureResourceManagerTemplateDeployment@3 | ||
# displayName: Creating App Service '${{ parameters.resource.name }}' by IaC | ||
# inputs: | ||
# azureResourceManagerConnection: '${{ parameters.settings.azure.subscription.serviceConnection }}' | ||
# subscriptionId: ${{ parameters.settings.azure.subscription.subscriptionId }} | ||
# action: 'Create Or Update Resource Group' | ||
# resourceGroupName: ${{ parameters.settings.azure.resourceGroup.name }} | ||
# location: ${{ parameters.settings.azure.resourceGroup.location }} | ||
# templateLocation: 'Linked artifact' | ||
# csmFile: '$(Pipeline.Workspace)/appService/infrastructure/appService.json' | ||
# overrideParameters: > | ||
# -servicePlanName ${{ parameters.resource.deploy.infrastructure.servicePlanName }} | ||
# -siteName ${{ parameters.resource.name }} | ||
# deploymentMode: 'Incremental' | ||
# deploymentOutputs: 'ArmOutputs' | ||
|
||
# ${{ if eq(parameters.settings.deploy.application.enabled, 'true') }}: | ||
# ${{ if eq(parameters.resource.deploy.application.enabled, 'true') }}: | ||
# deploy: | ||
# steps: | ||
|
||
# - ${{ if ne( parameters.resource.type, 'appService') }}: | ||
# - task: AzureWebApp@1 | ||
# inputs: | ||
# azureSubscription: ${{ parameters.settings.azure.subscription.serviceConnection }} | ||
# appName: ${{ parameters.resource.name }} | ||
# package: $(Pipeline.Workspace)/${{ parameters.resource.runName }}/**/*.zip |
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,52 @@ | ||
@minLength(1) | ||
param servicePlanName string | ||
|
||
@allowed([ | ||
'F1' | ||
'D1' | ||
'B1' | ||
'B2' | ||
'B3' | ||
'S1' | ||
'S2' | ||
'S3' | ||
'P1' | ||
'P2' | ||
'P3' | ||
'P4' | ||
]) | ||
@description('Describes plan\'s pricing tier and capacity. Check details at https://azure.microsoft.com/en-us/pricing/details/app-service/') | ||
param skuName string = 'F1' | ||
|
||
@minValue(1) | ||
@description('Describes plan\'s instance count') | ||
param skuCapacity int = 1 | ||
param siteName string = 'webSite${uniqueString(resourceGroup().id)}' | ||
|
||
resource servicePlanName_resource 'Microsoft.Web/serverfarms@2015-08-01' = { | ||
name: servicePlanName | ||
location: resourceGroup().location | ||
tags: { | ||
displayName: 'HostingPlan' | ||
} | ||
sku: { | ||
name: skuName | ||
capacity: skuCapacity | ||
} | ||
properties: { | ||
name: servicePlanName | ||
} | ||
} | ||
|
||
resource siteName_resource 'Microsoft.Web/sites@2015-08-01' = { | ||
name: siteName | ||
location: resourceGroup().location | ||
tags: { | ||
'hidden-related:${resourceGroup().id}/providers/Microsoft.Web/serverfarms/${servicePlanName}': 'Resource' | ||
displayName: 'Website' | ||
} | ||
properties: { | ||
name: siteName | ||
serverFarmId: servicePlanName_resource.id | ||
} | ||
} |
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,48 @@ | ||
trigger: | ||
branches: | ||
include: | ||
- main | ||
- feature/appService | ||
paths: | ||
include: | ||
- src/cloud/azure/appService/* | ||
|
||
pool: | ||
vmImage: 'windows-latest' | ||
# name: default | ||
|
||
extends: | ||
template: ../../../../main.yml | ||
parameters: | ||
settings: | ||
build: | ||
enabled: true | ||
deploy: | ||
enabled: true | ||
variablesDirectory: ./cloud/azure/appService/examples/variables | ||
infrastructure: | ||
enabled: true | ||
application: | ||
enabled: true | ||
azure: | ||
subscription: | ||
serviceConnection: $(serviceConnection) | ||
subscriptionId: $(subscriptionId) | ||
resourceGroup: | ||
name: $(resourceGroupName) | ||
location: $(location) | ||
new: true | ||
environments: | ||
- dev | ||
# - uat | ||
# - prd | ||
resources: | ||
- name: $(appServiceName) | ||
type: appService | ||
enabled: true | ||
deploy: | ||
infrastructure: | ||
enabled: true | ||
servicePlanName: $(servicePlanName) | ||
application: | ||
enabled: false |
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,8 @@ | ||
variables: | ||
serviceConnection: ServiceConnection | ||
subscriptionId: 337ba254-3aa0-4551-ba8e-89debefaa373 | ||
location: northeurope | ||
resourceGroupName: rg-app-releaseengine-dev | ||
|
||
appServiceName: app-releaseengine-dev | ||
servicePlanName: plan-releaseengine-dev |
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,8 @@ | ||
variables: | ||
serviceConnection: ServiceConnection | ||
subscriptionId: 337ba254-3aa0-4551-ba8e-89debefaa373 | ||
location: northeurope | ||
resourceGroupName: rg-app-releaseengine-prd | ||
|
||
appServiceName: app-releaseengine-prd | ||
servicePlanName: plan-releaseengine-prd |
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,8 @@ | ||
variables: | ||
serviceConnection: ServiceConnection | ||
subscriptionId: 337ba254-3aa0-4551-ba8e-89debefaa373 | ||
location: northeurope | ||
resourceGroupName: rg-app-releaseengine-uat | ||
|
||
appServiceName: app-releaseengine-uat | ||
servicePlanName: plan-releaseengine-uat |
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 |
---|---|---|
@@ -1,16 +1,34 @@ | ||
parameters: | ||
- name: bicepFilePath | ||
- name: resourceType | ||
type: object | ||
- name: outDir | ||
type: string | ||
default: infrastructure | ||
|
||
steps: | ||
|
||
- checkout: ReleaseEngine | ||
|
||
- powershell: | | ||
Write-Host "##[section]Building bicep file: $env:bicepFilePath" | ||
$file = $env:bicepFilePath | ||
New-Item -ItemType Directory -Force -Path $(build.artifactstagingdirectory)/infrastructure | ||
az bicep build --file $file --outdir $(build.artifactstagingdirectory)/infrastructure | ||
Get-ChildItem $(build.artifactstagingdirectory)/infrastructure | ||
if(Test-Path "$(Build.SourcesDirectory)/$(releaseEngineRepositoryName)"){ | ||
$sourceDirectory = "$(Build.SourcesDirectory)/$(releaseEngineRepositoryName)" | ||
}else{ | ||
$sourceDirectory = "$(Build.SourcesDirectory)" | ||
} | ||
$file = Join-Path $sourceDirectory $env:bicepFilePath | ||
Write-Host "##[section]Building bicep file: $file" | ||
Write-Host $file | ||
New-Item -ItemType Directory -Force -Path $(build.artifactstagingdirectory)/$env:outDir | ||
az bicep build --file $file --outdir $(build.artifactstagingdirectory)/$env:outDir | ||
Get-ChildItem $(build.artifactstagingdirectory)/$env:outDir | ||
displayName: 'Build bicep artifact' | ||
env: | ||
bicepFilePath: ${{ parameters.bicepFilePath }} | ||
bicepFilePath: /src/cloud/azure/${{ parameters.resourceType }}/${{ parameters.resourceType }}.bicep | ||
outDir: ${{ parameters.outDir }} | ||
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
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
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
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
Oops, something went wrong.