-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modify logic of deploying Arm template according to artifacts #18773
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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, | ||
|
@@ -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) { | ||
$Artifacts.TrimStart(",").Split(",") | ForEach-Object { | ||
$templateFilePath = Join-Path $root $_ | ||
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 | ||
} | ||
} | ||
} 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 | ||
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 | ||
} | ||
|
||
|
@@ -550,6 +567,11 @@ A directory under 'sdk' in the repository root - optionally with subdirectories | |
specified - in which to discover ARM templates named 'test-resources.json'. | ||
This can also be an absolute path or specify parent directories. | ||
|
||
.PARAMETER Artifacts | ||
A string of all artifact names defined in tests.yml under ServiceDirectory. If the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To keep same style, use |
||
value is not set, then all ARM templates under ServiceDirectory will be found to deploy | ||
test resources. Otherwise, only templates under ServiceDirectory/artifact will be discovered. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
.PARAMETER TestApplicationId | ||
The AAD Application ID to authenticate the test runner against deployed | ||
resources. Passed to the ARM template as 'testApplicationId'. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ Deploys live test resources defined for a service directory to Azure. | |
### Default (Default) | ||
``` | ||
New-TestResources.ps1 [-BaseName <String>] [-ResourceGroupName <String>] [-ServiceDirectory] <String> | ||
[-TestApplicationId <String>] [-TestApplicationSecret <String>] [-TestApplicationOid <String>] | ||
[-Artifacts <String>] [-TestApplicationId <String>] [-TestApplicationSecret <String>] [-TestApplicationOid <String>] | ||
[-DeleteAfterHours <Int32>] [-Location <String>] [-Environment <String>] [-ArmTemplateParameters <Hashtable>] | ||
[-AdditionalParameters <Hashtable>] [-EnvironmentVariables <Hashtable>] [-CI] [-Force] [-OutFile] [-WhatIf] | ||
[-Confirm] [<CommonParameters>] | ||
|
@@ -35,8 +35,9 @@ New-TestResources.ps1 [-BaseName <String>] [-ResourceGroupName <String>] [-Servi | |
Deploys live test resouces specified in test-resources.json files to a resource | ||
group. | ||
|
||
This script searches the directory specified in $ServiceDirectory recursively | ||
for files named test-resources.json. | ||
This script searches for files named test-resources.json in each artifact project | ||
of $Artifacts under $ServiceDirectory recursively. When $Artifacts is not set, the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sometimes directory name not equal to artifact name. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
script will search the directory $ServiceDirectory directly. | ||
All found test-resources.json files will be | ||
deployed to the test resource group. | ||
|
||
|
@@ -70,6 +71,7 @@ the SecureString to plaintext by another means. | |
New-TestResources.ps1 ` | ||
-BaseName 'Generated' ` | ||
-ServiceDirectory '$(ServiceDirectory)' ` | ||
-Artifacts '$(Artifacts)' ` | ||
-TenantId '$(TenantId)' ` | ||
-ProvisionerApplicationId '$(ProvisionerId)' ` | ||
-ProvisionerApplicationSecret '$(ProvisionerSecret)' ` | ||
|
@@ -142,6 +144,23 @@ Accept pipeline input: False | |
Accept wildcard characters: False | ||
``` | ||
|
||
### -Artifacts | ||
A string of all artifact names defined in tests.yml under ServiceDirectory. If the | ||
value is not set, then all ARM templates under ServiceDirectory will be found to deploy | ||
test resources. Otherwise, only templates under ServiceDirectory/artifact will be discovered. | ||
|
||
```yaml | ||
Type: String | ||
Parameter Sets: (All) | ||
Aliases: | ||
|
||
Required: False | ||
Position: Named | ||
Default value: None | ||
Accept pipeline input: False | ||
Accept wildcard characters: False | ||
``` | ||
|
||
### -TestApplicationId | ||
The AAD Application ID to authenticate the test runner against deployed | ||
resources. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @benbp
You cannot edit these common files in the language repo instead you need to follow the https://github.com/Azure/azure-sdk-tools/blob/master/doc/common/common_engsys.md#workflow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @weshaggard , I will follow the workflow and work with @benbp .