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,23 +23,28 @@ Function EnsureTrailingSlash($path) {
Get-ChildItem "$PSScriptRoot\*.ps1" -Exclude "_*" -Recurse |% {
$ArtifactName = $_.BaseName
(& $_).GetEnumerator() |% {
$BaseDirectory = New-Object Uri ((EnsureTrailingSlash $_.Key), [UriKind]::Absolute)
$_.Value |% {
if ($_.GetType() -eq [IO.FileInfo] -or $_.GetType() -eq [IO.DirectoryInfo]) {
$_ = $_.FullName
$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)
$_.Value | % {
if ($_.GetType() -eq [IO.FileInfo] -or $_.GetType() -eq [IO.DirectoryInfo]) {
$_ = $_.FullName
}
$artifact = New-Object -TypeName PSObject
Add-Member -InputObject $artifact -MemberType NoteProperty -Name ArtifactName -Value $ArtifactName
$SourceFullPath = New-Object Uri ($BaseDirectory, $_)
Add-Member -InputObject $artifact -MemberType NoteProperty -Name Source -Value $SourceFullPath.LocalPath
$RelativePath = [Uri]::UnescapeDataString($BaseDirectory.MakeRelative($SourceFullPath))
Add-Member -InputObject $artifact -MemberType NoteProperty -Name ContainerFolder -Value (Split-Path $RelativePath)
Write-Output $artifact
}
$artifact = New-Object -TypeName PSObject
Add-Member -InputObject $artifact -MemberType NoteProperty -Name ArtifactName -Value $ArtifactName
$SourceFullPath = New-Object Uri ($BaseDirectory, $_)
Add-Member -InputObject $artifact -MemberType NoteProperty -Name Source -Value $SourceFullPath.LocalPath
$RelativePath = [Uri]::UnescapeDataString($BaseDirectory.MakeRelative($SourceFullPath))
Add-Member -InputObject $artifact -MemberType NoteProperty -Name ContainerFolder -Value (Split-Path $RelativePath)
Write-Output $artifact
}
}
}

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

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

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

@ -9,9 +9,11 @@ if ($env:SYSTEM_DEFAULTWORKINGDIRECTORY) {
Set-Content -Path $_ -Value $content -Encoding UTF8
}
} 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 = (
(Get-ChildItem "$RepoRoot\bin\coverage.cobertura.xml" -Recurse) +

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

@ -6,6 +6,8 @@ if (!$BuildConfiguration) {
$PackagesRoot = "$RepoRoot/bin/Packages/$BuildConfiguration"
if (!(Test-Path $PackagesRoot)) { return }
@{
"$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" = (
(Get-ChildItem "$RepoRoot\obj\project.assets.json" -Recurse)
"$ObjRoot" = (
(Get-ChildItem "$ObjRoot\project.assets.json" -Recurse)
);
}