Skip to content

Commit

Permalink
Use common OIDC token env vars for live tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
benbp committed Oct 8, 2024
1 parent 5abc72c commit da71231
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
5 changes: 5 additions & 0 deletions eng/pipelines/templates/jobs/live.tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ parameters:
- name: UseFederatedAuth
type: boolean
default: false
- name: PersistOidcToken
type: boolean
default: false

jobs:
- job:
Expand Down Expand Up @@ -100,6 +103,7 @@ jobs:
SubscriptionConfiguration: $(SubscriptionConfiguration)
ArmTemplateParameters: $(ArmTemplateParameters)
UseFederatedAuth: ${{ parameters.UseFederatedAuth }}
PersistOidcToken: ${{ parameters.PersistOidcToken }}
ServiceConnection: ${{ parameters.CloudConfig.ServiceConnection }}
SubscriptionConfigurationFilePaths: ${{ parameters.CloudConfig.SubscriptionConfigurationFilePaths }}
EnvVars:
Expand All @@ -114,6 +118,7 @@ jobs:
SubscriptionConfiguration: $(SubscriptionConfiguration)
ArmTemplateParameters: $(ArmTemplateParameters)
UseFederatedAuth: ${{ parameters.UseFederatedAuth }}
PersistOidcToken: ${{ parameters.PersistOidcToken }}
ServiceConnection: ${{ parameters.CloudConfig.ServiceConnection }}
SubscriptionConfigurationFilePaths: ${{ parameters.CloudConfig.SubscriptionConfigurationFilePaths }}
EnvVars:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ parameters:
Public:
SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources)
ServiceConnection: azure-sdk-tests
SubscriptionConfigurationFilePaths:
SubscriptionConfigurationFilePaths:
- eng/common/TestResources/sub-config/AzurePublicMsft.json
Preview:
SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources-preview)
Expand Down Expand Up @@ -77,6 +77,9 @@ parameters:
- name: UseFederatedAuth
type: boolean
default: true
- name: PersistOidcToken
type: boolean
default: false

stages:
- ${{ each cloud in parameters.CloudConfig }}:
Expand Down Expand Up @@ -105,6 +108,7 @@ stages:
TestResourceDirectories: ${{ parameters.TestResourceDirectories }}
PublishCodeCoverage: ${{ parameters.PublishCodeCoverage }}
UseFederatedAuth: ${{ parameters.UseFederatedAuth }}
PersistOidcToken: ${{ parameters.PersistOidcToken }}
PreSteps:
- ${{ parameters.PreSteps }}
PostSteps:
Expand Down
6 changes: 5 additions & 1 deletion eng/pipelines/templates/stages/archetype-sdk-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ parameters:
Public:
SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources)
ServiceConnection: azure-sdk-tests
SubscriptionConfigurationFilePaths:
SubscriptionConfigurationFilePaths:
- eng/common/TestResources/sub-config/AzurePublicMsft.json
Preview:
SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources-preview)
Expand Down Expand Up @@ -78,6 +78,9 @@ parameters:
- name: UseFederatedAuth
type: boolean
default: true
- name: PersistOidcToken
type: boolean
default: false


extends:
Expand All @@ -98,6 +101,7 @@ extends:
SupportedClouds: ${{ parameters.SupportedClouds }}
UnsupportedClouds: ${{ parameters.UnsupportedClouds }}
UseFederatedAuth: ${{ parameters.UseFederatedAuth }}
PersistOidcToken: ${{ parameters.PersistOidcToken }}
PreSteps:
- ${{ parameters.PreSteps }}
PostSteps:
Expand Down
17 changes: 1 addition & 16 deletions sdk/identity/identity/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,11 @@ trigger: none
extends:
template: /eng/pipelines/templates/stages/archetype-sdk-tests.yml
parameters:
PreSteps:
- task: AzureCLI@2
displayName: Set OIDC variables
env:
ARM_OIDC_TOKEN: $(ARM_OIDC_TOKEN)
ARM_CLIENT_ID: $(ARM_CLIENT_ID)
ARM_TENANT_ID: $(ARM_TENANT_ID)
inputs:
azureSubscription: azure-sdk-tests
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)"
PackageName: "@azure/identity"
ServiceDirectory: identity
TimeoutInMinutes: 120
SupportedClouds: 'Public,UsGov,China,Canary'
PersistOidcToken: true
CloudConfig:
Public:
ServiceConnection: azure-sdk-tests
Expand Down

0 comments on commit da71231

Please sign in to comment.