Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
ad15a5d
actuate AAD tests in Azure China Cloud
yiliuTo Jan 18, 2021
a0512ef
Remove reuse of parameters.PostRunSteps
yiliuTo Jan 18, 2021
6cf2d28
format spring/tests.yml
yiliuTo Jan 18, 2021
50308e4
add subscription for Azure China
yiliuTo Jan 18, 2021
4e94408
update test name of Azure China test
yiliuTo Jan 18, 2021
e57cf0a
add post run steps
yiliuTo Jan 18, 2021
d0e3fd0
add env for aad base url and graph base url
yiliuTo Jan 18, 2021
e8ef8cb
remove subscription configuration
yiliuTo Jan 18, 2021
b852605
reuse paramaters.envvars
yiliuTo Jan 18, 2021
df351af
add template for spring tests.yml
yiliuTo Jan 19, 2021
c8f02e9
remove trigger in template
yiliuTo Jan 19, 2021
d21fd79
override test name for azure cloud
yiliuTo Jan 19, 2021
577f122
redeclare variables in template yaml'
yiliuTo Jan 19, 2021
e1262e2
update parameters in template yaml
yiliuTo Jan 19, 2021
5d606e9
redeclare artifacts in template yaml
yiliuTo Jan 19, 2021
55f093f
add log
yiliuTo Jan 19, 2021
d521d37
update script for logging
yiliuTo Jan 19, 2021
56d989a
update log script
yiliuTo Jan 19, 2021
8cebbfc
remove log
yiliuTo Jan 19, 2021
cb84a8e
udpate log
yiliuTo Jan 19, 2021
de2eafa
update log
yiliuTo Jan 19, 2021
f00f885
udpate log
yiliuTo Jan 19, 2021
213b310
remove artifact declaration in template yaml
yiliuTo Jan 19, 2021
7462c12
udpate log for artifacts info
yiliuTo Jan 19, 2021
62f0ae6
update log
yiliuTo Jan 19, 2021
d1cfbbe
Update spring-test-template.yml
saragluna Jan 20, 2021
26da27a
Update spring-test-template.yml
saragluna Jan 20, 2021
9919889
Update spring-test-template.yml
saragluna Jan 20, 2021
e53b6ff
update env names
yiliuTo Jan 20, 2021
8487209
Update spring-test-template.yml
yiliuTo Jan 20, 2021
8777db8
adjust artifacts order
yiliuTo Jan 20, 2021
7629a54
add SubscriptionConfiguration
yiliuTo Jan 20, 2021
7d785ab
update MaxParallel in Azure China
yiliuTo Jan 21, 2021
871471b
Update tests.yml
yiliuTo Jan 21, 2021
cdf169d
deploy template according to artifacts
yiliuTo Jan 22, 2021
ee33b5d
modify artifacts parameter format when calling the script
yiliuTo Jan 22, 2021
fd586df
update script for grammar
yiliuTo Jan 22, 2021
8051794
modify errors of passing Artifacts parameter
yiliuTo Jan 22, 2021
b6c56f4
update the way passing artifacts
yiliuTo Jan 22, 2021
575623b
update artifacts parameter
yiliuTo Jan 22, 2021
a921016
modify passing artifacts from archetype
yiliuTo Jan 22, 2021
e2bbf5c
ingore dogfood env to run test in personal repo
yiliuTo Jan 22, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 23 additions & 6 deletions eng/common/TestResources/New-TestResources.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ param (
[Parameter(Mandatory = $true, Position = 0)]
[string] $ServiceDirectory,

[Parameter()]
[string[]] $Artifacts = @(),

[Parameter()]
[ValidatePattern('^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$')]
[string] $TestApplicationId,
Expand Down Expand Up @@ -144,16 +147,30 @@ try {
# Azure SDK Developer Playground
$defaultSubscription = "faa080af-c1d8-40ad-9cce-e1a450ca5b57"

Write-Verbose "Checking for '$templateFileName' files under '$root'"
Get-ChildItem -Path $root -Filter $templateFileName -Recurse | ForEach-Object {
$templateFile = $_.FullName
# Deploy test resources according to Artifacts
if ($Artifacts) {
foreach ($Artifact in $Artifacts) {
$templateFilePath = Join-Path $root $Artifact.name
Write-Verbose "Checking for '$templateFileName' files under '$templateFilePath'"
Get-ChildItem -Path $templateFilePath -Filter $templateFileName -Recurse | ForEach-Object {
$templateFile = $_.FullName

Write-Verbose "Found template '$templateFile'"
$templateFiles += $templateFile
Write-Verbose "Found template '$templateFile'"
$templateFiles += $templateFile
}
}
} else {
Write-Verbose "Checking for '$templateFileName' files under '$root'"
Get-ChildItem -Path $root -Filter $templateFileName -Recurse | ForEach-Object {
$templateFile = $_.FullName

Write-Verbose "Found template '$templateFile'"
$templateFiles += $templateFile
}
}

if (!$templateFiles) {
Write-Warning -Message "No template files found under '$root'"
Write-Warning -Message "No template files found"
exit
}

Expand Down
12 changes: 11 additions & 1 deletion eng/common/TestResources/deploy-test-resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ parameters:
DeleteAfterHours: 8
Location: ''
SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources)

Artifacts: []
# SubscriptionConfiguration will be splatted into the parameters of the test
# resources script. It should be JSON in the form:
# {
Expand Down Expand Up @@ -38,6 +38,15 @@ steps:
- pwsh: |
eng/common/TestResources/Import-AzModules.ps1

# $artifactsArray = ${{ parameters.Artifacts }}
# Write-Verbose "There are $artifactsArray.Count artifacts"
#
# $artifactsNameArray = @()
# foreach($artifact in $artifactsArray) {
# Write-Verbose "$artifact.name"
# $artifactsNameArray += $artifact.name
# }

$subscriptionConfiguration = @'
${{ parameters.SubscriptionConfiguration }}
'@ | ConvertFrom-Json -AsHashtable;
Expand All @@ -48,6 +57,7 @@ steps:
eng/common/TestResources/New-TestResources.ps1 `
-BaseName 'Generated' `
-ServiceDirectory '${{ parameters.ServiceDirectory }}' `
-Artifacts ${{ parameters.Artifacts }} `
-Location '${{ parameters.Location }}' `
-DeleteAfterHours '${{ parameters.DeleteAfterHours }}' `
@subscriptionConfiguration `
Expand Down
8 changes: 4 additions & 4 deletions eng/common/TestResources/setup-az-modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ steps:
script: |
eng/common/TestResources/Import-AzModules.ps1

$environmentSpec = @"
$(env-config-dogfood)
"@ | ConvertFrom-Json -AsHashtable;
Add-AzEnvironment @environmentSpec
# $environmentSpec = @"
# $(env-config-dogfood)
# "@ | ConvertFrom-Json -AsHashtable;
# Add-AzEnvironment @environmentSpec
1 change: 1 addition & 0 deletions eng/pipelines/templates/jobs/archetype-sdk-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ jobs:
SubscriptionConfiguration: $(SubscriptionConfiguration)
ArmTemplateParameters: $(ArmTemplateParameters)
Location: $(Location)
Artifacts: $(Artifacts)

- ${{ parameters.PreRunSteps }}

Expand Down
45 changes: 45 additions & 0 deletions sdk/spring/spring-test-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
parameters:
EnvVars: {}
TestName: ''
Artifacts: []
SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources)

jobs:
- template: ../../eng/pipelines/templates/jobs/archetype-sdk-tests.yml
parameters:
TimeoutInMinutes: 240
ServiceDirectory: spring
EnvVars: ${{ parameters.EnvVars }}
TestName: ${{ parameters.TestName }}
SubscriptionConfiguration: ${{ parameters.SubscriptionConfiguration }}
Artifacts: ${{ parameters.Artifacts }}
TestStepMavenInputs:
options: '-Dmaven.wagon.http.pool=false $(DefaultOptions) -Dmaven.javadoc.skip=true -Drevapi.skip=true -DskipSpringITs=false -pl $(ProjectList)'
goals: "verify"

PostRunSteps:
- script: |
python --version
python -m pip install setuptools termcolor in_place
python sdk/spring/scripts/replace_util.py --module spring --log debug --color false
displayName: 'Run replace_util.py'

- task: Maven@3
displayName: 'Build and Install again, JDK Version: $(JavaBuildVersion)'
inputs:
mavenPomFile: pom.xml
goals: 'install'
options: '$(DefaultOptions) -DskipTests -Dgpg.skip -Dmaven.javadoc.skip=true -Dcheckstyle.skip=true -Dspotbugs.skip=true -Drevapi.skip=true -pl $(ProjectList) -am'
mavenOptions: '$(MemoryOptions) $(LoggingOptions)'
javaHomeOption: 'JDKVersion'
jdkVersionOption: $(JavaBuildVersion)
jdkArchitectureOption: 'x64'
publishJUnitResults: false

- task: Maven@3
displayName: 'Run tests again, JDK Version: $(JavaBuildVersion)'
inputs:
mavenPomFile: pom.xml
goals: verify
options: '-Dmaven.wagon.http.pool=false $(DefaultOptions) -Dmaven.javadoc.skip=true -Drevapi.skip=true -DskipSpringITs=false -pl $(ProjectList)'
env: ${{ parameters.EnvVars }}
83 changes: 31 additions & 52 deletions sdk/spring/tests.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
trigger: none

jobs:
- template: ../../eng/pipelines/templates/jobs/archetype-sdk-tests.yml
- template: spring-test-template.yml
parameters:
TimeoutInMinutes: 240
ServiceDirectory: spring
TestStepMavenInputs:
options: '-Dmaven.wagon.http.pool=false $(DefaultOptions) -Dmaven.javadoc.skip=true -Drevapi.skip=true -DskipSpringITs=false -pl $(ProjectList)'
goals: "verify"
TestName: LiveTestInAzureCloud
ScenarioName: AzureCloud

Artifacts:
- name: azure-spring-boot-test-application
Expand Down Expand Up @@ -70,50 +67,32 @@ jobs:
AAD_B2C_CLIENT_ID: $(java-spring-aad-b2c-client-id)
AAD_B2C_CLIENT_SECRET: $(java-spring-aad-b2c-client-secret)

PostRunSteps:
- script: |
python --version
python -m pip install setuptools termcolor in_place
python sdk/spring/scripts/replace_util.py --module spring --log debug --color false
displayName: 'Run replace_util.py'

- task: Maven@3
displayName: 'Build and Install again, JDK Version: $(JavaBuildVersion)'
inputs:
mavenPomFile: pom.xml
goals: 'install'
options: '$(DefaultOptions) -DskipTests -Dgpg.skip -Dmaven.javadoc.skip=true -Dcheckstyle.skip=true -Dspotbugs.skip=true -Drevapi.skip=true -pl $(ProjectList) -am'
mavenOptions: '$(MemoryOptions) $(LoggingOptions)'
javaHomeOption: 'JDKVersion'
jdkVersionOption: $(JavaBuildVersion)
jdkArchitectureOption: 'x64'
publishJUnitResults: false
- template: spring-test-template.yml
parameters:
TestName: LiveTestInAzureChina
ScenarioName: AzureChinaCloud
SubscriptionConfiguration: $(sub-config-cn-test-resources)
Artifacts:
- name: azure-spring-boot-test-core
groupId: com.azure.spring
safeName: azurespringboottestcore
- name: azure-spring-boot-test-aad
groupId: com.azure.spring
safeName: azurespringboottestaad

- task: Maven@3
displayName: 'Run tests again, JDK Version: $(JavaBuildVersion)'
inputs:
mavenPomFile: pom.xml
goals: verify
options: '-Dmaven.wagon.http.pool=false $(DefaultOptions) -Dmaven.javadoc.skip=true -Drevapi.skip=true -DskipSpringITs=false -pl $(ProjectList)'
env:
AZURE_TEST_MODE: LIVE
AAD_TENANT_ID_1: $(java-spring-aad-tenant-id-1)
AAD_USER_NAME_1: $(java-spring-aad-user-name-1)
AAD_USER_PASSWORD_1: $(java-spring-aad-user-password-1)
AAD_TENANT_ID_2: $(java-spring-aad-tenant-id-2)
AAD_USER_NAME_2: $(java-spring-aad-user-name-2)
AAD_USER_PASSWORD_2: $(java-spring-aad-user-password-2)
AAD_MULTI_TENANT_CLIENT_ID: $(java-spring-aad-multi-tenant-client-id)
AAD_MULTI_TENANT_CLIENT_SECRET: $(java-spring-aad-multi-tenant-client-secret)
AAD_SINGLE_TENANT_CLIENT_ID: $(java-spring-aad-single-tenant-id)
AAD_SINGLE_TENANT_CLIENT_SECRET: $(java-spring-aad-single-tenant-secret)
AAD_SINGLE_TENANT_CLIENT_ID_WITH_ROLE: $(java-spring-aad-single-tenant-id-with-role)
AAD_SINGLE_TENANT_CLIENT_SECRET_WITH_ROLE: $(java-spring-aad-single-tenant-secret-with-role)
AAD_B2C_USER_EMAIL: "[email protected]"
AAD_B2C_TENANT: "B2CITTest1"
AAD_B2C_REPLY_URL: "http://localhost:8080/home"
AAD_B2C_SIGN_UP_OR_SIGN_IN: "B2C_1_signupsignin1"
AAD_B2C_PROFILE_EDIT: "B2C_1_profileediting1"
AAD_B2C_USER_PASSWORD: $(java-spring-aad-b2c-user-password)
AAD_B2C_CLIENT_ID: $(java-spring-aad-b2c-client-id)
AAD_B2C_CLIENT_SECRET: $(java-spring-aad-b2c-client-secret)
EnvVars:
AZURE_TEST_MODE: LIVE
AAD_TENANT_ID_1: $(java-spring-aad-tenant-id-1-cn)
AAD_USER_NAME_1: $(java-spring-aad-user-name-1-cn)
AAD_USER_PASSWORD_1: $(java-spring-aad-user-password-1-cn)
AAD_TENANT_ID_2: $(java-spring-aad-tenant-id-2-cn)
AAD_USER_NAME_2: $(java-spring-aad-user-name-2-cn)
AAD_USER_PASSWORD_2: $(java-spring-aad-user-password-2-cn)
AAD_MULTI_TENANT_CLIENT_ID: $(java-spring-aad-multi-tenant-client-id-cn)
AAD_MULTI_TENANT_CLIENT_SECRET: $(java-spring-aad-multi-tenant-client-secret-cn)
AAD_SINGLE_TENANT_CLIENT_ID: $(java-spring-aad-single-tenant-id-cn)
AAD_SINGLE_TENANT_CLIENT_SECRET: $(java-spring-aad-single-tenant-secret-cn)
AAD_SINGLE_TENANT_CLIENT_ID_WITH_ROLE: $(java-spring-aad-single-tenant-id-with-role-cn)
AAD_SINGLE_TENANT_CLIENT_SECRET_WITH_ROLE: $(java-spring-aad-single-tenant-secret-with-role-cn)
AAD_LOGIN_BASE_URL: https://login.partner.microsoftonline.cn
AAD_GRAPH_BASE_URL: https://microsoftgraph.chinacloudapi.cn