Skip to content

Commit

Permalink
Implemented a first version to allow for custom removal scripts & ret…
Browse files Browse the repository at this point in the history
…ry (#431)

* Implemented a first version to allow for custom removal scripts & retry
* Moved the removal scripts to utilities to enable reference by non-GitHub pipelines & custom execution
* Cleaned up pipelines & added reference to custom removal for vWan & netApp
* Refactored removal scripts to align approaches & reduce code
  • Loading branch information
AlexanderSehr authored Nov 10, 2021
1 parent 7a8e00e commit 49e0d68
Show file tree
Hide file tree
Showing 99 changed files with 485 additions and 274 deletions.
2 changes: 2 additions & 0 deletions .github/actions/sharedScripts/Set-EnvironmentOnAgent.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ function Set-EnvironmentOnAgent {
[Hashtable[]] $Modules = @(
@{ Name = 'Az.Accounts' },
@{ Name = 'Az.Resources' },
@{ Name = 'Az.NetAppFiles' },
@{ Name = 'Az.Network' },
@{ Name = 'Az.ContainerRegistry' }
)
)
Expand Down
19 changes: 12 additions & 7 deletions .github/actions/templates/removeModule/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ inputs:
required: true
resourceGroupName:
description: 'The resource group the module is deployed into'
required: true
required: false
relativePathOfRemovalScript:
description: 'The relative path from root to the script that removes the service'
required: false
default: 'utilities/resourceRemoval/Remove-DeployedModule.ps1'

runs:
using: 'composite'
Expand All @@ -33,15 +37,16 @@ runs:
shell: pwsh
run: |
# Load used functions
. "$env:GITHUB_ACTION_PATH/scripts/Remove-DeployedModule.ps1"
$functionPath = Join-Path $env:GITHUB_WORKSPACE '${{ inputs.relativePathOfRemovalScript }}'
. $functionPath
$functionInput = @{
moduleName = '${{ inputs.moduleName }}'
resourceGroupName = '${{ inputs.resourceGroupName }}'
templateFilePath = '${{ inputs.templateFilePath }}'
moduleName = '${{ inputs.moduleName }}'
resourceGroupName = '${{ inputs.resourceGroupName }}'
verbose = $true
}
Write-Verbose "Invoke task with" -Verbose
Write-Verbose 'Invoke task with' -Verbose
Write-Verbose ($functionInput | ConvertTo-Json | Out-String) -Verbose
Remove-DeployedModule @functionInput -Verbose
Invoke-Expression ('{0} @functionInput' -f (Split-Path $functionPath -LeafBase))

This file was deleted.

1 change: 0 additions & 1 deletion .github/workflows/ms.analysisservices.servers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,4 @@ jobs:
uses: ./.github/actions/templates/removeModule
with:
moduleName: '${{ env.moduleName }}'
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
resourceGroupName: '${{ env.resourceGroupName }}'
1 change: 0 additions & 1 deletion .github/workflows/ms.apimanagement.service.apis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,4 @@ jobs:
uses: ./.github/actions/templates/removeModule
with:
moduleName: '${{ env.moduleName }}'
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
resourceGroupName: '${{ env.resourceGroupName }}'
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,4 @@ jobs:
uses: ./.github/actions/templates/removeModule
with:
moduleName: '${{ env.moduleName }}'
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
resourceGroupName: '${{ env.resourceGroupName }}'
1 change: 0 additions & 1 deletion .github/workflows/ms.apimanagement.service.backends.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,4 @@ jobs:
uses: ./.github/actions/templates/removeModule
with:
moduleName: '${{ env.moduleName }}'
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
resourceGroupName: '${{ env.resourceGroupName }}'
1 change: 0 additions & 1 deletion .github/workflows/ms.apimanagement.service.caches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,4 @@ jobs:
uses: ./.github/actions/templates/removeModule
with:
moduleName: '${{ env.moduleName }}'
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
resourceGroupName: '${{ env.resourceGroupName }}'
1 change: 0 additions & 1 deletion .github/workflows/ms.apimanagement.service.namedvalues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,4 @@ jobs:
uses: ./.github/actions/templates/removeModule
with:
moduleName: '${{ env.moduleName }}'
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
resourceGroupName: '${{ env.resourceGroupName }}'
1 change: 0 additions & 1 deletion .github/workflows/ms.apimanagement.service.products.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,4 @@ jobs:
uses: ./.github/actions/templates/removeModule
with:
moduleName: '${{ env.moduleName }}'
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
resourceGroupName: '${{ env.resourceGroupName }}'
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,4 @@ jobs:
uses: ./.github/actions/templates/removeModule
with:
moduleName: '${{ env.moduleName }}'
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
resourceGroupName: '${{ env.resourceGroupName }}'
1 change: 0 additions & 1 deletion .github/workflows/ms.apimanagement.service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,4 @@ jobs:
uses: ./.github/actions/templates/removeModule
with:
moduleName: '${{ env.moduleName }}'
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
resourceGroupName: '${{ env.resourceGroupName }}'
2 changes: 0 additions & 2 deletions .github/workflows/ms.authorization.policyassignments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,3 @@ jobs:
uses: ./.github/actions/templates/removeModule
with:
moduleName: '${{ env.moduleName }}'
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
resourceGroupName: '${{ env.resourceGroupName }}'
2 changes: 0 additions & 2 deletions .github/workflows/ms.authorization.policydefinitions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,3 @@ jobs:
uses: ./.github/actions/templates/removeModule
with:
moduleName: '${{ env.moduleName }}'
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
resourceGroupName: '${{ env.resourceGroupName }}'
2 changes: 0 additions & 2 deletions .github/workflows/ms.authorization.policyexemptions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,3 @@ jobs:
uses: ./.github/actions/templates/removeModule
with:
moduleName: '${{ env.moduleName }}'
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
resourceGroupName: '${{ env.resourceGroupName }}'
2 changes: 0 additions & 2 deletions .github/workflows/ms.authorization.policysetdefinitions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,3 @@ jobs:
uses: ./.github/actions/templates/removeModule
with:
moduleName: '${{ env.moduleName }}'
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
resourceGroupName: '${{ env.resourceGroupName }}'
2 changes: 0 additions & 2 deletions .github/workflows/ms.authorization.roleassignments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,3 @@ jobs:
uses: ./.github/actions/templates/removeModule
with:
moduleName: '${{ env.moduleName }}'
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
resourceGroupName: '${{ env.resourceGroupName }}'
1 change: 0 additions & 1 deletion .github/workflows/ms.authorization.roledefinitions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,4 @@ jobs:
uses: ./.github/actions/templates/removeModule
with:
moduleName: '${{ env.moduleName }}'
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
resourceGroupName: '${{ env.resourceGroupName }}'
2 changes: 0 additions & 2 deletions .github/workflows/ms.automanage.accounts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,3 @@ jobs:
uses: ./.github/actions/templates/removeModule
with:
moduleName: '${{ env.moduleName }}'
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
resourceGroupName: '${{ env.resourceGroupName }}'
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,4 @@ jobs:
uses: ./.github/actions/templates/removeModule
with:
moduleName: '${{ env.moduleName }}'
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
resourceGroupName: '${{ env.resourceGroupName }}'
1 change: 0 additions & 1 deletion .github/workflows/ms.automation.automationaccounts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,4 @@ jobs:
uses: ./.github/actions/templates/removeModule
with:
moduleName: '${{ env.moduleName }}'
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
resourceGroupName: '${{ env.resourceGroupName }}'
1 change: 0 additions & 1 deletion .github/workflows/ms.batch.batchaccounts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,4 @@ jobs:
uses: ./.github/actions/templates/removeModule
with:
moduleName: '${{ env.moduleName }}'
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
resourceGroupName: '${{ env.resourceGroupName }}'
1 change: 0 additions & 1 deletion .github/workflows/ms.cognitiveservices.accounts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,4 @@ jobs:
uses: ./.github/actions/templates/removeModule
with:
moduleName: '${{ env.moduleName }}'
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
resourceGroupName: '${{ env.resourceGroupName }}'
1 change: 0 additions & 1 deletion .github/workflows/ms.compute.availabilitysets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,4 @@ jobs:
uses: ./.github/actions/templates/removeModule
with:
moduleName: '${{ env.moduleName }}'
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
resourceGroupName: '${{ env.resourceGroupName }}'
1 change: 0 additions & 1 deletion .github/workflows/ms.compute.diskencryptionsets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,4 @@ jobs:
uses: ./.github/actions/templates/removeModule
with:
moduleName: '${{ env.moduleName }}'
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
resourceGroupName: '${{ env.resourceGroupName }}'
1 change: 0 additions & 1 deletion .github/workflows/ms.compute.galleries.images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,4 @@ jobs:
uses: ./.github/actions/templates/removeModule
with:
moduleName: '${{ env.moduleName }}'
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
resourceGroupName: '${{ env.resourceGroupName }}'
1 change: 0 additions & 1 deletion .github/workflows/ms.compute.galleries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,4 @@ jobs:
uses: ./.github/actions/templates/removeModule
with:
moduleName: '${{ env.moduleName }}'
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
resourceGroupName: '${{ env.resourceGroupName }}'
1 change: 0 additions & 1 deletion .github/workflows/ms.compute.images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,4 @@ jobs:
uses: ./.github/actions/templates/removeModule
with:
moduleName: '${{ env.moduleName }}'
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
resourceGroupName: '${{ env.resourceGroupName }}'
1 change: 0 additions & 1 deletion .github/workflows/ms.compute.proximityplacementgroups.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,4 @@ jobs:
uses: ./.github/actions/templates/removeModule
with:
moduleName: '${{ env.moduleName }}'
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
resourceGroupName: '${{ env.resourceGroupName }}'
1 change: 0 additions & 1 deletion .github/workflows/ms.compute.virtualmachines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,4 @@ jobs:
uses: ./.github/actions/templates/removeModule
with:
moduleName: '${{ env.moduleName }}'
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
resourceGroupName: '${{ env.resourceGroupName }}'
1 change: 0 additions & 1 deletion .github/workflows/ms.compute.virtualmachinescalesets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,4 @@ jobs:
uses: ./.github/actions/templates/removeModule
with:
moduleName: '${{ env.moduleName }}'
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
resourceGroupName: '${{ env.resourceGroupName }}'
2 changes: 0 additions & 2 deletions .github/workflows/ms.consumption.budgets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,3 @@ jobs:
uses: ./.github/actions/templates/removeModule
with:
moduleName: '${{ env.moduleName }}'
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
resourceGroupName: '${{ env.resourceGroupName }}'
1 change: 0 additions & 1 deletion .github/workflows/ms.containerinstance.containergroups.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,4 @@ jobs:
uses: ./.github/actions/templates/removeModule
with:
moduleName: '${{ env.moduleName }}'
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
resourceGroupName: '${{ env.resourceGroupName }}'
1 change: 0 additions & 1 deletion .github/workflows/ms.containerregistry.registries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,4 @@ jobs:
uses: ./.github/actions/templates/removeModule
with:
moduleName: '${{ env.moduleName }}'
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
resourceGroupName: '${{ env.resourceGroupName }}'
1 change: 0 additions & 1 deletion .github/workflows/ms.containerservice.managedclusters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,4 @@ jobs:
uses: ./.github/actions/templates/removeModule
with:
moduleName: '${{ env.moduleName }}'
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
resourceGroupName: '${{ env.resourceGroupName }}'
Loading

0 comments on commit 49e0d68

Please sign in to comment.