Skip to content

Commit faf2e03

Browse files
authored
Merge pull request #102368 from kaito-ms/patch-2
Added Pipeline YAML definition
2 parents f9699d0 + abc053a commit faf2e03

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

articles/azure-resource-manager/templates/test-toolkit.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ The easiest way to add the test toolkit to your pipeline is with third-party ext
316316

317317
Or, you can implement your own tasks. The following example shows how to download the test toolkit.
318318

319+
For Release Pipeline:
319320
```json
320321
{
321322
"environment": {},
@@ -343,9 +344,24 @@ Or, you can implement your own tasks. The following example shows how to downloa
343344
}
344345
}
345346
```
347+
For Pipeline YAML definition:
348+
```yaml
349+
- pwsh: |
350+
New-Item '$(ttk.folder)' -ItemType Directory
351+
Invoke-WebRequest -uri '$(ttk.uri)' -OutFile "$(ttk.folder)/$(ttk.asset.filename)" -Verbose
352+
Get-ChildItem '$(ttk.folder)' -Recurse
353+
354+
Write-Host "Expanding files..."
355+
Expand-Archive -Path '$(ttk.folder)/*.zip' -DestinationPath '$(ttk.folder)' -Verbose
356+
357+
Write-Host "Expanded files found:"
358+
Get-ChildItem '$(ttk.folder)' -Recurse
359+
displayName: 'Download TTK'
360+
```
346361
347362
The next example shows how to run the tests.
348363
364+
For Release Pipeline:
349365
```json
350366
{
351367
"environment": {},
@@ -373,6 +389,24 @@ The next example shows how to run the tests.
373389
}
374390
}
375391
```
392+
For Pipeline YAML definition:
393+
```yaml
394+
- pwsh: |
395+
Import-Module $(ttk.folder)/arm-ttk/arm-ttk.psd1 -Verbose
396+
$testOutput = @(Test-AzTemplate -TemplatePath "$(sample.folder)")
397+
$testOutput
398+
399+
if ($testOutput | ? {$_.Errors }) {
400+
exit 1
401+
} else {
402+
Write-Host "##vso[task.setvariable variable=result.best.practice]$true"
403+
exit 0
404+
}
405+
errorActionPreference: continue
406+
failOnStderr: true
407+
displayName: 'Run Best Practices Tests'
408+
continueOnError: true
409+
```
376410
377411
## Next steps
378412

0 commit comments

Comments
 (0)