Parameterize and add diagnostics to InsertVersionsValues.ps1
It's been failing ever since switching from `Get-Nbgv.ps1` to `dotnet tool run nbgv`, but only on Azure Pipelines, and only on certain commits. Quite literally, it fails repeatedly on some particular commit, and if I push a new *empty* commit, it succeeds. This makes me believe that somehow, the git database or git commit id itself or something is causing `nbgv` to fail. I have no idea why it would fail with this output though: ``` Computing InsertVersionsValues variable Option '--project' expects a single argument but 2 were provided. ConvertFrom-Json: /home/vsts/work/1/s/azure-pipelines/variables/InsertVersionsValues.ps1:2 Line | 2 | … oft.VisualStudio.Validation" --format json | ConvertFrom-Json).Assemb … | ~~~~~~~~~~~~~~~~ | Conversion from JSON failed with error: Unexpected character encountered | while parsing value: D. Path '', line 0, position 0. ``` The output suggests a malformed command line, but I simply see no possible way for that to happen. Nor can I repro it locally.
This commit is contained in:
Родитель
c84fe06b97
Коммит
4406d85960
|
@ -4,6 +4,30 @@
|
|||
# your libraries as defined in the src\ProductData\AssemblyVersions.tt file.
|
||||
return
|
||||
|
||||
[string]::join(',',(@{
|
||||
('LibraryNoDotsVersion') = & { (dotnet tool run nbgv get-version --project "$PSScriptRoot\..\..\src\LibraryName" --format json | ConvertFrom-Json).AssemblyVersion };
|
||||
}.GetEnumerator() |% { "$($_.key)=$($_.value)" }))
|
||||
$MacroName = 'LibraryNoDotsVersion'
|
||||
$SampleProject = "$PSScriptRoot\..\..\src\LibraryName"
|
||||
try {
|
||||
return [string]::join(',',(@{
|
||||
($MacroName) = & { (dotnet tool run nbgv get-version --project $SampleProject --format json | ConvertFrom-Json).AssemblyVersion };
|
||||
}.GetEnumerator() |% { "$($_.key)=$($_.value)" }))
|
||||
}
|
||||
catch {
|
||||
Write-Error $_
|
||||
Write-Error "Failed. Diagnostic data proceeds:"
|
||||
[string]::join(',',(@{
|
||||
($MacroName) = & {
|
||||
Write-Host "dotnet tool run nbgv get-version --project `"$SampleProject`" --format json"
|
||||
$result1 = dotnet tool run nbgv get-version --project $SampleProject --format json
|
||||
Write-Host $result1
|
||||
$result2 = dotnet tool run nbgv get-version --project $SampleProject --format json | ConvertFrom-Json
|
||||
Write-Host $result2
|
||||
Write-Host $result2.AssemblyVersion
|
||||
Write-Host (dotnet tool run nbgv get-version --project $SampleProject --format json | ConvertFrom-Json).AssemblyVersion
|
||||
Write-Output (dotnet tool run nbgv get-version --project $SampleProject --format json | ConvertFrom-Json).AssemblyVersion
|
||||
};
|
||||
}.GetEnumerator() |% { "$($_.key)=$($_.value)" }))
|
||||
|
||||
Write-Host "one more..."
|
||||
$r = & { (dotnet tool run nbgv get-version --project $SampleProject --format json | ConvertFrom-Json).AssemblyVersion };
|
||||
Write-Host $r
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче