Skip to content

Commit

Permalink
[Identity][Monitor] Update live test setup (#37943)
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Van Eck <paulvaneck@microsoft.com>
  • Loading branch information
pvaneck authored Oct 28, 2024
1 parent e69815a commit 6aae497
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 32 deletions.
4 changes: 4 additions & 0 deletions eng/pipelines/templates/jobs/live.tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ parameters:
- name: UseFederatedAuth
type: boolean
default: false
- name: PersistOidcToken
type: boolean
default: false

jobs:
- job:
Expand Down Expand Up @@ -132,6 +135,7 @@ jobs:
SubscriptionConfiguration: $(SubscriptionConfiguration)
ArmTemplateParameters: $(ArmTemplateParameters)
UseFederatedAuth: ${{ parameters.UseFederatedAuth }}
PersistOidcToken: ${{ parameters.PersistOidcToken }}
ServiceConnection: ${{ parameters.CloudConfig.ServiceConnection }}
EnvVars:
Pool: $(Pool)
Expand Down
4 changes: 4 additions & 0 deletions eng/pipelines/templates/stages/archetype-sdk-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ parameters:
- name: UseFederatedAuth
type: boolean
default: true
- name: PersistOidcToken
type: boolean
default: false

extends:
template: /eng/pipelines/templates/stages/1es-redirect.yml
Expand Down Expand Up @@ -139,6 +142,7 @@ extends:
TestProxy: ${{ parameters.TestProxy }}
ToxTestEnv: ${{ parameters.ToxTestEnv }}
UseFederatedAuth: ${{ parameters.UseFederatedAuth }}
PersistOidcToken: ${{ parameters.PersistOidcToken }}
MatrixConfigs:
# Enumerate platforms and additional platforms based on supported clouds (sparse platform<-->cloud matrix).
- ${{ each config in parameters.MatrixConfigs }}:
Expand Down
12 changes: 7 additions & 5 deletions sdk/identity/test-resources-pre.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ param (
[ValidatePattern('^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$')]
[string] $TestApplicationId,

[Parameter()]
[string] $TestApplicationSecret,

[Parameter()]
[ValidatePattern('^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$')]
[string] $SubscriptionId,

[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string] $Environment,

[Parameter()]
[hashtable] $AdditionalParameters = @{},

Expand Down Expand Up @@ -50,10 +51,11 @@ Start-Sleep -s 45

$az_version = az version
Write-Host "Azure CLI version: $az_version"
az cloud set --name $Environment
az login --service-principal -u $TestApplicationId --tenant $TenantId --allow-no-subscriptions --federated-token $env:ARM_OIDC_TOKEN
az account set --subscription $SubscriptionId
$versions = az aks get-versions -l westus -o json | ConvertFrom-Json
Write-Host "AKS versions: $($versions | ConvertTo-Json -Depth 100)"
$versions = az aks get-versions -l $Location -o json | ConvertFrom-Json
Write-Host "AKS versions for ${Location}: $($versions | ConvertTo-Json -Depth 100)"
$patchVersions = $versions.values | Where-Object { $_.isPreview -eq $null } | Select-Object -ExpandProperty patchVersions
Write-Host "AKS patch versions: $($patchVersions | ConvertTo-Json -Depth 100)"
$latestAksVersion = $patchVersions | Get-Member -MemberType NoteProperty | Select-Object -ExpandProperty Name | Sort-Object -Descending | Select-Object -First 1
Expand Down
2 changes: 1 addition & 1 deletion sdk/identity/test-resources.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ param testApplicationOid string
param acrName string = 'acr${uniqueString(resourceGroup().id)}'

@description('The latest AKS version available in the region.')
param latestAksVersion string = '1.27.7'
param latestAksVersion string = '1.29.8'

@description('The SSH public key to use for the Linux VMs.')
param sshPubKey string = ''
Expand Down
15 changes: 2 additions & 13 deletions sdk/identity/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,8 @@ trigger: none
extends:
template: ../../eng/pipelines/templates/stages/archetype-sdk-tests.yml
parameters:
PreSteps:
- task: AzureCLI@2
displayName: Set OIDC variables
inputs:
azureSubscription: azure-sdk-tests-public
scriptType: pscore
scriptLocation: inlineScript
addSpnToEnvironment: true
inlineScript: |
Write-Host "##vso[task.setvariable variable=ARM_CLIENT_ID;issecret=true]$($env:servicePrincipalId)"
Write-Host "##vso[task.setvariable variable=ARM_TENANT_ID;issecret=true]$($env:tenantId)"
Write-Host "##vso[task.setvariable variable=ARM_OIDC_TOKEN;issecret=true]$($env:idToken)"
Location: westus2
PersistOidcToken: true
ServiceDirectory: identity
EnvVars:
AZURE_CLIENT_ID: $(IDENTITY_SP_CLIENT_ID)
Expand All @@ -25,7 +15,6 @@ extends:
PEM_CONTENT: $(python-identity-certificate)
AZURE_TEST_RUN_LIVE: true
AZURE_SKIP_LIVE_RECORDING: 'True'
ARM_OIDC_TOKEN: $(ARM_OIDC_TOKEN)
CloudConfig:
Public:
SubscriptionConfigurations:
Expand Down
14 changes: 1 addition & 13 deletions sdk/monitor/tests.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,13 @@
# cSpell:ignore pscore
# cSpell:ignore issecret
trigger: none

extends:
template: /eng/pipelines/templates/stages/archetype-sdk-tests.yml
parameters:
PreSteps:
- task: AzureCLI@2
displayName: Set OIDC variables
inputs:
azureSubscription: azure-sdk-tests-public
scriptType: pscore
scriptLocation: inlineScript
addSpnToEnvironment: true
inlineScript: |
Write-Host "##vso[task.setvariable variable=ARM_OIDC_TOKEN;issecret=true]$($env:idToken)"
ServiceDirectory: monitor
TestTimeoutInMinutes: 300
BuildTargetingString: azure-monitor-*
PersistOidcToken: true
EnvVars:
AZURE_SUBSCRIPTION_ID: $(MONITOR_SUBSCRIPTION_ID)
AZURE_TEST_RUN_LIVE: 'true'
AZURE_SKIP_LIVE_RECORDING: 'true'
ARM_OIDC_TOKEN: $(ARM_OIDC_TOKEN)

0 comments on commit 6aae497

Please sign in to comment.