Make azp/artifacts only warn when they can't find files

This commit is contained in:
Andrew Arnott 2019-07-12 13:33:44 -06:00
Родитель ecb32a2ad6
Коммит 13ab120e7f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: A9B9910CDCCDA441
5 изменённых файлов: 33 добавлений и 20 удалений

Просмотреть файл

@ -23,9 +23,13 @@ Function EnsureTrailingSlash($path) {
Get-ChildItem "$PSScriptRoot\*.ps1" -Exclude "_*" -Recurse |% { Get-ChildItem "$PSScriptRoot\*.ps1" -Exclude "_*" -Recurse |% {
$ArtifactName = $_.BaseName $ArtifactName = $_.BaseName
(& $_).GetEnumerator() |% { $fileGroups = & $_
if (!$fileGroups -or $fileGroups.Count -eq 0) {
Write-Warning "No files found for the `"$ArtifactName`" artifact."
} else {
$fileGroups.GetEnumerator() | % {
$BaseDirectory = New-Object Uri ((EnsureTrailingSlash $_.Key), [UriKind]::Absolute) $BaseDirectory = New-Object Uri ((EnsureTrailingSlash $_.Key), [UriKind]::Absolute)
$_.Value |% { $_.Value | % {
if ($_.GetType() -eq [IO.FileInfo] -or $_.GetType() -eq [IO.DirectoryInfo]) { if ($_.GetType() -eq [IO.FileInfo] -or $_.GetType() -eq [IO.DirectoryInfo]) {
$_ = $_.FullName $_ = $_.FullName
} }
@ -42,4 +46,5 @@ Get-ChildItem "$PSScriptRoot\*.ps1" -Exclude "_*" -Recurse |% {
Write-Output $artifact Write-Output $artifact
} }
} }
}
} }

Просмотреть файл

@ -5,6 +5,8 @@ if ($env:BUILD_ARTIFACTSTAGINGDIRECTORY) {
$artifactsRoot = "$RepoRoot\bin" $artifactsRoot = "$RepoRoot\bin"
} }
if (!(Test-Path $artifactsRoot/build_logs)) { return }
@{ @{
"$artifactsRoot/build_logs" = (Get-ChildItem -Recurse "$artifactsRoot/build_logs") "$artifactsRoot/build_logs" = (Get-ChildItem -Recurse "$artifactsRoot/build_logs")
} }

Просмотреть файл

@ -9,9 +9,11 @@ if ($env:SYSTEM_DEFAULTWORKINGDIRECTORY) {
Set-Content -Path $_ -Value $content -Encoding UTF8 Set-Content -Path $_ -Value $content -Encoding UTF8
} }
} else { } else {
Write-Warning "Azure Pipelines not detected. Machine-neutral token replacement skipped." Write-Warning "coverageResults: Azure Pipelines not detected. Machine-neutral token replacement skipped."
} }
if (!((Test-Path $RepoRoot\bin) -and (Test-Path $RepoRoot\obj))) { return }
@{ @{
$RepoRoot = ( $RepoRoot = (
(Get-ChildItem "$RepoRoot\bin\coverage.cobertura.xml" -Recurse) + (Get-ChildItem "$RepoRoot\bin\coverage.cobertura.xml" -Recurse) +

Просмотреть файл

@ -6,6 +6,8 @@ if (!$BuildConfiguration) {
$PackagesRoot = "$RepoRoot/bin/Packages/$BuildConfiguration" $PackagesRoot = "$RepoRoot/bin/Packages/$BuildConfiguration"
if (!(Test-Path $PackagesRoot)) { return }
@{ @{
"$PackagesRoot" = (Get-ChildItem $PackagesRoot -Recurse) "$PackagesRoot" = (Get-ChildItem $PackagesRoot -Recurse)
} }

Просмотреть файл

@ -1,7 +1,9 @@
$RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") $ObjRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..\obj")
if (!(Test-Path $ObjRoot)) { return }
@{ @{
"$RepoRoot\obj" = ( "$ObjRoot" = (
(Get-ChildItem "$RepoRoot\obj\project.assets.json" -Recurse) (Get-ChildItem "$ObjRoot\project.assets.json" -Recurse)
); );
} }