Add test for framework dependent package in release pipeline (#18506) (#19114)

This commit is contained in:
Travis Plunk
2023-02-07 22:05:45 +00:00
committed by GitHub
parent 4fd81ac0cf
commit caede6fe99
5 changed files with 69 additions and 10 deletions
+13 -1
View File
@@ -2295,7 +2295,11 @@ function Start-ResGen
}
}
function Find-Dotnet() {
function Find-Dotnet {
param (
[switch] $SetDotnetRoot
)
Write-Verbose -Verbose "In Find-DotNet"
$originalPath = $env:PATH
@@ -2322,6 +2326,14 @@ function Find-Dotnet() {
Write-Warning "The 'dotnet' in the current path can't find SDK version ${dotnetCLIRequiredVersion}, prepending $dotnetPath to PATH."
# Globally installed dotnet doesn't have the required SDK version, prepend the user local dotnet location
$env:PATH = $dotnetPath + [IO.Path]::PathSeparator + $env:PATH
if ($SetDotnetRoot) {
Write-Verbose -Verbose "Setting DOTNET_ROOT to $dotnetPath"
$env:DOTNET_ROOT = $dotnetPath
}
} elseif ($SetDotnetRoot) {
Write-Verbose -Verbose "Expected dotnet version found, setting DOTNET_ROOT to $dotnetPath"
$env:DOTNET_ROOT = $dotnetPath
}
}
else {
@@ -105,6 +105,14 @@ stages:
imageName: ubuntu-latest
packageNamePattern: '**/*fxdependent.tar.gz'
- template: templates/release-ValidateFxdPackage.yml
parameters:
jobName: FxdPackageLinuxonARM
displayName: Fxd Package Test Linux ARM64
imageName: 'PSMMSUbuntu20.04-ARM64-secure'
packageNamePattern: '**/*fxdependent.tar.gz'
use1ES: true
- stage: StaticPkgValidation
dependsOn: []
displayName: Static package validation
@@ -3,13 +3,18 @@ parameters:
displayName: ""
imageName: ""
packageNamePattern: ""
use1ES: false
jobs:
- job: ${{ parameters.jobName }}
displayName: ${{ parameters.displayName }}
variables:
- group: DotNetPrivateBuildAccess
pool:
# testing
vmImage: ${{ parameters.imageName }}
${{ if eq(parameters.use1ES, 'false') }}:
vmImage: ${{ parameters.imageName }}
${{ else }}:
name: 'PS-MSCodeHub-ARM' # add ImageOverride to select image
steps:
- checkout: self
clean: true
@@ -26,6 +31,16 @@ jobs:
patterns: '${{ parameters.packageNamePattern }}'
path: '$(Pipeline.Workspace)/releasePipeline/finalResults'
- pwsh: |
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
Import-Module "$(Build.SourcesDirectory)/build.psm1" -Force
Start-PSBootstrap
Write-Verbose -Message "Installing .NET SDK completed." -Verbose
displayName: Install .NET
env:
__DONET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED)
__DONET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY)
- pwsh: |
Get-ChildItem -Path '$(Pipeline.Workspace)/releasePipeline/finalResults' -Recurse
displayName: Capture downloaded package
@@ -53,9 +68,24 @@ jobs:
displayName: Expand fxd package
- pwsh: |
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
Import-Module "$(Build.SourcesDirectory)/build.psm1" -Force
Find-Dotnet -SetDotnetRoot
Write-Verbose -Verbose "DOTNET_ROOT: $env:DOTNET_ROOT"
Write-Verbose -Verbose "Check dotnet install"
dotnet --info
Write-Verbose -Verbose "Start test"
$packageNameFilter = '${{ parameters.packageNamePattern }}'
$pwshExeName = if ($packageNameFilter.EndsWith('tar.gz')) { 'pwsh' } else { 'pwsh.exe' }
$actualOutput = & $pwshExeName -c 'Start-Job -ScriptBlock { "1" } | Wait-Job | Receive-Job'
$pwshPath = Join-Path '$(Pipeline.Workspace)/releasePipeline/finalResults/fxd' $pwshExeName
if ($IsLinux) {
chmod u+x $pwshPath
}
$pwshDllPath = Join-Path '$(Pipeline.Workspace)/releasePipeline/finalResults/fxd' 'pwsh.dll'
$actualOutput = & dotnet $pwshDllPath -c 'Start-ThreadJob -ScriptBlock { "1" } | Wait-Job | Receive-Job'
Write-Verbose -Verbose "Actual output: $actualOutput"
if ($actualOutput -ne 1) {
throw "Actual output is not as expected"
@@ -11,17 +11,18 @@ steps:
Write-Host "##vso[build.updatebuildnumber]$name"
displayName: Set Release Name
- pwsh: |
Import-module '$(BUILD.SOURCESDIRECTORY)/build.psm1'
Install-AzCopy
displayName: Install AzCopy
- pwsh: |
Import-module '$(BUILD.SOURCESDIRECTORY)/build.psm1'
$azcopy = Find-AzCopy
Write-Verbose -Verbose "Found AzCopy: $azcopy"
& $azcopy login --service-principal --application-id $(PowerShellReleaseSPN)
& $azcopy cp https://$(StorageAccount).blob.core.windows.net/$(AzureVersion)/* $(System.ArtifactsDirectory) --recursive
& $azcopy /Source:https://$(StorageAccount).blob.core.windows.net/$(AzureVersion) /Dest:$(System.ArtifactsDirectory) /S /SourceKey:$(StorageAccountKey)
displayName: Download Azure Artifacts
env:
AZCOPY_SPA_CLIENT_SECRET: $(PowerShellReleaseSPNSecret)
- pwsh: |
Get-ChildItem $(System.ArtifactsDirectory)\* -recurse | Select-Object -ExpandProperty Name
@@ -113,9 +113,17 @@ steps:
Write-Verbose -verbose "to be signed:`r`n $($missingSignatures | Out-String)"
$filesToSignDirectory = "$(System.ArtifactsDirectory)\thirdPartyToBeSigned"
if (Test-Path $filesToSignDirectory) {
Remove-Item -Path $filesToSignDirectory -Recurse -Force
}
$null = New-Item -ItemType Directory -Path $filesToSignDirectory -Force -Verbose
$signedFilesDirectory = "$(System.ArtifactsDirectory)\thirdPartySigned"
if (Test-Path $signedFilesDirectory) {
Remove-Item -Path $signedFilesDirectory -Recurse -Force
}
$null = New-Item -ItemType Directory -Path $signedFilesDirectory -Force -Verbose
$missingSignatures | ForEach-Object {