Skip to content

Commit

Permalink
26294: Accelerator - Add ability to import env file and minor fixes (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
oZakari authored Apr 6, 2023
1 parent 1ccf0a7 commit 1b72334
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 29 deletions.
18 changes: 13 additions & 5 deletions accelerator/.github/workflows/alz-bicep-1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- "main"
paths:
- "config/custom-parameters/managementGroups.parameters.all.json"
- "config/custom-parameters/resourceGroupLoggingAndSentinel.parameters.all.json"
- "config/custom-parameters/logging.parameters.all.json"
- "config/custom-parameters/customPolicyDefinitions.parameters.all.json"
- "config/custom-parameters/customRoleDefinitions.parameters.all.json"
Expand All @@ -17,11 +18,7 @@ permissions:
contents: read

env:
LOCATION: ""
UPSTREAM_RELEASE_VERSION: ""
MANAGEMENT_SUBSCRIPTION_ID: ""
TOP_LEVEL_MG_PREFIX: ""
LOGGING_RESOURCE_GROUP: ""
ENV_FILE: ".env"

jobs:
ALZ_Bicep_1_Workflow_Job:
Expand All @@ -32,6 +29,17 @@ jobs:
with:
fetch-depth: 0

- name: "Remove Quotation Marks from Environment File"
uses: azure/powershell@v1
with:
inlineScript: |
Write-Host $ENV_FILE
(Get-Content -Path $env:ENV_FILE -Encoding UTF8) | ForEach-Object {$_ -replace '"',''} | Out-File -FilePath $env:ENV_FILE -Encoding UTF8
azPSVersion: "latest"

- name: Import Environment Variables from File
run: cat ${{ env.ENV_FILE }} >> $GITHUB_ENV

- name: OIDC Login to Tenant
uses: azure/login@v1
with:
Expand Down
16 changes: 12 additions & 4 deletions accelerator/.github/workflows/alz-bicep-2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ permissions:
contents: read

env:
LOCATION: ""
UPSTREAM_RELEASE_VERSION: ""
MANAGEMENT_SUBSCRIPTION_ID: ""
TOP_LEVEL_MG_PREFIX: ""
ENV_FILE: ".env"

jobs:
ALZ_Bicep_2_Workflow_Job:
Expand All @@ -27,6 +24,17 @@ jobs:
with:
fetch-depth: 0

- name: "Remove Quotation Marks from Environment File"
uses: azure/powershell@v1
with:
inlineScript: |
Write-Host $ENV_FILE
(Get-Content -Path $env:ENV_FILE -Encoding UTF8) | ForEach-Object {$_ -replace '"',''} | Out-File -FilePath $env:ENV_FILE -Encoding UTF8
azPSVersion: "latest"

- name: Import Environment Variables from File
run: cat ${{ env.ENV_FILE }} >> $GITHUB_ENV

- name: OIDC Login to Tenant
uses: azure/login@v1
with:
Expand Down
17 changes: 13 additions & 4 deletions accelerator/.github/workflows/alz-bicep-3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@ on:
branches:
- "main"
paths:
- "config/custom-parameters/subscriptionPlacement.parameters.all.json"
- "config/custom-parameters/subPlacementAll.parameters.all.json"
workflow_dispatch:

permissions:
id-token: write
contents: read

env:
LOCATION: ""
UPSTREAM_RELEASE_VERSION: ""
TOP_LEVEL_MG_PREFIX: ""
ENV_FILE: ".env"

jobs:
ALZ_Bicep_3_Workflow_Job:
Expand All @@ -26,6 +24,17 @@ jobs:
with:
fetch-depth: 0

- name: "Remove Quotation Marks from Environment File"
uses: azure/powershell@v1
with:
inlineScript: |
Write-Host $ENV_FILE
(Get-Content -Path $env:ENV_FILE -Encoding UTF8) | ForEach-Object {$_ -replace '"',''} | Out-File -FilePath $env:ENV_FILE -Encoding UTF8
azPSVersion: "latest"

- name: Import Environment Variables from File
run: cat ${{ env.ENV_FILE }} >> $GITHUB_ENV

- name: OIDC Login to Tenant
uses: azure/login@v1
with:
Expand Down
17 changes: 12 additions & 5 deletions accelerator/.github/workflows/alz-bicep-4a.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ permissions:
contents: read

env:
LOCATION: ""
UPSTREAM_RELEASE_VERSION: ""
CONNECTIVITY_SUBSCRIPTION_ID: ""
TOP_LEVEL_MG_PREFIX: ""
CONNECTIVITY_RESOURCE_GROUP: ""
ENV_FILE: ".env"

jobs:
ALZ_Bicep_4a_Workflow_Job:
Expand All @@ -29,6 +25,17 @@ jobs:
with:
fetch-depth: 0

- name: "Remove Quotation Marks from Environment File"
uses: azure/powershell@v1
with:
inlineScript: |
Write-Host $ENV_FILE
(Get-Content -Path $env:ENV_FILE -Encoding UTF8) | ForEach-Object {$_ -replace '"',''} | Out-File -FilePath $env:ENV_FILE -Encoding UTF8
azPSVersion: "latest"

- name: Import Environment Variables from File
run: cat ${{ env.ENV_FILE }} >> $GITHUB_ENV

- name: OIDC Login to Tenant
uses: azure/login@v1
with:
Expand Down
17 changes: 12 additions & 5 deletions accelerator/.github/workflows/alz-bicep-4b.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ permissions:
contents: read

env:
LOCATION: ""
UPSTREAM_RELEASE_VERSION: ""
CONNECTIVITY_SUBSCRIPTION_ID: ""
TOP_LEVEL_MG_PREFIX: ""
CONNECTIVITY_RESOURCE_GROUP: ""
ENV_FILE: ".env"

jobs:
ALZ_Bicep_4b_Workflow_Job:
Expand All @@ -29,6 +25,17 @@ jobs:
with:
fetch-depth: 0

- name: "Remove Quotation Marks from Environment File"
uses: azure/powershell@v1
with:
inlineScript: |
Write-Host $ENV_FILE
(Get-Content -Path $env:ENV_FILE -Encoding UTF8) | ForEach-Object {$_ -replace '"',''} | Out-File -FilePath $env:ENV_FILE -Encoding UTF8
azPSVersion: "latest"

- name: Import Environment Variables from File
run: cat ${{ env.ENV_FILE }} >> $GITHUB_ENV

- name: OIDC Login to Tenant
uses: azure/login@v1
with:
Expand Down
4 changes: 2 additions & 2 deletions accelerator/pipeline-scripts/Deploy-ALZHub-HubAndSpoke.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ param (
[String]$ConnectivitySubscriptionId = "$($env:CONNECTIVITY_SUBSCRIPTION_ID)",

[Parameter()]
[String]$ConnectivityResourceGroup = "$($env:CONNECTIVITY_RESOURCE_GROUP)",
[String]$TopLevelMGPrefix = "$($env:TOP_LEVEL_MG_PREFIX)",

[Parameter()]
[String]$TemplateFile = "upstream-releases\$($env:UPSTREAM_RELEASE_VERSION)\infra-as-code\bicep\modules\hubNetworking\hubNetworking.bicep",
Expand All @@ -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 = $ConnectivityResourceGroup
ResourceGroupName = "rg-$TopLevelMGPrefix-connectivity"
TemplateFile = $TemplateFile
TemplateParameterFile = $TemplateParameterFile
Verbose = $true
Expand Down
4 changes: 2 additions & 2 deletions accelerator/pipeline-scripts/Deploy-ALZHub-VWAN.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ param (
[String]$ConnectivitySubscriptionId = "$($env:CONNECTIVITY_SUBSCRIPTION_ID)",

[Parameter()]
[String]$ConnectivityResourceGroup = "$($env:CONNECTIVITY_RESOURCE_GROUP)",
[String]$TopLevelMGPrefix = "$($env:TOP_LEVEL_MG_PREFIX)",

[Parameter()]
[String]$TemplateFile = "upstream-releases\$($env:UPSTREAM_RELEASE_VERSION)\infra-as-code\bicep\modules\vwanConnectivity\vwanConnectivity.bicep",
Expand All @@ -15,7 +15,7 @@ param (
# Parameters necessary for deployment
$inputObject = @{
DeploymentName = 'alz-VWANDeploy-{0}' -f ( -join (Get-Date -Format 'yyyyMMddTHHMMssffffZ')[0..63])
ResourceGroupName = $ConnectivityResourceGroup
ResourceGroupName = "rg-$TopLevelMGPrefix-connectivity"
TemplateFile = $TemplateFile
TemplateParameterFile = $TemplateParameterFile
Verbose = $true
Expand Down
4 changes: 2 additions & 2 deletions accelerator/pipeline-scripts/Deploy-ALZLoggingAndSentinel.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ param (
[String]$ManagementSubscriptionId = "$($env:MANAGEMENT_SUBSCRIPTION_ID)",

[Parameter()]
[String]$LoggingResourceGroup = "$($env:LOGGING_RESOURCE_GROUP)",
[String]$TopLevelMGPrefix = "$($env:TOP_LEVEL_MG_PREFIX)",

[Parameter()]
[String]$TemplateFile = "upstream-releases\$($env:UPSTREAM_RELEASE_VERSION)\infra-as-code\bicep\modules\logging\logging.bicep",
Expand All @@ -15,7 +15,7 @@ param (
# Parameters necessary for deployment
$inputObject = @{
DeploymentName = 'alz-LoggingDeploy-{0}' -f ( -join (Get-Date -Format 'yyyyMMddTHHMMssffffZ')[0..63])
ResourceGroupName = $LoggingResourceGroup
ResourceGroupName = "rg-$TopLevelMGPrefix-logging"
TemplateFile = $TemplateFile
TemplateParameterFile = $TemplateParameterFile
Verbose = $true
Expand Down

0 comments on commit 1b72334

Please sign in to comment.