|
| 1 | +parameters: |
| 2 | +# required matrix parameters |
| 3 | +- name: UsePlatformContainer |
| 4 | + type: boolean |
| 5 | +- name: OSName |
| 6 | + type: string |
| 7 | +- name: Matrix |
| 8 | + type: object |
| 9 | +- name: DependsOn |
| 10 | + type: string |
| 11 | +- name: CloudConfig |
| 12 | + type: object |
| 13 | +# custom parameters |
| 14 | +- name: ServiceDirectory |
| 15 | + type: string |
| 16 | +- name: TimeoutInMinutes |
| 17 | + type: number |
| 18 | +# live test parameters |
| 19 | +- name: EnvVars |
| 20 | + type: object |
| 21 | +- name: PreSteps |
| 22 | + type: object |
| 23 | +- name: PostSteps |
| 24 | + type: object |
| 25 | +- name: Location |
| 26 | + type: string |
| 27 | +- name: UseFederatedAuth |
| 28 | + type: boolean |
| 29 | +- name: PersistOidcToken |
| 30 | + type: boolean |
| 31 | + |
| 32 | +jobs: |
| 33 | +- job: |
| 34 | + displayName: "Test" |
| 35 | + condition: and(succeeded(), ne(variables['Skip.Tests'],'true'), ne(${{ parameters.Matrix }}, '{}')) |
| 36 | + timeoutInMinutes: ${{ parameters.TimeoutInMinutes }} |
| 37 | + dependsOn: ${{ parameters.DependsOn }} |
| 38 | + |
| 39 | + strategy: |
| 40 | + matrix: $[ ${{ parameters.Matrix }} ] |
| 41 | + |
| 42 | + pool: |
| 43 | + name: $(Pool) |
| 44 | + # 1es pipeline templates converts `image` to demands: ImageOverride under the hood |
| 45 | + # which is incompatible with image selection in the default non-1es hosted pools |
| 46 | + ${{ if eq(parameters.OSName, 'macOS') }}: |
| 47 | + vmImage: $(OSVmImage) |
| 48 | + ${{ else }}: |
| 49 | + image: $(OSVmImage) |
| 50 | + os: ${{ parameters.OSName }} |
| 51 | + |
| 52 | + variables: |
| 53 | + ArmTemplateParameters: '@{}' |
| 54 | + |
| 55 | + steps: |
| 56 | + - template: /eng/common/pipelines/templates/steps/sparse-checkout.yml |
| 57 | + parameters: |
| 58 | + paths: |
| 59 | + - "/*" |
| 60 | + |
| 61 | + - template: /eng/common/pipelines/templates/steps/verify-agent-os.yml |
| 62 | + parameters: |
| 63 | + AgentImage: $(OSVmImage) |
| 64 | + |
| 65 | + - template: /eng/pipelines/templates/steps/use-rust.yml@self |
| 66 | + parameters: |
| 67 | + Toolchain: $(RustToolchainName) |
| 68 | + |
| 69 | + - ${{ parameters.PreSteps }} |
| 70 | + |
| 71 | + - template: /eng/common/TestResources/build-test-resource-config.yml |
| 72 | + parameters: |
| 73 | + SubscriptionConfiguration: ${{ parameters.CloudConfig.SubscriptionConfiguration }} |
| 74 | + SubscriptionConfigurations: ${{ parameters.CloudConfig.SubscriptionConfigurations }} |
| 75 | + SubscriptionConfigurationFilePaths: ${{ parameters.CloudConfig.SubscriptionConfigurationFilePaths }} |
| 76 | + EnvVars: |
| 77 | + Pool: $(Pool) |
| 78 | + ${{insert}}: ${{ parameters.EnvVars }} |
| 79 | + |
| 80 | + - template: /eng/common/TestResources/deploy-test-resources.yml |
| 81 | + parameters: |
| 82 | + ${{ if or(parameters.Location, parameters.CloudConfig.Location) }}: |
| 83 | + Location: ${{ coalesce(parameters.Location, parameters.CloudConfig.Location) }} |
| 84 | + ServiceDirectory: ${{ parameters.ServiceDirectory }} |
| 85 | + SubscriptionConfiguration: $(SubscriptionConfiguration) |
| 86 | + ArmTemplateParameters: $(ArmTemplateParameters) |
| 87 | + UseFederatedAuth: ${{ parameters.UseFederatedAuth }} |
| 88 | + ServiceConnection: ${{ parameters.CloudConfig.ServiceConnection }} |
| 89 | + SubscriptionConfigurationFilePaths: ${{ parameters.CloudConfig.SubscriptionConfigurationFilePaths}} |
| 90 | + PersistOidcToken: ${{ parameters.PersistOidcToken }} |
| 91 | + EnvVars: |
| 92 | + Pool: $(Pool) |
| 93 | + ${{insert}}: ${{ parameters.EnvVars }} |
| 94 | + |
| 95 | + # To allow tests to run in parallel to Pack, we don't reuse the PackageInfo directory |
| 96 | + # from the Pack job. We just let each test leg create its own PackageInfo directory. |
| 97 | + - template: /eng/common/pipelines/templates/steps/save-package-properties.yml@self |
| 98 | + parameters: |
| 99 | + ServiceDirectory: ${{ parameters.ServiceDirectory }} |
| 100 | + PackageInfoDirectory: $(Build.ArtifactStagingDirectory)/PackageInfo |
| 101 | + |
| 102 | + - ${{ if parameters.UseFederatedAuth }}: |
| 103 | + - task: AzurePowerShell@5 |
| 104 | + displayName: "Test Packages - Federated Auth" |
| 105 | + timeoutInMinutes: ${{ parameters.TimeoutInMinutes }} |
| 106 | + env: |
| 107 | + CIBW_BUILD_VERBOSITY: 3 |
| 108 | + AZURE_TEST_MODE: 'live' |
| 109 | + SYSTEM_ACCESSTOKEN: $(System.AccessToken) |
| 110 | + ${{ if parameters.PersistOidcToken }}: |
| 111 | + ARM_OIDC_TOKEN: $(ARM_OIDC_TOKEN) |
| 112 | + ${{ insert }}: ${{ parameters.EnvVars }} |
| 113 | + inputs: |
| 114 | + azureSubscription: ${{ parameters.CloudConfig.ServiceConnection }} |
| 115 | + azurePowerShellVersion: LatestVersion |
| 116 | + pwsh: true |
| 117 | + scriptType: inlineScript |
| 118 | + inline: | |
| 119 | + $account = (Get-AzContext).Account; |
| 120 | + $env:AZURESUBSCRIPTION_CLIENT_ID = $account.Id; |
| 121 | + $env:AZURESUBSCRIPTION_TENANT_ID = $account.Tenants; |
| 122 | +
|
| 123 | + Write-Host "./eng/scripts/Test-Packages.ps1 -PackageInfoDirectory '$(Build.ArtifactStagingDirectory)/PackageInfo' -Toolchain '$(Toolchain)'" |
| 124 | + ./eng/scripts/Test-Packages.ps1 -PackageInfoDirectory '$(Build.ArtifactStagingDirectory)/PackageInfo' -Toolchain '$(Toolchain)' |
| 125 | + workingDirectory: $(Build.SourcesDirectory) |
| 126 | + - ${{ else }}: |
| 127 | + - task: Powershell@2 |
| 128 | + displayName: "Test Packages" |
| 129 | + timeoutInMinutes: ${{ parameters.TimeoutInMinutes }} |
| 130 | + env: |
| 131 | + CIBW_BUILD_VERBOSITY: 3 |
| 132 | + AZURE_TEST_MODE: 'live' |
| 133 | + SYSTEM_ACCESSTOKEN: $(System.AccessToken) |
| 134 | + ${{ insert }}: ${{ parameters.EnvVars }} |
| 135 | + inputs: |
| 136 | + pwsh: true |
| 137 | + filePath: $(Build.SourcesDirectory)/eng/scripts/Test-Packages.ps1 |
| 138 | + arguments: > |
| 139 | + -PackageInfoDirectory '$(Build.ArtifactStagingDirectory)/PackageInfo' |
| 140 | + -Toolchain '$(Toolchain)' |
| 141 | +
|
| 142 | + - ${{ parameters.PostSteps }} |
| 143 | + |
| 144 | + - template: /eng/common/TestResources/remove-test-resources.yml |
| 145 | + parameters: |
| 146 | + ServiceDirectory: ${{ parameters.ServiceDirectory }} |
| 147 | + SubscriptionConfiguration: $(SubscriptionConfiguration) |
| 148 | + UseFederatedAuth: ${{ parameters.UseFederatedAuth }} |
| 149 | + ServiceConnection: ${{ parameters.CloudConfig.ServiceConnection }} |
| 150 | + EnvVars: ${{ parameters.EnvVars }} |
0 commit comments