Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
sschuh-mumdat opened this issue Oct 13, 2024 · 4 comments
Closed

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

sschuh-mumdat opened this issue Oct 13, 2024 · 4 comments
Assignees
Labels
bug Something isn't working Fix Ready Fix Ready In Preview Currently available in AL-Go for GitHub preview

Comments

@sschuh-mumdat
Copy link

sschuh-mumdat commented Oct 13, 2024

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 sschuh-mumdat added the bug Something isn't working label Oct 13, 2024
@sschuh-mumdat
Copy link
Author

sschuh-mumdat commented Oct 13, 2024

I logged into the server with the "github-service" 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
Copy link

frottke commented Oct 14, 2024

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

@aholstrup1 aholstrup1 self-assigned this Oct 15, 2024
@aholstrup1 aholstrup1 changed the title [Bug]: Self-hosted-runner on Windows - Singing Tool not found [Bug]: Self-hosted-runner on Windows - Signing Tool not found Oct 15, 2024
aholstrup1 added a commit that referenced this issue Oct 25, 2024
* 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
@JonFjolnirAlbertsson
Copy link

JonFjolnirAlbertsson commented Oct 29, 2024

How can you sign in to the windows server as the github runner (github-service). Where do you find the password?

@frottke
Copy link

frottke commented Oct 29, 2024

@JonFjolnirAlbertsson you can use the windows task planer as a workaround to run the necessary powershell commands as the networkservice user

@aholstrup1 aholstrup1 added Fix Ready Fix Ready In Preview Currently available in AL-Go for GitHub preview labels Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Fix Ready Fix Ready In Preview Currently available in AL-Go for GitHub preview
Projects
None yet
Development

No branches or pull requests

4 participants