Skip to content

Commit

Permalink
Write output of sign install to log (#1270)
Browse files Browse the repository at this point in the history
* Update the Sign script to log the output of dotnet install to the
logs.
* Update the sign package to latest. The Sign team recently made an
improvement to write a warning if _Visual C++ Runtime_ is not installed.
If it isn't, signing will fail because NavSip depends on this assembly.

Related to #1252
  • Loading branch information
aholstrup1 authored Oct 25, 2024
1 parent e12867d commit df9e7c1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Actions/Packages.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sign": "0.9.1-beta.24123.2",
"sign": "0.9.1-beta.24469.1",
"Microsoft.ApplicationInsights": "2.20.0",
"Az.Accounts": "2.15.1",
"Az.Storage": "6.1.1",
Expand Down
23 changes: 21 additions & 2 deletions Actions/Sign/Sign.psm1
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
<#
.SYNOPSIS
Checks whether nuget.org is added as a nuget source.
#>
function AssertNugetSourceIsAdded() {
$nugetSource = "https://api.nuget.org/v3/index.json"
$nugetSourceExists = dotnet nuget list source | Select-String -Pattern $nugetSource
if (-not $nugetSourceExists) {
throw "Nuget source $nugetSource is not added. Please add the source using 'dotnet nuget add source $nugetSource' or add another source with nuget.org as an upstream source."
}
}

<#
.SYNOPSIS
Installs the dotnet signing tool.
Expand All @@ -16,10 +28,17 @@ function Install-SigningTool() {
# Install the signing tool in the temp folder
Write-Host "Installing signing tool version $version in $tempFolder"
New-Item -ItemType Directory -Path $tempFolder | Out-Null
dotnet tool install sign --version $version --tool-path $tempFolder | Out-Null
dotnet tool install sign --version $version --tool-path $tempFolder | Out-Host

# Return the path to the signing tool
$signingTool = Join-Path -Path $tempFolder "sign.exe" -Resolve
$signingTool = Join-Path -Path $tempFolder "sign.exe"
if (-not (Test-Path -Path $signingTool)) {
# Check if nuget.org is added as a nuget source
AssertNugetSourceIsAdded

# If the tool is not found, throw an error
throw "Failed to install signing tool. If you are using a self-hosted runner please make sure you've followed all the steps described in https://aka.ms/algosettings#runs-on."
}
return $signingTool
}

Expand Down

0 comments on commit df9e7c1

Please sign in to comment.