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

Building on self-hosted Windows 10: Failed to run "sh " #389

Open
Carsten-MaD opened this issue Apr 21, 2022 · 13 comments · Fixed by #387
Open

Building on self-hosted Windows 10: Failed to run "sh " #389

Carsten-MaD opened this issue Apr 21, 2022 · 13 comments · Fixed by #387
Assignees
Labels
bug Something isn't working windows Microsoft Windows Platform

Comments

@Carsten-MaD
Copy link

Hey!

Bug description
I am trying to set up a build pipeline, and since we have a lot of spare Windows 10 workstations around, I felt it would be a good use for them to be part of a build farm.

Unfortunately, it seems that there is a problem, please review the information below:

OS: Windows 10 64bit

Configuration

- uses: game-ci/unity-builder@v2
  env:
    UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
    UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
    UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
  with:
    unityVersion: '2019.2.17f1'
    targetPlatform: StandaloneWindows       

Error Log

##[debug]Evaluating: secrets.UNITY_EMAIL
##[debug]Evaluating Index:
##[debug]..Evaluating secrets:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'UNITY_EMAIL'
##[debug]=> '***'
##[debug]Result: '***'
##[debug]Evaluating: secrets.UNITY_PASSWORD
##[debug]Evaluating Index:
##[debug]..Evaluating secrets:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'UNITY_PASSWORD'
##[debug]=> '***'
##[debug]Result: '***'
##[debug]Evaluating: secrets.UNITY_SERIAL
##[debug]Evaluating Index:
##[debug]..Evaluating secrets:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'UNITY_SERIAL'
##[debug]=> '***'
##[debug]Result: '***'
##[debug]Evaluating condition for step: 'Run game-ci/unity-builder@v2'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Run game-ci/unity-builder@v2
##[debug]Loading inputs
##[debug]Loading env
Run game-ci/unity-builder@v2
  with:
    unityVersion: 2019.2.17f1
    targetPlatform: StandaloneWindows
    versioning: Semantic
    androidAppBundle: false
    awsBaseStackName: game-ci
    cloudRunnerCluster: local
    cloudRunnerCpu: 1.0
    cloudRunnerMemory: 750M
    kubeVolumeSize: 5Gi
  env:
    UNITY_EMAIL: ***
    UNITY_PASSWORD: ***
    UNITY_SERIAL: ***
Warning: 
      Library folder does not exist.
      Consider setting up caching to speed up your workflow,
      if this is not your first build.
    
##[debug]exec tool: C:\Program Files\Git\cmd\git.exearguments:   rev-parse   --is-shallow-repositoryExit code 0 received from tool 'C:\Program Files\Git\cmd\git.exe'STDIO streams have closed for tool 'C:\Program Files\Git\cmd\git.exe'
true

##[debug]exec tool: C:\Program Files\Git\cmd\git.exearguments:   fetch   --unshallowExit code 0 received from tool 'C:\Program Files\Git\cmd\git.exe'STDIO streams have closed for tool 'C:\Program Files\Git\cmd\git.exe'

Error: Failed to run "sh ".
 In-command error caught: Error: Unable to locate executable file: sh. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.
##[debug]Node Action run completed with exit code 1
##[debug]Finishing: Run game-ci/unity-builder@v2```
@Carsten-MaD Carsten-MaD added the bug Something isn't working label Apr 21, 2022
@Carsten-MaD
Copy link
Author

Adding C:\Program Files\Git\bin to $env:GITHUB_PATH solved the problem.
I assume these bootstrapping steps are all taken care of in the Docker image?

@webbertakken
Copy link
Member

Thanks for reporting this. Indeed this is not expected to happen on a Windows runner.

The windows runner isn't supposed to run sh at all. Someone will need to look into it.

@frostebite frostebite self-assigned this Apr 21, 2022
@frostebite
Copy link
Member

Same matter as discussed in:
#390

@frostebite frostebite linked a pull request Apr 21, 2022 that will close this issue
3 tasks
@frostebite
Copy link
Member

See my reply:
#390 (comment)

@deitry
Copy link

deitry commented Jun 27, 2022

It seems there is still a call to sh somewhere. Adding C:\Program Files\Git\bin to PATH surely helps

@GitFlip
Copy link

GitFlip commented Jun 8, 2023

Seems like this may still be a problem according to this discord thread: https://discord.com/channels/710946343828455455/1088495967067713536

I switched to using a windows self-hosted runner when my GitHub Runner started failing to build because it was running out of memory. I cannot seem to get self-hosted to work as I get this same error.

I've tried adding C:\Program Files\Git\bin to $env:GITHUB_PATH and C:\Program Files\Git\bin to PATH, but still get the error.

Also I've tried using game-ci/unity-builder@v2, game-ci/unity-builder@cloud-runner-develop, and game-ci/unity-builder@main with no luck.

@thebeater
Copy link

thebeater commented Jul 3, 2023

Seems like this may still be a problem according to this discord thread: https://discord.com/channels/710946343828455455/1088495967067713536

I switched to using a windows self-hosted runner when my GitHub Runner started failing to build because it was running out of memory. I cannot seem to get self-hosted to work as I get this same error.

I've tried adding C:\Program Files\Git\bin to $env:GITHUB_PATH and C:\Program Files\Git\bin to PATH, but still get the error.

Also I've tried using game-ci/unity-builder@v2, game-ci/unity-builder@cloud-runner-develop, and game-ci/unity-builder@main with no luck.

@GitFlip
same here.
Did you get it working??

@GitFlip
Copy link

GitFlip commented Jul 10, 2023

Seems like this may still be a problem according to this discord thread: https://discord.com/channels/710946343828455455/1088495967067713536
I switched to using a windows self-hosted runner when my GitHub Runner started failing to build because it was running out of memory. I cannot seem to get self-hosted to work as I get this same error.
I've tried adding C:\Program Files\Git\bin to $env:GITHUB_PATH and C:\Program Files\Git\bin to PATH, but still get the error.
Also I've tried using game-ci/unity-builder@v2, game-ci/unity-builder@cloud-runner-develop, and game-ci/unity-builder@main with no luck.

@GitFlip same here. Did you get it working??

Unfortunately I did not get it working yet.

@Hawam
Copy link

Hawam commented Sep 12, 2023

i have the same problem on windows 11
any one found a solution
i added C:\Program Files\Git\bin to PATH
i don't know how to add C:\Program Files\Git\bin to $env:GITHUB_PATH so i don't know if it may help

@AntonioCoppe
Copy link

Same Issue here.

@wilg
Copy link

wilg commented Oct 31, 2023

I'm getting this error too with the following configuration (sha points to latest commit on main as of this writing, also tried with main):

jobs:
  windows_host:
    if: inputs.build_windows
    name: Windows
    runs-on: [self-hosted, "${{ matrix.platform[0] }}"]
    strategy:
      fail-fast: false
      matrix:
        platform:
          - [Windows, StandaloneWindows64]
    steps:
      - uses: actions/checkout@v3
        name: Git Checkout + LFS
        with:
          lfs: true
          fetch-depth: 0
          clean: false

      # - run: |
      #     "C:\Program Files\Docker\Docker\DockerCli.exe" -SwitchWindowsEngine
      #   shell: cmd
      #   name: Switch Docker to Windows Containers

      - run: |
          IF EXIST ${{github.workspace}}\Assets\Editor\UnityBuilderAction RMDIR /s /q ${{github.workspace}}\Assets\Editor\UnityBuilderAction
        shell: cmd
        name: Build Script Cleaning

      - uses: game-ci/unity-builder@7afabe74da5227a9ecd537f5260b398258c3eb3b
        name: Unity build
        env:
          UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
          UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
          UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
          UNITY_BUILDER_DOCKER_ARGS: "-m 28g --cpus 10 --gpus all"
        with:
          unityVersion: 2022.3.11f1
          targetPlatform: ${{ matrix.platform[1] }}
          buildName: Gumshoe
          allowDirtyBuild: true
Run game-ci/unity-builder@7afabe74da5[2](https://github.com/wilg/spaceshoe/actions/runs/6713154894/job/18244164245#step:4:2)27a9ecd5[3](https://github.com/wilg/spaceshoe/actions/runs/6713154894/job/18244164245#step:4:3)7f5260b398258c3eb3b
  with:
    unityVersion: 2022.3.11f1
    targetPlatform: StandaloneWindows6[4](https://github.com/wilg/spaceshoe/actions/runs/6713154894/job/18244164245#step:4:4)
    buildName: Gumshoe
    allowDirtyBuild: true
    versioning: Semantic
    androidExportType: androidPackage
    androidSymbolType: none
    dockerIsolationMode: default
    awsStackName: game-ci
    providerStrategy: local
    kubeVolumeSize: [5](https://github.com/wilg/spaceshoe/actions/runs/6713154894/job/18244164245#step:4:5)Gi
    watchToEnd: true
    cacheUnityInstallationOnMac: false
    dockerWorkspacePath: /github/workspace
  env:
    NODE_TLS_REJECT_UNAUTHORIZED: 0
    UNITY_LICENSE: ***
    UNITY_EMAIL: ***
    UNITY_PASSWORD: ***
    UNITY_BUILDER_DOCKER_ARGS: -m 28g --cpus 10 --gpus all
Warning: 
      Library folder does not exist.
      Consider setting up caching to speed up your workflow,
      if this is not your first build.
    
(node:44[7](https://github.com/wilg/spaceshoe/actions/runs/6713154894/job/18244164245#step:4:7)0[8](https://github.com/wilg/spaceshoe/actions/runs/6713154894/job/18244164245#step:4:8)) NOTE: We are formalizing our plans to enter AWS SDK for JavaScript (v2) into maintenance mode in [20](https://github.com/wilg/spaceshoe/actions/runs/6713154894/job/18244164245#step:4:20)[23](https://github.com/wilg/spaceshoe/actions/runs/6713154894/job/18244164245#step:4:24).

Please migrate your code to use AWS SDK for JavaScript (v3).
For more information, check the migration guide at https://a.co/7PzMCcy
(Use `node --trace-warnings ...` to show where the warning was created)
Error: Failed to run "sh ".
 In-command error caught: Error: Unable to locate executable file: sh. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.

@davidmfinol davidmfinol reopened this Nov 1, 2023
@AndrewKahr
Copy link
Member

The simplest fix is to add git bash's bin directory to your path as it includes an sh executable. Since git is needed for the runners to work regardless this should be a decent workaround

@Hawam
Copy link

Hawam commented Mar 7, 2024

i have the same problem on windows 11 any one found a solution i added C:\Program Files\Git\bin to PATH i don't know how to add C:\Program Files\Git\bin to $env:GITHUB_PATH so i don't know if it may help

adding C:\Program Files\Git\bin to PATH for the system solved it for me
i was adding it for the user PATH previously

@davidmfinol davidmfinol added the windows Microsoft Windows Platform label Oct 10, 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 windows Microsoft Windows Platform
Projects
None yet
Development

Successfully merging a pull request may close this issue.