microsoft / AL-Go

The plug-and-play DevOps solution for Business Central app development on GitHub
MIT License
288 stars 121 forks source link

[Bug]: Self-hosted-runner on Windows - Signing Tool not found #1252

Open sschuh-mumdat opened 2 weeks ago

sschuh-mumdat commented 2 weeks ago

AL-Go version

6.0

Describe the issue

Hi,

maybe someone give me a hint in the right direction...

To the story: i'm about to setup and test a self-hosted runner on a Windows server.

Installed components: choco install git --force --params "/NoAutoCrlf" choco install 7zip choco install gh choco install pwsh -y choco install vcredist140 -y choco install dotnet -y choco install dotnet-sdk -y

Feed: dotnet nuget add source https://api.nuget.org/v3/index.json --name nuget.org

Windows Defender/Antivirus is disabled.

When it goes to signing, following error occurs:

"The sign.exe can not be found."

Run microsoft/AL-Go-Actions/Sign@v6.0
Run C:\actions-runner\_work\_actions\microsoft\AL-Go-Actions\v6.0\Sign/../Invoke-AlGoAction.ps1 -ActionName "Sign" -Action {
Files to be signed
Module Az.Accounts is available in version 3.0.4
Importing module Az.Accounts (minimum version 2.15.1)
Module Az.KeyVault is available in version 6.2.0
Importing module Az.KeyVault (minimum version 5.2.0)
Connecting to Azure using clientId and clientSecret.
Successfully connected to Azure

Signing files
  Installing signing tool version 0.9.1-beta.24123.2 in C:\Users\github-service\AppData\Local\Temp\SigningTool-78[46](https://github.com/mumdat/bezahlmodul/actions/runs/11312907797/job/31460997018#step:9:49)30865
  No NuGet sources are defined or enabled
  Applying settings from C:\actions-runner\_work\bezahlmodul\bezahlmodul\.github\AL-Go-Settings.json
  Applying settings from C:\actions-runner\_work\bezahlmodul\bezahlmodul\.AL-Go\settings.json
  No settings found in C:\actions-runner\_work\bezahlmodul\bezahlmodul\.github\CICD.settings.json
  No settings found in C:\actions-runner\_work\bezahlmodul\bezahlmodul\.AL-Go\CICD.settings.json
  No settings found in C:\actions-runner\_work\bezahlmodul\bezahlmodul\.AL-Go\sschuh-mumdat.settings.json
  Enabling Microsoft telemetry...

Error: 
Unexpected error when running action. 
Error Message: 
Der Pfad "C:\Users\github-service\AppData\Local\Temp\SigningTool-784630865\sign.exe" kann nicht gefunden werden, da er nicht vorhanden ist., 

StackTrace: 
bei Install-SigningTool, C:\actions-runner\_work\_actions\microsoft\AL-Go-Actions\v6.0\Sign\Sign.psm1: Zeile 22 
<- bei Invoke-SigningTool, C:\actions-runner\_work\_actions\microsoft\AL-Go-Actions\v6.0\Sign\Sign.psm1: Zeile 86 
<- bei <ScriptBlock>, C:\actions-runner\_work\_actions\microsoft\AL-Go-Actions\v6.0\Sign\Sign.ps1: Zeile 57 
<- bei <ScriptBlock>, C:\actions-runner\_work\_temp\3857f866-87[50](https://github.com/mumdat/bezahlmodul/actions/runs/11312907797/job/31460997018#step:9:53)-4a13-9b77-e810f8036c5f.ps1: Zeile 3 
<- bei <ScriptBlock>, C:\actions-runner\_work\_actions\microsoft\AL-Go-Actions\v6.0\Invoke-AlGoAction.ps1: Zeile 17 
<- bei <ScriptBlock>, C:\actions-runner\_work\_temp\3857f866-8750-4a13-9b77-e810f8036c5f.ps1: Zeile 2 <- bei <ScriptBlock>, <Keine Datei>: Zeile 1
  Error: Process completed with exit code 1.

Additional info: I logged onto the server and tried it manually with the Admin user account, no problem at all, signing tool will be downloaded to the given path.

dotnet tool install sign --version 0.9.1-beta.24123.2 --tool-path C:\Users\github-service\AppData\Local\Temp\SigningTool-784630865

On the runners provided by Github, no error occurs.

Solution, see next post.

sschuh-mumdat commented 2 weeks ago

I logged into the server with the "github-servive" Account which runs the github-runner and docker as a service user. I did not know, that the nuget sources are stored per user.

So I tried the following...

Windows PowerShell
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

PS C:\Users\github-service> dotnet tool install sign --version 0.9.1-beta.24123.2 --tool-path C:\Users\github-service\AppData\Local\Temp\SigningTool-784630865

No NuGet sources are defined or enabled   

PS C:\Users\github-service> dotnet nuget add source https://api.nuget.org/v3/index.json --name nuget.org
Die Paketquelle namens "nuget.org" wurde erfolgreich hinzugefügt.

And now it works!

@freddydk Is it maybe possible to add this command to Github AL-Go? dotnet nuget add source https://api.nuget.org/v3/index.json --name nuget.org

Just to prevent others running into the same problem.

Or maybe...

The following line in https://github.com/microsoft/AL-Go/blob/main/Actions/Sign/Sign.psm1 .....

dotnet tool install sign --version $version --tool-path $tempFolder | Out-Null

...should not nulled out, to show the problem.

frottke commented 2 weeks ago

We had the same problem (nuget setup stored per user). As a workaround, we had the same solution as you