File: build-test-resource-config.yml

package info (click to toggle)
python-azure 20250603%2Bgit-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 851,724 kB
  • sloc: python: 7,362,925; ansic: 804; javascript: 287; makefile: 195; sh: 145; xml: 109
file content (53 lines) | stat: -rw-r--r-- 1,888 bytes parent folder | download | duplicates (2)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
parameters:
  - name: SubscriptionConfiguration
    type: string
    default: '{}'
  - name: SubscriptionConfigurations
    type: object
    default: null
  # EnvVars is used to help diagnose variable conflict issues early
  - name: EnvVars
    type: object
    default: {}
  - name: SubscriptionConfigurationFilePaths
    type: object
    default: null

steps:
  - task: AzurePowerShell@5
    displayName: Set Pipeline Subnet Info
    condition: and(succeeded(), ne(variables['Pool'], ''))
    env: ${{ parameters.EnvVars }}
    inputs:
      azureSubscription: azure-sdk-tests
      azurePowerShellVersion: LatestVersion
      pwsh: true
      ScriptType: InlineScript
      Inline: |
        Set-AzContext 'Azure SDK Engineering System'
        if ($env:Pool -eq 'Azure Pipelines') {
          Write-Host "Skipping pool subnet lookup when running on an Azure Pipelines hosted pool"
          Write-Host "##vso[task.setvariable variable=PoolSubnet;]"
          exit 0
        }
        $poolSubnet = (Get-AzResource -ResourceGroupName azsdk-pools -Name $env:Pool -ExpandProperties).Properties.networkProfile.subnetId
        Write-Host "Setting pipeline subnet env variable PoolSubnet to '$poolSubnet'"
        Write-Host "##vso[task.setvariable variable=PoolSubnet;]$poolSubnet"

  - pwsh: |
      . ./eng/common/TestResources/SubConfig-Helpers.ps1

      $baseSubConfigJson = @'
        ${{ parameters.SubscriptionConfiguration }}
      '@.Trim()

      $additionalSubConfigsJson = @'
        ${{ convertToJson(parameters.SubscriptionConfigurations) }}
      '@.Trim() -replace '"{', '{' -replace '}"', '}'

      $subConfigFilesJson = @'
        ${{ convertToJson(parameters.SubscriptionConfigurationFilePaths) }}
      '@.Trim()

      BuildAndSetSubscriptionConfig $baseSubConfigJson $additionalSubConfigsJson $subConfigFilesJson
    displayName: Merge subscription configurations