Fix global tool and SDK tests in release pipeline (#16342)

This commit is contained in:
Aditya Patwardhan 2021-11-01 11:03:52 -07:00 committed by GitHub
parent 64392f36d1
commit 8fbffe3e4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 0 deletions

View file

@ -97,6 +97,11 @@ jobs:
$toolPath = "$(System.DefaultWorkingDirectory)/toolPath/${{ parameters.globalToolExeName }}"
$env:DOTNET_ROOT = if ($IsWindows) { "$env:LOCALAPPDATA\Microsoft\dotnet" } else { "$env:HOME/.dotnet" }
Write-Verbose -Verbose "DOTNET_ROOT: $env:DOTNET_ROOT"
Get-ChildItem $env:DOTNET_ROOT
$versionFound = & $toolPath -c '$PSVersionTable.PSVersion.ToString()'
if ( '$(PowerShellVersion)' -ne $versionFound)

View file

@ -8,6 +8,8 @@ jobs:
displayName: ${{ parameters.displayName }}
pool:
vmImage: ${{ parameters.imageName }}
variables:
- group: AzDevOpsArtifacts
steps:
- checkout: self
clean: true
@ -35,6 +37,33 @@ jobs:
artifact: metadata
path: '$(Pipeline.Workspace)/releasePipeline/metadata'
- pwsh: |
Import-Module "$(Build.SourcesDirectory)/build.psm1" -Force
New-NugetConfigFile -NugetFeedUrl $(PSInternalNugetFeed) -UserName $(PSInternalNugetFeedUserName) -ClearTextPAT $(PSInternalNugetFeedPAT) -FeedName AzDevOpsFeed -Destination '$(Build.SourcesDirectory)/test/hosting'
Write-Verbose -Verbose "Capture hosting folder files"
Get-ChildItem '$(Build.SourcesDirectory)/test/hosting'
# The above cmdlet creates a lower-case nuget.config. There also exists a NuGet.config which we needed to replace.
# Hence the following workaround
if (-not $IsWindows) {
Move-Item -Path '$(Build.SourcesDirectory)/test/hosting/nuget.config' -Destination '$(Build.SourcesDirectory)/test/hosting/NuGet.Config' -Force -ErrorAction Continue
Write-Verbose -Verbose "Capture hosting folder files after Move-Item"
Get-ChildItem '$(Build.SourcesDirectory)/test/hosting'
}
if(-not (Test-Path "$(Build.SourcesDirectory)/test/hosting/NuGet.Config"))
{
throw "NuGet.Config is not created"
}
else
{
Write-Verbose -Verbose "Capture NuGet.Config contents"
Get-Content "$(Build.SourcesDirectory)/test/hosting/NuGet.Config" -Raw
}
displayName: Insert internal nuget feed
- pwsh: |
$dotnetMetadataPath = "$(Build.SourcesDirectory)/DotnetRuntimeMetadata.json"
$dotnetMetadataJson = Get-Content $dotnetMetadataPath -Raw | ConvertFrom-Json