From 376f85f0bc4b5baecf79ea581f699919a96ec534 Mon Sep 17 00:00:00 2001 From: Wesley Camargo Date: Sun, 23 Jan 2022 09:51:49 +0100 Subject: [PATCH] Implemented AppServices release (#2) - App Service deployment - dotnet Core deployment - Resource Group deployment - Improvements on structure - Introduced variable files --- .gitignore | 1 + src/_jobs/build-jobs.yml | 14 ++- src/_jobs/deploy-jobs.yml | 14 +++ .../appService/appService-build-jobs.yml | 19 +++ .../appService/appService-deploy-jobs.yml | 119 ++++++++++++++++++ src/cloud/azure/appService/appService.bicep | 52 ++++++++ .../appService/examples/azure-pipelines.yml | 48 +++++++ .../examples/variables/dev-vars.yml | 8 ++ .../examples/variables/prd-vars.yml | 8 ++ .../examples/variables/uat-vars.yml | 8 ++ src/cloud/azure/bicep/bicep-build-tasks.yml | 34 +++-- .../keyVault/examples/azure-pipelines.yml | 2 +- .../keyVault/examples/variables/dev-vars.yml | 2 +- .../keyVault/examples/variables/prd-vars.yml | 2 +- .../keyVault/examples/variables/uat-vars.yml | 2 +- .../azure/keyVault/keyVault-build-jobs.yml | 2 +- .../azure/keyVault/keyVault-deploy-jobs.yml | 2 +- .../examples/azure-pipelines.yml | 2 +- .../examples/variables/dev-vars.yml | 2 +- .../examples/variables/prd-vars.yml | 2 +- .../examples/variables/uat-vars.yml | 2 +- .../resourceGroup-build-jobs.yml | 7 +- .../resourceGroup-deploy-jobs.yml | 4 +- src/config/config.yml | 3 + .../dotnetCore/dotnetCore-build-jobs.yml | 62 +++++++++ .../dotnetCore/dotnetCore-deploy-jobs.yml | 17 +++ .../dotnetCore/examples/azure-pipelines.yml | 59 +++++++++ .../dotnetCore/examples/src/dotnetcoreApp.sln | 25 ++++ .../Controllers/HomeController.cs | 43 +++++++ .../dotnetcoreApp/Models/ErrorViewModel.cs | 11 ++ .../examples/src/dotnetcoreApp/Program.cs | 24 ++++ .../Properties/launchSettings.json | 27 ++++ .../examples/src/dotnetcoreApp/Startup.cs | 63 ++++++++++ .../src/dotnetcoreApp/Views/Home/About.cshtml | 7 ++ .../dotnetcoreApp/Views/Home/Contact.cshtml | 17 +++ .../src/dotnetcoreApp/Views/Home/Index.cshtml | 94 ++++++++++++++ .../dotnetcoreApp/Views/Home/Privacy.cshtml | 6 + .../dotnetcoreApp/Views/Shared/Error.cshtml | 22 ++++ .../Views/Shared/_CookieConsentPartial.cshtml | 41 ++++++ .../dotnetcoreApp/Views/Shared/_Layout.cshtml | 74 +++++++++++ .../Shared/_ValidationScriptsPartial.cshtml | 18 +++ .../dotnetcoreApp/Views/_ViewImports.cshtml | 3 + .../src/dotnetcoreApp/Views/_ViewStart.cshtml | 3 + .../appsettings.Development.json | 9 ++ .../src/dotnetcoreApp/appsettings.json | 9 ++ .../dotnetcoreApp/appsettings.release.json | 11 ++ .../src/dotnetcoreApp/dotnetcoreApp.csproj | 18 +++ .../examples/variables/dev-vars.yml | 9 ++ .../examples/variables/prd-vars.yml | 8 ++ .../examples/variables/uat-vars.yml | 8 ++ src/gitflow-main.yml | 46 +++++++ src/main.yml | 17 ++- 52 files changed, 1083 insertions(+), 27 deletions(-) create mode 100644 src/cloud/azure/appService/appService-build-jobs.yml create mode 100644 src/cloud/azure/appService/appService-deploy-jobs.yml create mode 100644 src/cloud/azure/appService/appService.bicep create mode 100644 src/cloud/azure/appService/examples/azure-pipelines.yml create mode 100644 src/cloud/azure/appService/examples/variables/dev-vars.yml create mode 100644 src/cloud/azure/appService/examples/variables/prd-vars.yml create mode 100644 src/cloud/azure/appService/examples/variables/uat-vars.yml create mode 100644 src/config/config.yml create mode 100644 src/development/dotnetCore/dotnetCore-build-jobs.yml create mode 100644 src/development/dotnetCore/dotnetCore-deploy-jobs.yml create mode 100644 src/development/dotnetCore/examples/azure-pipelines.yml create mode 100644 src/development/dotnetCore/examples/src/dotnetcoreApp.sln create mode 100644 src/development/dotnetCore/examples/src/dotnetcoreApp/Controllers/HomeController.cs create mode 100644 src/development/dotnetCore/examples/src/dotnetcoreApp/Models/ErrorViewModel.cs create mode 100644 src/development/dotnetCore/examples/src/dotnetcoreApp/Program.cs create mode 100644 src/development/dotnetCore/examples/src/dotnetcoreApp/Properties/launchSettings.json create mode 100644 src/development/dotnetCore/examples/src/dotnetcoreApp/Startup.cs create mode 100644 src/development/dotnetCore/examples/src/dotnetcoreApp/Views/Home/About.cshtml create mode 100644 src/development/dotnetCore/examples/src/dotnetcoreApp/Views/Home/Contact.cshtml create mode 100644 src/development/dotnetCore/examples/src/dotnetcoreApp/Views/Home/Index.cshtml create mode 100644 src/development/dotnetCore/examples/src/dotnetcoreApp/Views/Home/Privacy.cshtml create mode 100644 src/development/dotnetCore/examples/src/dotnetcoreApp/Views/Shared/Error.cshtml create mode 100644 src/development/dotnetCore/examples/src/dotnetcoreApp/Views/Shared/_CookieConsentPartial.cshtml create mode 100644 src/development/dotnetCore/examples/src/dotnetcoreApp/Views/Shared/_Layout.cshtml create mode 100644 src/development/dotnetCore/examples/src/dotnetcoreApp/Views/Shared/_ValidationScriptsPartial.cshtml create mode 100644 src/development/dotnetCore/examples/src/dotnetcoreApp/Views/_ViewImports.cshtml create mode 100644 src/development/dotnetCore/examples/src/dotnetcoreApp/Views/_ViewStart.cshtml create mode 100644 src/development/dotnetCore/examples/src/dotnetcoreApp/appsettings.Development.json create mode 100644 src/development/dotnetCore/examples/src/dotnetcoreApp/appsettings.json create mode 100644 src/development/dotnetCore/examples/src/dotnetcoreApp/appsettings.release.json create mode 100644 src/development/dotnetCore/examples/src/dotnetcoreApp/dotnetcoreApp.csproj create mode 100644 src/development/dotnetCore/examples/variables/dev-vars.yml create mode 100644 src/development/dotnetCore/examples/variables/prd-vars.yml create mode 100644 src/development/dotnetCore/examples/variables/uat-vars.yml create mode 100644 src/gitflow-main.yml diff --git a/.gitignore b/.gitignore index dfcfd56..3d54c88 100644 --- a/.gitignore +++ b/.gitignore @@ -348,3 +348,4 @@ MigrationBackup/ # Ionide (cross platform F# VS Code tools) working folder .ionide/ +.vscode/settings.json diff --git a/src/_jobs/build-jobs.yml b/src/_jobs/build-jobs.yml index 1c15f83..3b6c4f0 100644 --- a/src/_jobs/build-jobs.yml +++ b/src/_jobs/build-jobs.yml @@ -18,4 +18,16 @@ jobs: - ${{ if eq(resource.type, 'keyVault') }}: - template: ../cloud/azure/keyVault/keyVault-build-jobs.yml parameters: - settings: ${{ parameters.settings }} \ No newline at end of file + settings: ${{ parameters.settings }} + + - ${{ if eq(resource.type, 'appService') }}: + - template: ../cloud/azure/appService/appService-build-jobs.yml + parameters: + resource: ${{ resource }} + + - ${{ if eq(resource.type, 'dotnetCore') }}: + - template: ../development/dotnetCore/dotnetCore-build-jobs.yml + parameters: + resource: ${{ resource }} + + \ No newline at end of file diff --git a/src/_jobs/deploy-jobs.yml b/src/_jobs/deploy-jobs.yml index df47238..8d8eba9 100644 --- a/src/_jobs/deploy-jobs.yml +++ b/src/_jobs/deploy-jobs.yml @@ -19,6 +19,20 @@ jobs: - ${{ if eq(resource.type, 'keyVault') }}: - template: ../cloud/azure/keyVault/keyVault-deploy-jobs.yml + parameters: + settings: ${{ parameters.settings }} + environment: ${{ parameters.environment }} + resource: ${{ resource }} + + - ${{ if eq(resource.type, 'appService') }}: + - template: ../cloud/azure/appService/appService-deploy-jobs.yml + parameters: + settings: ${{ parameters.settings }} + environment: ${{ parameters.environment }} + resource: ${{ resource }} + + - ${{ if eq(resource.type, 'dotnetCore') }}: + - template: ../development/dotnetCore/dotnetCore-deploy-jobs.yml parameters: settings: ${{ parameters.settings }} environment: ${{ parameters.environment }} diff --git a/src/cloud/azure/appService/appService-build-jobs.yml b/src/cloud/azure/appService/appService-build-jobs.yml new file mode 100644 index 0000000..f465841 --- /dev/null +++ b/src/cloud/azure/appService/appService-build-jobs.yml @@ -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' \ No newline at end of file diff --git a/src/cloud/azure/appService/appService-deploy-jobs.yml b/src/cloud/azure/appService/appService-deploy-jobs.yml new file mode 100644 index 0000000..d614338 --- /dev/null +++ b/src/cloud/azure/appService/appService-deploy-jobs.yml @@ -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 \ No newline at end of file diff --git a/src/cloud/azure/appService/appService.bicep b/src/cloud/azure/appService/appService.bicep new file mode 100644 index 0000000..f9231c8 --- /dev/null +++ b/src/cloud/azure/appService/appService.bicep @@ -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 + } +} diff --git a/src/cloud/azure/appService/examples/azure-pipelines.yml b/src/cloud/azure/appService/examples/azure-pipelines.yml new file mode 100644 index 0000000..53038ad --- /dev/null +++ b/src/cloud/azure/appService/examples/azure-pipelines.yml @@ -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 \ No newline at end of file diff --git a/src/cloud/azure/appService/examples/variables/dev-vars.yml b/src/cloud/azure/appService/examples/variables/dev-vars.yml new file mode 100644 index 0000000..f4742c9 --- /dev/null +++ b/src/cloud/azure/appService/examples/variables/dev-vars.yml @@ -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 \ No newline at end of file diff --git a/src/cloud/azure/appService/examples/variables/prd-vars.yml b/src/cloud/azure/appService/examples/variables/prd-vars.yml new file mode 100644 index 0000000..3547fa4 --- /dev/null +++ b/src/cloud/azure/appService/examples/variables/prd-vars.yml @@ -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 \ No newline at end of file diff --git a/src/cloud/azure/appService/examples/variables/uat-vars.yml b/src/cloud/azure/appService/examples/variables/uat-vars.yml new file mode 100644 index 0000000..62bfcda --- /dev/null +++ b/src/cloud/azure/appService/examples/variables/uat-vars.yml @@ -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 \ No newline at end of file diff --git a/src/cloud/azure/bicep/bicep-build-tasks.yml b/src/cloud/azure/bicep/bicep-build-tasks.yml index e3a8fb6..bc2f507 100644 --- a/src/cloud/azure/bicep/bicep-build-tasks.yml +++ b/src/cloud/azure/bicep/bicep-build-tasks.yml @@ -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 }} \ No newline at end of file + bicepFilePath: /src/cloud/azure/${{ parameters.resourceType }}/${{ parameters.resourceType }}.bicep + outDir: ${{ parameters.outDir }} + + \ No newline at end of file diff --git a/src/cloud/azure/keyVault/examples/azure-pipelines.yml b/src/cloud/azure/keyVault/examples/azure-pipelines.yml index bca4f52..5c68db4 100644 --- a/src/cloud/azure/keyVault/examples/azure-pipelines.yml +++ b/src/cloud/azure/keyVault/examples/azure-pipelines.yml @@ -22,7 +22,7 @@ extends: variablesDirectory: ./cloud/azure/keyVault/examples/variables azure: subscription: - azureServiceConnection: $(azureServiceConnection) + serviceConnection: $(serviceConnection) subscriptionId: $(subscriptionId) resourceGroup: name: $(resourceGroupName) diff --git a/src/cloud/azure/keyVault/examples/variables/dev-vars.yml b/src/cloud/azure/keyVault/examples/variables/dev-vars.yml index ed5f1ec..90504cd 100644 --- a/src/cloud/azure/keyVault/examples/variables/dev-vars.yml +++ b/src/cloud/azure/keyVault/examples/variables/dev-vars.yml @@ -1,5 +1,5 @@ variables: - azureServiceConnection: ServiceConnection + serviceConnection: ServiceConnection subscriptionId: 337ba254-3aa0-4551-ba8e-89debefaa373 location: northeurope resourceGroupName: rg-kv-releaseengine-dev diff --git a/src/cloud/azure/keyVault/examples/variables/prd-vars.yml b/src/cloud/azure/keyVault/examples/variables/prd-vars.yml index aac737f..d3c45b5 100644 --- a/src/cloud/azure/keyVault/examples/variables/prd-vars.yml +++ b/src/cloud/azure/keyVault/examples/variables/prd-vars.yml @@ -1,5 +1,5 @@ variables: - azureServiceConnection: ServiceConnection + serviceConnection: ServiceConnection subscriptionId: 337ba254-3aa0-4551-ba8e-89debefaa373 location: northeurope resourceGroupName: rg-kv-releaseengine-prd diff --git a/src/cloud/azure/keyVault/examples/variables/uat-vars.yml b/src/cloud/azure/keyVault/examples/variables/uat-vars.yml index 839e6c3..4276cdb 100644 --- a/src/cloud/azure/keyVault/examples/variables/uat-vars.yml +++ b/src/cloud/azure/keyVault/examples/variables/uat-vars.yml @@ -1,5 +1,5 @@ variables: - azureServiceConnection: ServiceConnection + serviceConnection: ServiceConnection subscriptionId: 337ba254-3aa0-4551-ba8e-89debefaa373 location: northeurope resourceGroupName: rg-kv-releaseengine-uat diff --git a/src/cloud/azure/keyVault/keyVault-build-jobs.yml b/src/cloud/azure/keyVault/keyVault-build-jobs.yml index c8a6989..80971f5 100644 --- a/src/cloud/azure/keyVault/keyVault-build-jobs.yml +++ b/src/cloud/azure/keyVault/keyVault-build-jobs.yml @@ -9,7 +9,7 @@ jobs: - template: ../bicep/bicep-build-tasks.yml parameters: - bicepFilePath: $(Build.SourcesDirectory)/src/cloud/azure/keyVault/keyVault.bicep + resourceType: ${{ parameters.resource.type }} - task: PublishPipelineArtifact@1 inputs: diff --git a/src/cloud/azure/keyVault/keyVault-deploy-jobs.yml b/src/cloud/azure/keyVault/keyVault-deploy-jobs.yml index 62e8d49..471bac7 100644 --- a/src/cloud/azure/keyVault/keyVault-deploy-jobs.yml +++ b/src/cloud/azure/keyVault/keyVault-deploy-jobs.yml @@ -21,7 +21,7 @@ jobs: - task: AzureResourceManagerTemplateDeployment@3 displayName: Creating Key Vault '${{ parameters.resource.name }}' by IaC inputs: - azureResourceManagerConnection: '${{ parameters.settings.azure.subscription.azureServiceConnection }}' + azureResourceManagerConnection: '${{ parameters.settings.azure.subscription.serviceConnection }}' subscriptionId: ${{ parameters.settings.azure.subscription.subscriptionId }} action: 'Create Or Update Resource Group' resourceGroupName: ${{ parameters.settings.azure.resourceGroup.name }} diff --git a/src/cloud/azure/resourceGroup/examples/azure-pipelines.yml b/src/cloud/azure/resourceGroup/examples/azure-pipelines.yml index 9f37738..caa2d03 100644 --- a/src/cloud/azure/resourceGroup/examples/azure-pipelines.yml +++ b/src/cloud/azure/resourceGroup/examples/azure-pipelines.yml @@ -21,7 +21,7 @@ extends: variablesDirectory: ./cloud/azure/keyVault/examples/variables azure: subscription: - azureServiceConnection: $(azureServiceConnection) + serviceConnection: $(serviceConnection) subscriptionId: $(subscriptionId) resourceGroup: name: $(resourceGroupName) diff --git a/src/cloud/azure/resourceGroup/examples/variables/dev-vars.yml b/src/cloud/azure/resourceGroup/examples/variables/dev-vars.yml index 4f1d22f..2f77a9c 100644 --- a/src/cloud/azure/resourceGroup/examples/variables/dev-vars.yml +++ b/src/cloud/azure/resourceGroup/examples/variables/dev-vars.yml @@ -1,5 +1,5 @@ variables: - azureServiceConnection: ServiceConnection + serviceConnection: ServiceConnection subscriptionId: 337ba254-3aa0-4551-ba8e-89debefaa373 location: northeurope resourceGroupName: rg-releaseengine-dev \ No newline at end of file diff --git a/src/cloud/azure/resourceGroup/examples/variables/prd-vars.yml b/src/cloud/azure/resourceGroup/examples/variables/prd-vars.yml index e4854bd..98b2ba6 100644 --- a/src/cloud/azure/resourceGroup/examples/variables/prd-vars.yml +++ b/src/cloud/azure/resourceGroup/examples/variables/prd-vars.yml @@ -1,5 +1,5 @@ variables: - azureServiceConnection: ServiceConnection + serviceConnection: ServiceConnection subscriptionId: 337ba254-3aa0-4551-ba8e-89debefaa373 location: northeurope resourceGroupName: rg-releaseengine-prd \ No newline at end of file diff --git a/src/cloud/azure/resourceGroup/examples/variables/uat-vars.yml b/src/cloud/azure/resourceGroup/examples/variables/uat-vars.yml index 8d68cfc..cf26331 100644 --- a/src/cloud/azure/resourceGroup/examples/variables/uat-vars.yml +++ b/src/cloud/azure/resourceGroup/examples/variables/uat-vars.yml @@ -1,5 +1,5 @@ variables: - azureServiceConnection: ServiceConnection + serviceConnection: ServiceConnection subscriptionId: 337ba254-3aa0-4551-ba8e-89debefaa373 location: northeurope resourceGroupName: rg-releaseengine-uat \ No newline at end of file diff --git a/src/cloud/azure/resourceGroup/resourceGroup-build-jobs.yml b/src/cloud/azure/resourceGroup/resourceGroup-build-jobs.yml index 77ba20a..42b1815 100644 --- a/src/cloud/azure/resourceGroup/resourceGroup-build-jobs.yml +++ b/src/cloud/azure/resourceGroup/resourceGroup-build-jobs.yml @@ -4,15 +4,16 @@ parameters: jobs: - job: resourceGroupBuildJob - displayName: Resource Group Build Job + displayName: IaC - Resource Group Build Job steps: - template: ../bicep/bicep-build-tasks.yml parameters: - bicepFilePath: $(Build.SourcesDirectory)/src/cloud/azure/resourceGroup/resourceGroup.bicep + resourceType: resourceGroup + outDir: resourceGroup - task: PublishPipelineArtifact@1 inputs: targetPath: '$(build.artifactstagingdirectory)' - artifact: resourceGroup + artifact: governance publishLocation: 'pipeline' \ No newline at end of file diff --git a/src/cloud/azure/resourceGroup/resourceGroup-deploy-jobs.yml b/src/cloud/azure/resourceGroup/resourceGroup-deploy-jobs.yml index 671a1e7..142ff1d 100644 --- a/src/cloud/azure/resourceGroup/resourceGroup-deploy-jobs.yml +++ b/src/cloud/azure/resourceGroup/resourceGroup-deploy-jobs.yml @@ -18,13 +18,13 @@ jobs: displayName: Creating Resource Group '${{ parameters.settings.azure.resourceGroup.name }}' by IaC inputs: deploymentScope: 'Subscription' - azureResourceManagerConnection: '${{ parameters.settings.azure.subscription.azureServiceConnection }}' + 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)/resourceGroup/infrastructure/resourceGroup.json' + csmFile: '$(Pipeline.Workspace)/governance/resourceGroup/resourceGroup.json' overrideParameters: > -resourceGroupLocation ${{ parameters.settings.azure.resourceGroup.location }} -resourceGroupName ${{ parameters.settings.azure.resourceGroup.name }} diff --git a/src/config/config.yml b/src/config/config.yml new file mode 100644 index 0000000..b22aa7b --- /dev/null +++ b/src/config/config.yml @@ -0,0 +1,3 @@ +variables: + releaseEngineRepositoryName: AzureDevOpsReleaseEngine + \ No newline at end of file diff --git a/src/development/dotnetCore/dotnetCore-build-jobs.yml b/src/development/dotnetCore/dotnetCore-build-jobs.yml new file mode 100644 index 0000000..a7ede30 --- /dev/null +++ b/src/development/dotnetCore/dotnetCore-build-jobs.yml @@ -0,0 +1,62 @@ +parameters: + - name: resource + type: object + +jobs: + # - ${{ if eq(parameters.resource.deploy.type, 'azureWebApp') }}: + # # - template: ../../cloud/azure/bicep/bicep-build-tasks.yml + # # parameters: + # # resourceType: appService + # - template: ../../cloud/azure/appService/appService-build-jobs.yml + # parameters: + # resource: ${{ parameters.resource }} + + + - job: + displayName: App - ${{ parameters.resource.runName }} Build Job + variables: + BuildPlatform: 'Any CPU' + BuildConfiguration: 'Release' + steps: + + - checkout: self + + - task: DotNetCoreCLI@2 + displayName: Restore + inputs: + command: restore + projects: | + **\*.csproj + + - task: DotNetCoreCLI@2 + displayName: Build + inputs: + projects: | + **\*.csproj + arguments: '--configuration $(BuildConfiguration)' + + - task: DotNetCoreCLI@2 + displayName: Test + inputs: + command: test + projects: '**/*[Tt]ests/*.csproj' + arguments: '--configuration $(BuildConfiguration)' + + - task: DotNetCoreCLI@2 + displayName: Publish + inputs: + command: publish + publishWebProjects: True + arguments: '--configuration $(BuildConfiguration) --output $(build.artifactstagingdirectory)/application' + zipAfterPublish: True + + - template: ../../cloud/azure/bicep/bicep-build-tasks.yml + parameters: + resourceType: appService + # resource: ${{ parameters.resource }} + + - task: PublishPipelineArtifact@1 + inputs: + targetPath: '$(build.artifactstagingdirectory)' + artifact: ${{ parameters.resource.runName }} + publishLocation: 'pipeline' \ No newline at end of file diff --git a/src/development/dotnetCore/dotnetCore-deploy-jobs.yml b/src/development/dotnetCore/dotnetCore-deploy-jobs.yml new file mode 100644 index 0000000..762cde7 --- /dev/null +++ b/src/development/dotnetCore/dotnetCore-deploy-jobs.yml @@ -0,0 +1,17 @@ +parameters: + - name: settings + type: object + - name: resource + type: object + - name: environment + type: string + +jobs: + + - ${{ if eq(parameters.resource.deploy.type, 'azureWebApp') }}: + + - template: ../../cloud/azure/appService/appService-deploy-jobs.yml + parameters: + settings: ${{ parameters.settings }} + environment: ${{ parameters.environment }} + resource: ${{ parameters.resource }} diff --git a/src/development/dotnetCore/examples/azure-pipelines.yml b/src/development/dotnetCore/examples/azure-pipelines.yml new file mode 100644 index 0000000..ed4787f --- /dev/null +++ b/src/development/dotnetCore/examples/azure-pipelines.yml @@ -0,0 +1,59 @@ +resources: + repositories: + - repository: releaseEngine + type: github + endpoint: devopsnights + name: devopsnights/AzureDevOpsReleaseEngine + ref: refs/heads/feature/appService + +trigger: + branches: + include: + - main + - feature/* + paths: + include: + - src/development/dotnetCore/* + + +pool: + # vmImage: 'windows-latest' + name: default + +extends: + template: /src/main.yml@releaseEngine + parameters: + settings: + build: + enabled: true + deploy: + enabled: true + variablesDirectory: /src/development/dotnetCore/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: $(applicationName) + type: dotnetCore + runName: app-releaseengine + enabled: true + deploy: + type: azureWebApp + infrastructure: + enabled: true + servicePlanName: $(servicePlanName) + application: + enabled: true diff --git a/src/development/dotnetCore/examples/src/dotnetcoreApp.sln b/src/development/dotnetCore/examples/src/dotnetcoreApp.sln new file mode 100644 index 0000000..4e277fb --- /dev/null +++ b/src/development/dotnetCore/examples/src/dotnetcoreApp.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30717.126 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnetcoreApp", "dotnetcoreApp\dotnetcoreApp.csproj", "{9295975A-56C3-4A17-AC4A-64CA419EECFF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9295975A-56C3-4A17-AC4A-64CA419EECFF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9295975A-56C3-4A17-AC4A-64CA419EECFF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9295975A-56C3-4A17-AC4A-64CA419EECFF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9295975A-56C3-4A17-AC4A-64CA419EECFF}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {CEC53890-405B-499F-A7BF-37E4A8600423} + EndGlobalSection +EndGlobal diff --git a/src/development/dotnetCore/examples/src/dotnetcoreApp/Controllers/HomeController.cs b/src/development/dotnetCore/examples/src/dotnetcoreApp/Controllers/HomeController.cs new file mode 100644 index 0000000..0d34154 --- /dev/null +++ b/src/development/dotnetCore/examples/src/dotnetcoreApp/Controllers/HomeController.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using dotnetcoreApp.Models; + +namespace dotnetcoreApp.Controllers +{ + public class HomeController : Controller + { + public IActionResult Index() + { + return View(); + } + + public IActionResult About() + { + ViewData["Message"] = "Your application description page."; + + return View(); + } + + public IActionResult Contact() + { + ViewData["Message"] = "Your contact page."; + + return View(); + } + + public IActionResult Privacy() + { + return View(); + } + + [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] + public IActionResult Error() + { + return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); + } + } +} diff --git a/src/development/dotnetCore/examples/src/dotnetcoreApp/Models/ErrorViewModel.cs b/src/development/dotnetCore/examples/src/dotnetcoreApp/Models/ErrorViewModel.cs new file mode 100644 index 0000000..0e12d28 --- /dev/null +++ b/src/development/dotnetCore/examples/src/dotnetcoreApp/Models/ErrorViewModel.cs @@ -0,0 +1,11 @@ +using System; + +namespace dotnetcoreApp.Models +{ + public class ErrorViewModel + { + public string RequestId { get; set; } + + public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); + } +} \ No newline at end of file diff --git a/src/development/dotnetCore/examples/src/dotnetcoreApp/Program.cs b/src/development/dotnetCore/examples/src/dotnetcoreApp/Program.cs new file mode 100644 index 0000000..b987ada --- /dev/null +++ b/src/development/dotnetCore/examples/src/dotnetcoreApp/Program.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; + +namespace dotnetcoreApp +{ + public class Program + { + public static void Main(string[] args) + { + CreateWebHostBuilder(args).Build().Run(); + } + + public static IWebHostBuilder CreateWebHostBuilder(string[] args) => + WebHost.CreateDefaultBuilder(args) + .UseStartup(); + } +} diff --git a/src/development/dotnetCore/examples/src/dotnetcoreApp/Properties/launchSettings.json b/src/development/dotnetCore/examples/src/dotnetcoreApp/Properties/launchSettings.json new file mode 100644 index 0000000..295d98e --- /dev/null +++ b/src/development/dotnetCore/examples/src/dotnetcoreApp/Properties/launchSettings.json @@ -0,0 +1,27 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:11406", + "sslPort": 44305 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "dotnetcoreApp": { + "commandName": "Project", + "launchBrowser": true, + "applicationUrl": "https://localhost:5001;http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} \ No newline at end of file diff --git a/src/development/dotnetCore/examples/src/dotnetcoreApp/Startup.cs b/src/development/dotnetCore/examples/src/dotnetcoreApp/Startup.cs new file mode 100644 index 0000000..9856746 --- /dev/null +++ b/src/development/dotnetCore/examples/src/dotnetcoreApp/Startup.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.HttpsPolicy; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; + +namespace dotnetcoreApp +{ + public class Startup + { + public Startup(IConfiguration configuration) + { + Configuration = configuration; + } + + public IConfiguration Configuration { get; } + + // This method gets called by the runtime. Use this method to add services to the container. + public void ConfigureServices(IServiceCollection services) + { + services.Configure(options => + { + // This lambda determines whether user consent for non-essential cookies is needed for a given request. + options.CheckConsentNeeded = context => true; + options.MinimumSameSitePolicy = SameSiteMode.None; + }); + + + services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IHostingEnvironment env) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + } + else + { + app.UseExceptionHandler("/Home/Error"); + app.UseHsts(); + } + + app.UseHttpsRedirection(); + app.UseStaticFiles(); + app.UseCookiePolicy(); + + app.UseMvc(routes => + { + routes.MapRoute( + name: "default", + template: "{controller=Home}/{action=Index}/{id?}"); + }); + } + } +} diff --git a/src/development/dotnetCore/examples/src/dotnetcoreApp/Views/Home/About.cshtml b/src/development/dotnetCore/examples/src/dotnetcoreApp/Views/Home/About.cshtml new file mode 100644 index 0000000..3674e37 --- /dev/null +++ b/src/development/dotnetCore/examples/src/dotnetcoreApp/Views/Home/About.cshtml @@ -0,0 +1,7 @@ +@{ + ViewData["Title"] = "About"; +} +

@ViewData["Title"]

+

@ViewData["Message"]

+ +

Use this area to provide additional information.

diff --git a/src/development/dotnetCore/examples/src/dotnetcoreApp/Views/Home/Contact.cshtml b/src/development/dotnetCore/examples/src/dotnetcoreApp/Views/Home/Contact.cshtml new file mode 100644 index 0000000..a11a186 --- /dev/null +++ b/src/development/dotnetCore/examples/src/dotnetcoreApp/Views/Home/Contact.cshtml @@ -0,0 +1,17 @@ +@{ + ViewData["Title"] = "Contact"; +} +

@ViewData["Title"]

+

@ViewData["Message"]

+ +
+ One Microsoft Way
+ Redmond, WA 98052-6399
+ P: + 425.555.0100 +
+ +
+ Support: Support@example.com
+ Marketing: Marketing@example.com +
diff --git a/src/development/dotnetCore/examples/src/dotnetcoreApp/Views/Home/Index.cshtml b/src/development/dotnetCore/examples/src/dotnetcoreApp/Views/Home/Index.cshtml new file mode 100644 index 0000000..f42d2a0 --- /dev/null +++ b/src/development/dotnetCore/examples/src/dotnetcoreApp/Views/Home/Index.cshtml @@ -0,0 +1,94 @@ +@{ + ViewData["Title"] = "Home Page"; +} + + + + diff --git a/src/development/dotnetCore/examples/src/dotnetcoreApp/Views/Home/Privacy.cshtml b/src/development/dotnetCore/examples/src/dotnetcoreApp/Views/Home/Privacy.cshtml new file mode 100644 index 0000000..7bd3861 --- /dev/null +++ b/src/development/dotnetCore/examples/src/dotnetcoreApp/Views/Home/Privacy.cshtml @@ -0,0 +1,6 @@ +@{ + ViewData["Title"] = "Privacy Policy"; +} +

@ViewData["Title"]

+ +

Use this page to detail your site's privacy policy.

diff --git a/src/development/dotnetCore/examples/src/dotnetcoreApp/Views/Shared/Error.cshtml b/src/development/dotnetCore/examples/src/dotnetcoreApp/Views/Shared/Error.cshtml new file mode 100644 index 0000000..ec2ea6b --- /dev/null +++ b/src/development/dotnetCore/examples/src/dotnetcoreApp/Views/Shared/Error.cshtml @@ -0,0 +1,22 @@ +@model ErrorViewModel +@{ + ViewData["Title"] = "Error"; +} + +

Error.

+

An error occurred while processing your request.

+ +@if (Model.ShowRequestId) +{ +

+ Request ID: @Model.RequestId +

+} + +

Development Mode

+

+ Swapping to Development environment will display more detailed information about the error that occurred. +

+

+ Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application. +

diff --git a/src/development/dotnetCore/examples/src/dotnetcoreApp/Views/Shared/_CookieConsentPartial.cshtml b/src/development/dotnetCore/examples/src/dotnetcoreApp/Views/Shared/_CookieConsentPartial.cshtml new file mode 100644 index 0000000..bbfbb09 --- /dev/null +++ b/src/development/dotnetCore/examples/src/dotnetcoreApp/Views/Shared/_CookieConsentPartial.cshtml @@ -0,0 +1,41 @@ +@using Microsoft.AspNetCore.Http.Features + +@{ + var consentFeature = Context.Features.Get(); + var showBanner = !consentFeature?.CanTrack ?? false; + var cookieString = consentFeature?.CreateConsentCookie(); +} + +@if (showBanner) +{ + + +} \ No newline at end of file diff --git a/src/development/dotnetCore/examples/src/dotnetcoreApp/Views/Shared/_Layout.cshtml b/src/development/dotnetCore/examples/src/dotnetcoreApp/Views/Shared/_Layout.cshtml new file mode 100644 index 0000000..12e7a39 --- /dev/null +++ b/src/development/dotnetCore/examples/src/dotnetcoreApp/Views/Shared/_Layout.cshtml @@ -0,0 +1,74 @@ + + + + + + @ViewData["Title"] - dotnetcoreApp + + + + + + + + + + + + + + + +
+ @RenderBody() +
+
+

© 2019 - dotnetcoreApp

+
+
+ + + + + + + + + + + + + @RenderSection("Scripts", required: false) + + diff --git a/src/development/dotnetCore/examples/src/dotnetcoreApp/Views/Shared/_ValidationScriptsPartial.cshtml b/src/development/dotnetCore/examples/src/dotnetcoreApp/Views/Shared/_ValidationScriptsPartial.cshtml new file mode 100644 index 0000000..2a9241f --- /dev/null +++ b/src/development/dotnetCore/examples/src/dotnetcoreApp/Views/Shared/_ValidationScriptsPartial.cshtml @@ -0,0 +1,18 @@ + + + + + + + + diff --git a/src/development/dotnetCore/examples/src/dotnetcoreApp/Views/_ViewImports.cshtml b/src/development/dotnetCore/examples/src/dotnetcoreApp/Views/_ViewImports.cshtml new file mode 100644 index 0000000..6195c42 --- /dev/null +++ b/src/development/dotnetCore/examples/src/dotnetcoreApp/Views/_ViewImports.cshtml @@ -0,0 +1,3 @@ +@using dotnetcoreApp +@using dotnetcoreApp.Models +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/src/development/dotnetCore/examples/src/dotnetcoreApp/Views/_ViewStart.cshtml b/src/development/dotnetCore/examples/src/dotnetcoreApp/Views/_ViewStart.cshtml new file mode 100644 index 0000000..a5f1004 --- /dev/null +++ b/src/development/dotnetCore/examples/src/dotnetcoreApp/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +} diff --git a/src/development/dotnetCore/examples/src/dotnetcoreApp/appsettings.Development.json b/src/development/dotnetCore/examples/src/dotnetcoreApp/appsettings.Development.json new file mode 100644 index 0000000..e203e94 --- /dev/null +++ b/src/development/dotnetCore/examples/src/dotnetcoreApp/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Microsoft": "Information" + } + } +} diff --git a/src/development/dotnetCore/examples/src/dotnetcoreApp/appsettings.json b/src/development/dotnetCore/examples/src/dotnetcoreApp/appsettings.json new file mode 100644 index 0000000..c21d10d --- /dev/null +++ b/src/development/dotnetCore/examples/src/dotnetcoreApp/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Warning" + } + }, + "AllowedHosts": "*", + "Config": "valuetoreplace" +} diff --git a/src/development/dotnetCore/examples/src/dotnetcoreApp/appsettings.release.json b/src/development/dotnetCore/examples/src/dotnetcoreApp/appsettings.release.json new file mode 100644 index 0000000..92fe98b --- /dev/null +++ b/src/development/dotnetCore/examples/src/dotnetcoreApp/appsettings.release.json @@ -0,0 +1,11 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Microsoft": "Information" + }, + "AllowedHosts": "*", + "Config": "__Config__" + } +} diff --git a/src/development/dotnetCore/examples/src/dotnetcoreApp/dotnetcoreApp.csproj b/src/development/dotnetCore/examples/src/dotnetcoreApp/dotnetcoreApp.csproj new file mode 100644 index 0000000..2d892de --- /dev/null +++ b/src/development/dotnetCore/examples/src/dotnetcoreApp/dotnetcoreApp.csproj @@ -0,0 +1,18 @@ + + + + netcoreapp2.1 + + + + + + + + + + Always + + + + diff --git a/src/development/dotnetCore/examples/variables/dev-vars.yml b/src/development/dotnetCore/examples/variables/dev-vars.yml new file mode 100644 index 0000000..436e7a7 --- /dev/null +++ b/src/development/dotnetCore/examples/variables/dev-vars.yml @@ -0,0 +1,9 @@ +variables: + serviceConnection: ServiceConnection + subscriptionId: 337ba254-3aa0-4551-ba8e-89debefaa373 + location: northeurope + resourceGroupName: rg-dotnetcore-releaseengine-dev + + servicePlanName: plan-dotnetcore-releaseengine-dev + applicationName: app-dotnetcore-releaseengine-dev + \ No newline at end of file diff --git a/src/development/dotnetCore/examples/variables/prd-vars.yml b/src/development/dotnetCore/examples/variables/prd-vars.yml new file mode 100644 index 0000000..bd066f7 --- /dev/null +++ b/src/development/dotnetCore/examples/variables/prd-vars.yml @@ -0,0 +1,8 @@ +variables: + serviceConnection: ServiceConnection + subscriptionId: 337ba254-3aa0-4551-ba8e-89debefaa373 + location: northeurope + resourceGroupName: rg-dotnetcore-releaseengine-prd + + servicePlanName: plan-dotnetcore-releaseengine-prd + applicationName: app-dotnetcore-releaseengine-prd \ No newline at end of file diff --git a/src/development/dotnetCore/examples/variables/uat-vars.yml b/src/development/dotnetCore/examples/variables/uat-vars.yml new file mode 100644 index 0000000..39bcb11 --- /dev/null +++ b/src/development/dotnetCore/examples/variables/uat-vars.yml @@ -0,0 +1,8 @@ +variables: + serviceConnection: ServiceConnection + subscriptionId: 337ba254-3aa0-4551-ba8e-89debefaa373 + location: northeurope + resourceGroupName: rg-dotnetcore-releaseengine-uat + + servicePlanName: plan-dotnetcore-releaseengine-uat + applicationName: app-dotnetcore-releaseengine-uat \ No newline at end of file diff --git a/src/gitflow-main.yml b/src/gitflow-main.yml new file mode 100644 index 0000000..bcdcf0e --- /dev/null +++ b/src/gitflow-main.yml @@ -0,0 +1,46 @@ +parameters: + - name: settings + type: object + - name: resources + type: object + +variables: + - name: serviceConnection + value: ServiceConnection + - name: releaseEngineRepoName + value: AzureDevOpsReleaseEngine + + - template: config/config.yml + + # - ${{ if eq( variables.Build_Repository_Name, variables.releaseFrameworkRepoName) }}: + # - name: bicepDirectory + # value: $(Build.SourcesDirectory)/$(releaseEngineRepositoryName)/src/cloud/azure/keyVault/ + # - ${{ else }}: + # - name: bicepDirectory + # value: $(Build.SourcesDirectory)/src/cloud/azure/keyVault/ + +stages: + + - ${{ if eq(parameters.settings.build.enabled, 'true') }}: + - stage: build + + jobs: + + - template: ./_jobs/build-jobs.yml + parameters: + settings: ${{ parameters.settings }} + resources: ${{ parameters.resources }} + + - ${{ if eq(parameters.settings.deploy.enabled, 'true') }}: + - ${{ each env in parameters.settings.environments }}: + - stage: ${{ env }} + + variables: + - template: ${{ parameters.settings.deploy.variablesDirectory }}/${{ env }}-vars.yml@self + + jobs: + - template: ./_jobs/deploy-jobs.yml + parameters: + settings: ${{ parameters.settings }} + resources: ${{ parameters.resources }} + environment: ${{ env }} \ No newline at end of file diff --git a/src/main.yml b/src/main.yml index dc070e5..cf19533 100644 --- a/src/main.yml +++ b/src/main.yml @@ -5,14 +5,25 @@ parameters: type: object variables: - - name: azureServiceConnection + - name: serviceConnection value: ServiceConnection + - name: releaseEngineRepoName + value: AzureDevOpsReleaseEngine + + - template: ./../config/config.yml + + # - ${{ if eq( variables.Build_Repository_Name, variables.releaseFrameworkRepoName) }}: + # - name: bicepDirectory + # value: $(Build.SourcesDirectory)/$(releaseEngineRepoName)/src/cloud/azure/keyVault/ + # - ${{ else }}: + # - name: bicepDirectory + # value: $(Build.SourcesDirectory)/src/cloud/azure/keyVault/ stages: - ${{ if eq(parameters.settings.build.enabled, 'true') }}: - stage: build - + jobs: - template: ./_jobs/build-jobs.yml @@ -25,7 +36,7 @@ stages: - stage: ${{ env }} variables: - - template: ${{ parameters.settings.deploy.variablesDirectory }}/${{ env }}-vars.yml + - template: ${{ parameters.settings.deploy.variablesDirectory }}/${{ env }}-vars.yml@self jobs: - template: ./_jobs/deploy-jobs.yml