Prepare self-hosted runner on Windows 10 for Github Actions and Julia private registry and packages

Leaving this here just as an instruction for others.

I’ve tried to add Windows self-hosted runner to build and test my private package and got the following error:

> Run julia-actions/add-julia-registry@v1
C:\Windows\System32\OpenSSH\ssh-agent.exe
C:\Windows\System32\OpenSSH\ssh-add.exe C:\Windows\SERVIC~1\NETWOR~1\AppData\Local\Temp\tmp-6200-o7Pm6fzViZyY
Error connecting to agent: No such file or directory
Error: The process 'C:\Windows\System32\OpenSSH\ssh-add.exe' failed with exit code 2
    at ExecState._setResult (C:\actions-runner\_work\_actions\julia-actions\add-julia-registry\v1\node_modules\@actions\exec\lib\toolrunner.js:592:25)
    at ExecState.CheckComplete (C:\actions-runner\_work\_actions\julia-actions\add-julia-registry\v1\node_modules\@actions\exec\lib\toolrunner.js:575:18)
    at ChildProcess.<anonymous> (C:\actions-runner\_work\_actions\julia-actions\add-julia-registry\v1\node_modules\@actions\exec\lib\toolrunner.js:469:27)
    at ChildProcess.emit (events.js:314:20)
    at maybeClose (internal/child_process.js:1022:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)

How did I fix this:

  • Install Git for Windows
winget install --id Git.Git -e --source winget
  • Add to PATH: C:\Program Files\Git\usr\bin
  • Move it before C:\Windows\System32\OpenSSH entry (unconfirmed if this is necessary)
  • Add to PATH : C:\Program Files\Git\bin\git.exe, C:\Program Files\Git\cmd
  • Restart ssh-agent service:
Stop-Service ssh-agent
Start-Service ssh-agent
  • Restart actions runner service:
Stop-Service "actions.runner.*"
Start-Service "actions.runner.*"
  • Then I got error in julia-actions/julia-buildpkg@v1 action that could not download deps from private registry:
Cloning [b2dd10be-c0b5-41fc-bf7d-fdb86be5b335] MyPrivatePackage from git@github.com:MyOrg/MyPrivatePackage.jl 
ERROR: failed to clone from git@github.com:MyOrg/MyPrivatePackage.jl, 
error: GitError(Code:EUSER, Class:Callback, Aborting, user cancelled credential request.)

Solved it by adding environment variable in my workflow file:

env: 
  JULIA_PKG_USE_CLI_GIT: true
FYI, this is the full workflow file for my project
name: testbuild

on:
  push:
    branches: [master]
  pull_request:
    branches: [master]

env:
  PYTHON: ""
  JULIA_PKG_USE_CLI_GIT: true

jobs:
  test:
    runs-on: [self-hosted, '${{ matrix.os }}', '${{ matrix.arch }}']
    strategy:
      matrix:
        julia-version: ['1.7.2']
        arch: [x64]
        os: [Windows]
    
    steps:
      - uses: webfactory/ssh-agent@v0.5.1
        with:
          ssh-private-key: ${{ secrets.MY_SSH_PRIVATE_GHA_KEY }}
      - uses: actions/checkout@v2
      - uses: julia-actions/add-julia-registry@v1
        with:
          key: ${{ secrets.MY_SSH_PRIVATE_GHA_KEY }}
          registry: IncartDev/JuliaRegistry
      - uses: julia-actions/setup-julia@v1
        with:
          version: ${{ matrix.julia-version }}
          arch: ${{ matrix.arch }}
      - uses: julia-actions/julia-buildpkg@v1
      - uses: julia-actions/julia-runtest@v1
1 Like