mirror of
https://github.com/actions/runner-images.git
synced 2025-12-14 22:05:17 +00:00
Handle looking for installer log before exit
This commit is contained in:
@@ -30,6 +30,10 @@ function Install-Binary {
|
||||
.PARAMETER ExpectedSHA512Sum
|
||||
The expected SHA512 sum of the binary. If specified, the binary's SHA512 sum is checked before installation.
|
||||
|
||||
.PARAMETER InstallerLogPath
|
||||
The path to the log file which is produced when the installation fails. This can be used for debugging purposes.
|
||||
This is only displayed when the installation fails.
|
||||
|
||||
.EXAMPLE
|
||||
Install-Binary -Url "https://go.microsoft.com/fwlink/p/?linkid=2083338" -Type EXE -InstallArgs ("/features", "+", "/quiet") -ExpectedSignature "A5C7D5B7C838D5F89DDBEDB85B2C566B4CDA881F"
|
||||
#>
|
||||
@@ -46,7 +50,8 @@ function Install-Binary {
|
||||
[String[]] $ExtraInstallArgs,
|
||||
[String[]] $ExpectedSignature,
|
||||
[String] $ExpectedSHA256Sum,
|
||||
[String] $ExpectedSHA512Sum
|
||||
[String] $ExpectedSHA512Sum,
|
||||
[String] $InstallerLogPath
|
||||
)
|
||||
|
||||
if ($PSCmdlet.ParameterSetName -eq "LocalPath") {
|
||||
@@ -122,6 +127,14 @@ function Install-Binary {
|
||||
} else {
|
||||
Write-Host "Installation process returned unexpected exit code: $exitCode"
|
||||
Write-Host "Time elapsed: $installCompleteTime seconds"
|
||||
|
||||
if ($InstallerLogPath -and (Test-Path -Path $InstallerLogPath)) {
|
||||
Write-Host "Searching for logs maching $InstallerLogPath pattern"
|
||||
Get-ChildItem -Path $InstallerLogPath | ForEach-Object {
|
||||
Write-Output "Found Installer Log: $InstallerLogPath"
|
||||
Get-Content -Path $InstallerLogPath
|
||||
}
|
||||
}
|
||||
exit $exitCode
|
||||
}
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user