Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating Az CLI version to 2.30.0 #116

Merged
merged 6 commits into from
Nov 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 47 additions & 36 deletions .github/workflows/ByoVnetCI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ on:
concurrency: ci-${{ github.ref }}

env:
AZCLIVERSION: 2.29.2 #2.26.0 #latest
AZCLIVERSION: 2.30.0 #2.29.2 #2.26.0 #latest
RG: "Automation-Actions-AksDeployCI"
ParamFilePath: ".github/workflows_dep/AksDeploy-ByoVnet.parameters.json"
RESNAME: "Byo"
Expand Down Expand Up @@ -222,9 +222,9 @@ jobs:
- name: What If (GA edge Az cli version) (has issues)
uses: Azure/[email protected]
id: edgeWhatIf
continue-on-error: true
continue-on-error: true #Setting to true due to bug in the AzureCLI https://github.com/Azure/azure-cli/issues/19850
with:
azcliversion: latest #${{ env.AZCLIVERSION }}
azcliversion: ${{ env.AZCLIVERSION }} #latest
inlineScript: |
RG='${{ env.RG }}'
RESNAME='${{ env.RESNAME }}'
Expand All @@ -245,8 +245,9 @@ jobs:

echo "::set-output name=edgeSuccess::true"

- name: What If (AZ CLI 2.26.0)
- name: What If (workaround task)
uses: Azure/[email protected]
continue-on-error: true #Setting to true due to bug in the AzureCLI https://github.com/Azure/azure-cli/issues/19850
if: steps.edgeWhatIf.outputs.edgeSuccess != 'true'
with:
azcliversion: 2.26.0
Expand All @@ -255,11 +256,8 @@ jobs:
RESNAME='${{ env.RESNAME }}'
DEPNAME='${{ env.DEPNAME }}'
WHATIFPATH='whatif.json'
EdgeWhatIfPassed='${{ steps.edgeWhatIf.outputs.edgeSuccess}}'
PARAMS='${{ steps.imperitiveparams.outputs.PARAMOVERRIDES}}'

#az deployment group what-if --debug -f bicep/main.bicep -g $RG -p ${{ env.ParamFilePath }} -p resourceName=$RESNAME byoAKSSubnetId=${{ secrets.ByoAksSubnetId }} byoAGWSubnetId=${{ secrets.ByoAgwSubnetId }}

az deployment group what-if --no-pretty-print -f bicep/main.bicep -g $RG -p ${{ env.ParamFilePath }} -p $PARAMS > $WHATIFPATH

if [[ -f $WHATIFPATH ]]
Expand All @@ -268,7 +266,7 @@ jobs:
fi

cat $WHATIFPATH

- name: What If Analysis Output - Parse output
if: github.event.inputs.doVerifySteps != 'no'
shell: pwsh
Expand All @@ -285,7 +283,12 @@ jobs:

$whatIf=$jsonFileRaw | ConvertFrom-Json

Write-Output $whatif.changes[0].after.type
if ($null -eq $whatIf) {
Write-Output "What If results are null"
#We might want to throw an error here, after the whatif bug gets fixed https://github.com/Azure/azure-cli/issues/19850
} else {
Write-Output $whatif.changes[0].after.type
}
}

- name: What If Analysis Output - Pester Testing
Expand All @@ -299,34 +302,42 @@ jobs:
run: |
#This is a current gap in the What-If analysis.
$whatifpath='whatif.json'

$paramFilePath="${{ env.ParamFilePath }}"
$paramFileContent=Get-Content $paramFilePath
$params=$paramFileContent|ConvertFrom-Json

if($params.parameters.createKV.value -eq $true) {
Write-Output "Checking for already existing soft deleted KV"

#lets do this properly and interrogate the whatif file for the KVNAME
$whatifexists=Test-Path -path $whatifpath

if ($whatifexists) {
$whatIf = Get-Content $whatifpath | ConvertFrom-Json
$kvafter = $whatif.changes | where-object {$_.after.type -eq 'Microsoft.KeyVault/vaults'} | where {$_.changeType -ne 'Ignore'} | select after
$vaultname = $kvafter.after.name

write-output "Looking for KeyVault $vaultname"
Get-AzKeyVault -InRemovedState | ft

$deletedKv = Get-AzKeyVault -InRemovedState | where-object {$_.vaultname -eq $vaultname}

if($deletedKv.length -eq 0) {
Write-Output "All is good, soft deleted KV not found in soft deleted list."
}
else {
Write-Output "Soft deleted KV output"
Write-Output $deletedKv.length
Write-Output $deletedKv


Write-Error "Existing soft deleted Key Vault ($vaultName) Found - Cannot proceed, as deployment will fail"
if ($null -eq $whatIf) {
Write-Output "What If results are null"
#We might want to throw an error here, after the whatif bug gets fixed https://github.com/Azure/azure-cli/issues/19850
} else {
$paramFilePath="${{ env.ParamFilePath }}"
$paramFileContent=Get-Content $paramFilePath
$params=$paramFileContent|ConvertFrom-Json

if($params.parameters.createKV.value -eq $true) {
Write-Output "Checking for already existing soft deleted KV"

#lets do this properly and interrogate the whatif file for the KVNAME
$kvafter = $whatif.changes | where-object {$_.after.type -eq 'Microsoft.KeyVault/vaults'} | where {$_.changeType -ne 'Ignore'} | select after
$vaultname = $kvafter.after.name

write-output "Looking for KeyVault $vaultname"
Get-AzKeyVault -InRemovedState | ft

$deletedKv = Get-AzKeyVault -InRemovedState | where-object {$_.vaultname -eq $vaultname}

if($deletedKv.length -eq 0) {
Write-Output "All is good, soft deleted KV not found in soft deleted list."
}
else {
Write-Output "Soft deleted KV output"
Write-Output $deletedKv.length
Write-Output $deletedKv

Write-Error "Existing soft deleted Key Vault ($vaultName) Found - Cannot proceed, as deployment will fail"
}
}
}
}

Expand Down Expand Up @@ -849,7 +860,7 @@ jobs:
EMAILAD: "[email protected]"
run: |
echo "Email Address for Lets Encrypt: $EMAILAD"
helm upgrade --install smokecertissuer ./helmcharts/samples/certmanager --set email=$EMAILAD
helm upgrade --install smokecertissuer ./helmcharts/samples/certmanagerissuer --set email=$EMAILAD

- name: Verify ClusterIssuer
if: github.event.inputs.doVerifySteps != 'no'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ByoVnetPrivateCI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ env:
ParamFilePath: ".github/workflows_dep/AksDeploy-ByoVnetPrivate.parameters.json"
RESNAME: 'AksPriv'
DEPNAME: 'DepPriv${{ github.run_number }}'
AZCLIVERSION: 2.29.2 #Pinning to a specific AZ CLI version
AZCLIVERSION: 2.30.0 #Pinning to a specific AZ CLI version

concurrency: ci-${{ github.ref }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/StandardCI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ env:
ParamFilePath: ".github/workflows_dep/AksDeploy-Basic.parameters.json" #Path to parameter file
RESNAME: "AksStan" #Used in Azure Resource Naming, overrides the default in the parameter file
DEPNAME: "Dep${{ github.run_number }}" #Deployment Name
AZCLIVERSION: 2.29.2 #Pinning to a specific AZ CLI version
AZCLIVERSION: 2.30.0 #Pinning to a specific AZ CLI version

jobs:
Validation:
Expand Down