File: remove-test-resources.yml

package info (click to toggle)
python-azure 20230112%2Bgit-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 749,544 kB
  • sloc: python: 6,815,827; javascript: 287; makefile: 195; xml: 109; sh: 105
file content (40 lines) | stat: -rw-r--r-- 1,584 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Assumes steps in deploy-test-resources.yml was run previously. Requires
# environment variable: <ServiceDirectory>_RESOURCE_GROUP and Az PowerShell module

parameters:
  ServiceDirectory: ''
  SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources)
  ResourceType: test

# SubscriptionConfiguration will be splat into the parameters of the test
# resources script. It should be JSON in the form:
# {
#   "SubscriptionId": "<subscription id>",
#   "TenantId": "<tenant id>",
#   "TestApplicationId": "<test app id>",
#   "TestApplicationSecret": "<test app secret>",
#   "ProvisionerApplicationId": "<provisioner app id>",
#   "ProvisionerApplicationSecret": "<provisioner app secret>",
#   "Environment": "AzureCloud | AzureGov | AzureChina | <other environment>"
# }
# The Remove-TestResources.ps1 script accommodates extra parameters so it will
# not error when parameters are provided which the script doesn't use.

steps:
  - pwsh: |
      eng/common/scripts/Import-AzModules.ps1

      $subscriptionConfiguration = @"
        ${{ parameters.SubscriptionConfiguration }}
      "@ | ConvertFrom-Json -AsHashtable;

      eng/common/TestResources/Remove-TestResources.ps1 `
        @subscriptionConfiguration `
        -ResourceType '${{ parameters.ResourceType }}' `
        -ServiceDirectory "${{ parameters.ServiceDirectory }}" `
        -CI `
        -Force `
        -Verbose
    displayName: Remove test resources
    condition: and(eq(variables['CI_HAS_DEPLOYED_RESOURCES'], 'true'), ne(variables['Skip.RemoveTestResources'], 'true'))
    continueOnError: true