-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathazure-pipelines.yml
More file actions
84 lines (70 loc) · 2.79 KB
/
azure-pipelines.yml
File metadata and controls
84 lines (70 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)
pool:
vmImage: 'ubuntu-latest'
trigger:
branches:
include:
- main
- develop
- feature/*
variables:
- group: common-build-variables
resources:
repositories:
- repository: templates
type: github
endpoint: GitHubPublic
name: WCOMAB/WCOM.AzurePipelines.YamlTemplates
ref: refs/heads/main
stages:
- template: dotnet/stages.yml@templates
parameters:
shouldPublish: eq(variables['Build.SourceBranch'], 'refs/heads/main')
dpi:
report: true
WorkspaceId: $(DPI.WorkspaceId)
SharedKey: $(DPI.Key)
postBuildScript:
displayName: "AZDOI Integration tests"
azureSubscription: "azure-devops-inventory-tool"
scriptType: pscore
targetType: inline
script: |
# Change to artifacts staging directory
Set-Location "$(build.artifactstagingdirectory)"
# Set output path for test results
$outputPath = Join-Path "$(build.artifactstagingdirectory)" "output"
Write-Host "Executing integration test to output path: $outputPath"
# Create output directory
New-Item -Path $outputPath -ItemType Directory -Force
[int]$exitCode = 0
# Create new tool manifest
dotnet new tool-manifest
$exitCode += $LASTEXITCODE
# Install AZDOI tool from local artifacts
Get-ChildItem -Path "$(build.artifactstagingdirectory)" -Recurse -Include "AZDOI.*.nupkg" | ForEach-Object {
Write-Host "Installing AZDOI tool from $(build.artifactstagingdirectory) $(Build.BuildNumber) $($_.FullName) from source $($_.Directory.FullName)"
dotnet tool install AZDOI --add-source "$($_.Directory.FullName)" --version "$(Build.BuildNumber)"
$exitCode += $LASTEXITCODE
}
# Run AZDOI inventory command
dotnet AZDOI inventory repositories AZDOI $outputPath --entra-id-auth
$exitCode += $LASTEXITCODE
# Zip and upload test results
$zipItems = Get-ChildItem $outputPath
Compress-Archive -Path $zipItems.FullName -DestinationPath $(Build.ArtifactStagingDirectory)/AzureDevOpsDocs.zip -CompressionLevel Optimal
echo '##vso[artifact.upload artifactname=AzureDevOpsDocs]$(Build.ArtifactStagingDirectory)/AzureDevOpsDocs.zip'
# Check for test failures
if ($exitCode -ne 0) {
throw "Integration tests failed with exit code $exitCode"
exit $exitCode
}
# Report success
Write-Host "Integration tests passed"
exit 0
build: Development
buildParameters:
- '-c Release'
environments:
- env: dev
name: Development