From da361791fad3ff825b2c2475e88e854b8f7d801f Mon Sep 17 00:00:00 2001 From: Divesh Mavji Date: Thu, 20 Feb 2025 17:09:56 +0000 Subject: [PATCH 1/3] Added failed requests alert and updated app connection string --- azure-pipelines.yml | 4 +- azure/template.json | 133 +++++++++++++++++------------- pipeline-templates/job/deploy.yml | 9 +- 3 files changed, 87 insertions(+), 59 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 302eed374d..d4ac5f97a7 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -28,12 +28,12 @@ resources: - repository: das-platform-building-blocks type: github name: SkillsFundingAgency/das-platform-building-blocks - ref: refs/tags/2.1.28 + ref: refs/tags/2.2.25 endpoint: SkillsFundingAgency - repository: das-platform-automation type: github name: SkillsFundingAgency/das-platform-automation - ref: refs/tags/5.1.8 + ref: refs/tags/5.1.18 endpoint: SkillsFundingAgency pipelines: - pipeline: das-employer-config diff --git a/azure/template.json b/azure/template.json index f0c4f44115..81bb19d21d 100644 --- a/azure/template.json +++ b/azure/template.json @@ -127,6 +127,31 @@ "minimumTlsVersion": { "type": "string", "defaultValue": "TLS1_2" + }, + "applicationInsightsConnectionString": { + "type": "securestring", + "metadata": { + "description": "Shared application insights connection string retrieved from the get-product-app-insights step" + } + }, + "applicationInsightsResourceId": { + "type": "string", + "metadata": { + "description": "Shared application insights resource ID retrieved from the get-product-app-insights step" + } + }, + "alertActionGroupResourceId": { + "type": "string", + "metadata": { + "description": "Alert group resource ID found in the management resources variable groups" + } + }, + "enableFailedRequestAlert": { + "type": "bool", + "defaultValue": false, + "metadata": { + "description": "Enables alerting on app insights failed requests" + } } }, "variables": { @@ -260,33 +285,6 @@ "[variables('resourceGroupName')]" ] }, - { - "apiVersion": "2021-04-01", - "name": "[concat(variables('workerV2AppServiceName'), '-application-insights-', parameters('utcValue'))]", - "resourceGroup": "[variables('resourceGroupName')]", - "type": "Microsoft.Resources/deployments", - "properties": { - "mode": "Incremental", - "templateLink": { - "uri": "[concat(variables('deploymentUrlBase'), 'application-insights.json')]", - "contentVersion": "1.0.0.0" - }, - "parameters": { - "appInsightsName": { - "value": "[variables('workerV2AppServiceName')]" - }, - "attachedService": { - "value": "[variables('workerV2AppServiceName')]" - }, - "logAnalyticsWorkspaceId": { - "value": "[resourceId(parameters('logAnalyticsSubscriptionId'),parameters('sharedManagementResourceGroup'),'Microsoft.OperationalInsights/workspaces',parameters('logAnalyticsWorkspaceName'))]" - } - } - }, - "dependsOn": [ - "[variables('resourceGroupName')]" - ] - }, { "apiVersion": "2021-04-01", "name": "[concat(variables('workerV2AppServiceName'), '-', parameters('utcValue'))]", @@ -331,7 +329,7 @@ }, { "name": "APPLICATIONINSIGHTS_CONNECTION_STRING", - "value": "[reference(concat(variables('workerV2AppServiceName'), '-application-insights-', parameters('utcValue'))).outputs.ConnectionString.value]" + "value": "[parameters('applicationInsightsConnectionString')]" }, { "name": "FUNCTIONS_WORKER_RUNTIME", @@ -367,31 +365,29 @@ ] }, { + "condition": "[equals(parameters('enableFailedRequestAlert'), true())]", "apiVersion": "2021-04-01", - "name": "[concat(variables('apiV2AppServiceName'), '-application-insights-', parameters('utcValue'))]", - "resourceGroup": "[variables('resourceGroupName')]", + "name": "[concat('application-insights-', variables('workerV2AppServiceName'), '-alert-', parameters('utcValue'))]", "type": "Microsoft.Resources/deployments", + "resourceGroup": "[variables('resourceGroupName')]", "properties": { "mode": "Incremental", "templateLink": { - "uri": "[concat(variables('deploymentUrlBase'), 'application-insights.json')]", + "uri": "[concat(variables('deploymentUrlBase'),'application-insights-failed-requests-alert.json')]", "contentVersion": "1.0.0.0" }, "parameters": { - "appInsightsName": { - "value": "[variables('apiV2AppServiceName')]" + "serviceName": { + "value": "[variables('workerV2AppServiceName')]" }, - "attachedService": { - "value": "[variables('apiV2AppServiceName')]" + "applicationInsightsResourceId": { + "value": "[parameters('applicationInsightsResourceId')]" }, - "logAnalyticsWorkspaceId": { - "value": "[resourceId(parameters('logAnalyticsSubscriptionId'),parameters('sharedManagementResourceGroup'),'Microsoft.OperationalInsights/workspaces',parameters('logAnalyticsWorkspaceName'))]" + "alertActionGroupResourceId": { + "value": "[parameters('alertActionGroupResourceId')]" } } - }, - "dependsOn": [ - "[variables('resourceGroupName')]" - ] + } }, { "apiVersion": "2021-04-01", @@ -461,7 +457,7 @@ }, { "name": "APPLICATIONINSIGHTS_CONNECTION_STRING", - "value": "[reference(concat(variables('apiV2AppServiceName'), '-application-insights-', parameters('utcValue'))).outputs.ConnectionString.value]" + "value": "[parameters('applicationInsightsConnectionString')]" } ] } @@ -482,29 +478,29 @@ ] }, { - "condition": "[parameters('deploySupportApp')]", + "condition": "[equals(parameters('enableFailedRequestAlert'), true())]", "apiVersion": "2021-04-01", - "name": "[concat(variables('supportAppServiceName'), '-application-insights-', parameters('utcValue'))]", - "resourceGroup": "[variables('resourceGroupName')]", + "name": "[concat('application-insights-', variables('apiV2AppServiceName'), '-alert-', parameters('utcValue'))]", "type": "Microsoft.Resources/deployments", + "resourceGroup": "[variables('resourceGroupName')]", "properties": { "mode": "Incremental", "templateLink": { - "uri": "[concat(variables('deploymentUrlBase'), 'application-insights.json')]", + "uri": "[concat(variables('deploymentUrlBase'),'application-insights-failed-requests-alert.json')]", "contentVersion": "1.0.0.0" }, "parameters": { - "appInsightsName": { - "value": "[variables('supportAppServiceName')]" + "serviceName": { + "value": "[variables('apiV2AppServiceName')]" }, - "attachedService": { - "value": "[variables('supportAppServiceName')]" + "applicationInsightsResourceId": { + "value": "[parameters('applicationInsightsResourceId')]" + }, + "alertActionGroupResourceId": { + "value": "[parameters('alertActionGroupResourceId')]" } } - }, - "dependsOn": [ - "[variables('resourceGroupName')]" - ] + } }, { "condition": "[parameters('deploySupportApp')]", @@ -572,7 +568,7 @@ }, { "name": "APPLICATIONINSIGHTS_CONNECTION_STRING", - "value": "[if(parameters('deploySupportApp'), reference(concat(variables('supportAppServiceName'), '-application-insights-', parameters('utcValue'))).outputs.ConnectionString.value, '')]" + "value": "[parameters('applicationInsightsConnectionString')]" } ] } @@ -592,6 +588,31 @@ "[variables('resourceGroupName')]" ] }, + { + "condition": "[and(equals(parameters('enableFailedRequestAlert'), true()), parameters('deploySupportApp'))]", + "apiVersion": "2021-04-01", + "name": "[concat('application-insights-', variables('supportAppServiceName'), '-alert-', parameters('utcValue'))]", + "type": "Microsoft.Resources/deployments", + "resourceGroup": "[variables('resourceGroupName')]", + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[concat(variables('deploymentUrlBase'),'application-insights-failed-requests-alert.json')]", + "contentVersion": "1.0.0.0" + }, + "parameters": { + "serviceName": { + "value": "[variables('supportAppServiceName')]" + }, + "applicationInsightsResourceId": { + "value": "[parameters('applicationInsightsResourceId')]" + }, + "alertActionGroupResourceId": { + "value": "[parameters('alertActionGroupResourceId')]" + } + } + } + }, { "apiVersion": "2021-04-01", "name": "[concat(variables('workerV2AppServiceName'), '-apim-subscription-', parameters('utcValue'))]", @@ -768,4 +789,4 @@ "value": "[variables('serviceBusName')]" } } -} \ No newline at end of file +} diff --git a/pipeline-templates/job/deploy.yml b/pipeline-templates/job/deploy.yml index 420819271e..a0918f43db 100644 --- a/pipeline-templates/job/deploy.yml +++ b/pipeline-templates/job/deploy.yml @@ -29,6 +29,12 @@ jobs: ResourceEnvironmentName: $(ResourceEnvironmentName) UnrestrictedEnvironments: $(UnrestrictedEnvironments) UptimeMonitoringAccessRestrictions: $(UptimeMonitoringAccessRestrictions) + - template: azure-pipelines-templates/deploy/step/get-product-app-insights.yml@das-platform-building-blocks + parameters: + ServiceConnection: ${{ parameters.ServiceConnection }} + AppInsightsResourceGroup: $(SharedEnvResourceGroup) + AppInsightsName: $(ProductAppInsightsName) + IsMultiRepoCheckout: true - template: azure-pipelines-templates/deploy/step/arm-deploy.yml@das-platform-building-blocks parameters: ServiceConnection: ${{ parameters.ServiceConnection }} @@ -41,6 +47,7 @@ jobs: TemplateSecrets: ConfigurationStorageConnectionString: $(ConfigurationStorageConnectionString) SharedStorageAccountConnectionString: $(SharedStorageAccountConnectionString) + ApplicationInsightsConnectionString: $(ApplicationInsightsConnectionString) - template: azure-pipelines-templates/deploy/step/get-apim-subscription-key.yml@das-platform-building-blocks parameters: ServiceConnection: ${{ parameters.ServiceConnection }} @@ -114,7 +121,7 @@ jobs: AppServiceName: $(ApiV2AppServiceName) DeploymentPackagePath: $(Pipeline.Workspace)/${{ parameters.SolutionBaseName }}/${{ parameters.SolutionBaseName }}V2.Api.zip - template: azure-pipelines-templates/deploy/step/webjob-deploy.yml@das-platform-building-blocks - parameters: + parameters: ServiceConnection: ${{ parameters.ServiceConnection }} AppServiceName: $(WorkerV2AppServiceName) DeploymentPackagePath: $(Pipeline.Workspace)/${{ parameters.SolutionBaseName }}/${{ parameters.SolutionBaseName }}V2.Host.zip From 554a2a19349041ca5612ac0331b2694603681136 Mon Sep 17 00:00:00 2001 From: Divesh Mavji Date: Thu, 20 Feb 2025 17:23:44 +0000 Subject: [PATCH 2/3] increated java memory size --- pipeline-templates/job/code-build.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pipeline-templates/job/code-build.yml b/pipeline-templates/job/code-build.yml index 8819c82c8b..baf0d54252 100644 --- a/pipeline-templates/job/code-build.yml +++ b/pipeline-templates/job/code-build.yml @@ -17,7 +17,9 @@ jobs: parameters: RunAcceptanceTests: false ContinueOnVulnerablePackageScanError: true - + SonarCloudExtraProperties: | + sonar.scanner.javaOpts=-Xmx4096m + - task: DotNetCoreCLI@2 displayName: Publish - dotnet publish ${{ parameters.SolutionBaseName }}.Web inputs: @@ -27,7 +29,7 @@ jobs: arguments: -o $(build.artifactstagingdirectory)/publish -c ${{ parameters.BuildConfiguration }} --no-build modifyOutputPath: true zipAfterPublish: true - + - task: DotNetCoreCLI@2 displayName: Publish - dotnet publish ${{ parameters.SolutionBaseName }}.Api inputs: @@ -37,7 +39,7 @@ jobs: arguments: -o $(build.artifactstagingdirectory)/publish -c ${{ parameters.BuildConfiguration }} --no-build modifyOutputPath: true zipAfterPublish: true - + - task: DotNetCoreCLI@2 displayName: Publish - dotnet publish ${{ parameters.SolutionBaseName }}.Host inputs: @@ -54,7 +56,7 @@ jobs: Contents: | azure/** TargetFolder: $(build.artifactstagingdirectory)/publish - + - task: PublishPipelineArtifact@1 displayName: Publish Build Artifact inputs: @@ -71,4 +73,3 @@ jobs: src/CommitmentsV2/SFA.DAS.CommitmentsV2.Shared/SFA.DAS.CommitmentsV2.Shared.csproj; src/CommitmentsV2/SFA.DAS.ReservationsV2.Api.Types/SFA.DAS.ReservationsV2.Api.Types.csproj; src/SFA.DAS.Commitments.Events/SFA.DAS.Commitments.Events.csproj; - \ No newline at end of file From 1a31b6de2860571feafc28d69e1485d7852c2068 Mon Sep 17 00:00:00 2001 From: Divesh Mavji Date: Fri, 21 Feb 2025 16:34:57 +0000 Subject: [PATCH 3/3] reset checks --- pipeline-templates/job/code-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipeline-templates/job/code-build.yml b/pipeline-templates/job/code-build.yml index baf0d54252..e36df54d64 100644 --- a/pipeline-templates/job/code-build.yml +++ b/pipeline-templates/job/code-build.yml @@ -34,7 +34,7 @@ jobs: displayName: Publish - dotnet publish ${{ parameters.SolutionBaseName }}.Api inputs: command: publish - publishWebProjects: false #set to false as this setting (which defaults to true) will parse the entire repo for web projects + publishWebProjects: false #set to false as this setting ( which defaults to true) will parse the entire repo for web projects projects: src/CommitmentsV2/${{ parameters.SolutionBaseName }}V2.Api/${{ parameters.SolutionBaseName }}V2.Api.csproj arguments: -o $(build.artifactstagingdirectory)/publish -c ${{ parameters.BuildConfiguration }} --no-build modifyOutputPath: true