From 1ccf0a7fbfd6350a886dce1a517b3bc90c3b86bf Mon Sep 17 00:00:00 2001 From: Zach Trocinski <30884663+oZakari@users.noreply.github.com> Date: Tue, 4 Apr 2023 03:04:19 -0500 Subject: [PATCH] 26294: Accelerator Pipeline Adjustments (#487) --- accelerator/.github/workflows/alz-bicep-1.yml | 1 + accelerator/.github/workflows/alz-bicep-2.yml | 2 +- accelerator/.github/workflows/alz-bicep-3.yml | 2 +- .../.github/workflows/alz-bicep-4a.yml | 1 + .../.github/workflows/alz-bicep-4b.yml | 3 ++- .../.github/workflows/alz-bicep-pr-1.yml | 19 +++++++++++++++++-- .../Deploy-ALZHub-HubAndSpoke.ps1 | 4 ++-- .../pipeline-scripts/Deploy-ALZHub-VWAN.ps1 | 6 +++--- .../Deploy-ALZLoggingAndSentinel.ps1 | 4 ++-- 9 files changed, 30 insertions(+), 12 deletions(-) diff --git a/accelerator/.github/workflows/alz-bicep-1.yml b/accelerator/.github/workflows/alz-bicep-1.yml index c8a5e25ed..e4da7bbe5 100644 --- a/accelerator/.github/workflows/alz-bicep-1.yml +++ b/accelerator/.github/workflows/alz-bicep-1.yml @@ -21,6 +21,7 @@ env: UPSTREAM_RELEASE_VERSION: "" MANAGEMENT_SUBSCRIPTION_ID: "" TOP_LEVEL_MG_PREFIX: "" + LOGGING_RESOURCE_GROUP: "" jobs: ALZ_Bicep_1_Workflow_Job: diff --git a/accelerator/.github/workflows/alz-bicep-2.yml b/accelerator/.github/workflows/alz-bicep-2.yml index 6624a36f9..45f268ac1 100644 --- a/accelerator/.github/workflows/alz-bicep-2.yml +++ b/accelerator/.github/workflows/alz-bicep-2.yml @@ -32,7 +32,7 @@ jobs: with: client-id: ${{ secrets.AZURE_CLIENT_ID }} tenant-id: ${{ secrets.AZURE_TENANT_ID }} - subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + subscription-id: ${{ env.MANAGEMENT_SUBSCRIPTION_ID }} enable-AzPSSession: true # Example: Modify Deploy-ALZRoleAssignments.ps1 with applicable pararameter file and uncomment lines below to enable Role Assignments Deployment. diff --git a/accelerator/.github/workflows/alz-bicep-3.yml b/accelerator/.github/workflows/alz-bicep-3.yml index 1c91b9924..ea33a3709 100644 --- a/accelerator/.github/workflows/alz-bicep-3.yml +++ b/accelerator/.github/workflows/alz-bicep-3.yml @@ -31,7 +31,7 @@ jobs: with: client-id: ${{ secrets.AZURE_CLIENT_ID }} tenant-id: ${{ secrets.AZURE_TENANT_ID }} - subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + subscription-id: ${{ env.MANAGEMENT_SUBSCRIPTION_ID }} enable-AzPSSession: true - name: "Deploy Subscription Placement" diff --git a/accelerator/.github/workflows/alz-bicep-4a.yml b/accelerator/.github/workflows/alz-bicep-4a.yml index ec495589c..46620f2db 100644 --- a/accelerator/.github/workflows/alz-bicep-4a.yml +++ b/accelerator/.github/workflows/alz-bicep-4a.yml @@ -18,6 +18,7 @@ env: UPSTREAM_RELEASE_VERSION: "" CONNECTIVITY_SUBSCRIPTION_ID: "" TOP_LEVEL_MG_PREFIX: "" + CONNECTIVITY_RESOURCE_GROUP: "" jobs: ALZ_Bicep_4a_Workflow_Job: diff --git a/accelerator/.github/workflows/alz-bicep-4b.yml b/accelerator/.github/workflows/alz-bicep-4b.yml index 358abed9d..dbcbc5894 100644 --- a/accelerator/.github/workflows/alz-bicep-4b.yml +++ b/accelerator/.github/workflows/alz-bicep-4b.yml @@ -6,7 +6,7 @@ on: - "main" paths: - "config/custom-parameters/resourceGroupConnectivity.parameters.all.json" - - "config/custom-parameters/hubNetworking.parameters.all.json" + - "config/custom-parameters/vwanConnectivity.parameters.all.json" workflow_dispatch: permissions: @@ -18,6 +18,7 @@ env: UPSTREAM_RELEASE_VERSION: "" CONNECTIVITY_SUBSCRIPTION_ID: "" TOP_LEVEL_MG_PREFIX: "" + CONNECTIVITY_RESOURCE_GROUP: "" jobs: ALZ_Bicep_4b_Workflow_Job: diff --git a/accelerator/.github/workflows/alz-bicep-pr-1.yml b/accelerator/.github/workflows/alz-bicep-pr-1.yml index 7834e9ce8..dd883ecdd 100644 --- a/accelerator/.github/workflows/alz-bicep-pr-1.yml +++ b/accelerator/.github/workflows/alz-bicep-pr-1.yml @@ -43,12 +43,27 @@ jobs: $bicepVersion = bicep --version Write-Information "=====> Now installed Bicep version is: $bicepVersion <=====" -InformationAction Continue + - name: Check for Custom Modules + shell: pwsh + working-directory: config + run: | + if (Test-Path -Path ./custom-modules/*) + { + echo "CUSTOM_MODULES=true" >> $env:GITHUB_ENV + echo "Set CUSTOM_MODULES to true" + } + else + { + echo "Set CUSTOM_MODULES to false" + } + - name: Bicep Build & Lint All Custom Modules shell: pwsh + if: ${{ env.CUSTOM_MODULES == 'true' }} working-directory: config/custom-modules run: | $output = @() - Get-ChildItem -Recurse -Filter '*.bicep' -Exclude 'callModuleFromACR.example.bicep','orchHubSpoke.bicep' | ForEach-Object { + Get-ChildItem -Recurse -Filter '*.bicep' | ForEach-Object { Write-Information "==> Attempting Bicep Build For File: $_" -InformationAction Continue $bicepOutput = bicep build $_.FullName 2>&1 if ($LastExitCode -ne 0) @@ -57,7 +72,7 @@ jobs: $output += "$($item) `r`n" } } - Else + else { echo "Bicep Build Successful for File: $_" } diff --git a/accelerator/pipeline-scripts/Deploy-ALZHub-HubAndSpoke.ps1 b/accelerator/pipeline-scripts/Deploy-ALZHub-HubAndSpoke.ps1 index 22edae4bb..8c7c50133 100644 --- a/accelerator/pipeline-scripts/Deploy-ALZHub-HubAndSpoke.ps1 +++ b/accelerator/pipeline-scripts/Deploy-ALZHub-HubAndSpoke.ps1 @@ -3,7 +3,7 @@ param ( [String]$ConnectivitySubscriptionId = "$($env:CONNECTIVITY_SUBSCRIPTION_ID)", [Parameter()] - [String]$TopLevelMGPrefix = "$($env:TOP_LEVEL_MG_PREFIX)", + [String]$ConnectivityResourceGroup = "$($env:CONNECTIVITY_RESOURCE_GROUP)", [Parameter()] [String]$TemplateFile = "upstream-releases\$($env:UPSTREAM_RELEASE_VERSION)\infra-as-code\bicep\modules\hubNetworking\hubNetworking.bicep", @@ -15,7 +15,7 @@ param ( # Parameters necessary for deployment $inputObject = @{ DeploymentName = 'alz-Hub-and-SpokeDeploy-{0}' -f ( -join (Get-Date -Format 'yyyyMMddTHHMMssffffZ')[0..63]) - ResourceGroupName = "rg-$TopLevelMGPrefix-hub-networking-001" + ResourceGroupName = $ConnectivityResourceGroup TemplateFile = $TemplateFile TemplateParameterFile = $TemplateParameterFile Verbose = $true diff --git a/accelerator/pipeline-scripts/Deploy-ALZHub-VWAN.ps1 b/accelerator/pipeline-scripts/Deploy-ALZHub-VWAN.ps1 index df227e261..4a73fd971 100644 --- a/accelerator/pipeline-scripts/Deploy-ALZHub-VWAN.ps1 +++ b/accelerator/pipeline-scripts/Deploy-ALZHub-VWAN.ps1 @@ -3,7 +3,7 @@ param ( [String]$ConnectivitySubscriptionId = "$($env:CONNECTIVITY_SUBSCRIPTION_ID)", [Parameter()] - [String]$TopLevelMGPrefix = "$($env:TOP_LEVEL_MG_PREFIX)", + [String]$ConnectivityResourceGroup = "$($env:CONNECTIVITY_RESOURCE_GROUP)", [Parameter()] [String]$TemplateFile = "upstream-releases\$($env:UPSTREAM_RELEASE_VERSION)\infra-as-code\bicep\modules\vwanConnectivity\vwanConnectivity.bicep", @@ -14,8 +14,8 @@ param ( # Parameters necessary for deployment $inputObject = @{ - DeploymentName = 'alz-VWAN-{0}' -f ( -join (Get-Date -Format 'yyyyMMddTHHMMssffffZ')[0..63]) - ResourceGroupName = "rg-$TopLevelMGPrefix-hub-networking-001" + DeploymentName = 'alz-VWANDeploy-{0}' -f ( -join (Get-Date -Format 'yyyyMMddTHHMMssffffZ')[0..63]) + ResourceGroupName = $ConnectivityResourceGroup TemplateFile = $TemplateFile TemplateParameterFile = $TemplateParameterFile Verbose = $true diff --git a/accelerator/pipeline-scripts/Deploy-ALZLoggingAndSentinel.ps1 b/accelerator/pipeline-scripts/Deploy-ALZLoggingAndSentinel.ps1 index b7fe3f525..ef3d578e5 100644 --- a/accelerator/pipeline-scripts/Deploy-ALZLoggingAndSentinel.ps1 +++ b/accelerator/pipeline-scripts/Deploy-ALZLoggingAndSentinel.ps1 @@ -3,7 +3,7 @@ param ( [String]$ManagementSubscriptionId = "$($env:MANAGEMENT_SUBSCRIPTION_ID)", [Parameter()] - [String]$TopLevelMGPrefix = "$($env:TOP_LEVEL_MG_PREFIX)", + [String]$LoggingResourceGroup = "$($env:LOGGING_RESOURCE_GROUP)", [Parameter()] [String]$TemplateFile = "upstream-releases\$($env:UPSTREAM_RELEASE_VERSION)\infra-as-code\bicep\modules\logging\logging.bicep", @@ -15,7 +15,7 @@ param ( # Parameters necessary for deployment $inputObject = @{ DeploymentName = 'alz-LoggingDeploy-{0}' -f ( -join (Get-Date -Format 'yyyyMMddTHHMMssffffZ')[0..63]) - ResourceGroupName = "rg-$TopLevelMGPrefix-logging-001" + ResourceGroupName = $LoggingResourceGroup TemplateFile = $TemplateFile TemplateParameterFile = $TemplateParameterFile Verbose = $true