According to the doc,
> Windows agents include Git Bash
however, when run on a self-hosted agent, it uses C:\WINDOWS\system32\bash.exe, which is WSL's bash, not Git bash.
It doesn't work BTW, but I'll file it separately as product feedback.
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Bash also not working on me when it has 2 bash steps.
steps:
- bash: |
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $RUSTUP_TOOLCHAIN
echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin"
displayName: Install rust
- bash: |
rustup target add $TARGET
displayName: Install toolchains
The Install rust step is working but not with the Install toolchains step which give this error message:
##[section]Starting: Install toolchains
==============================================================================
Task : Bash
Description : Run a Bash script on macOS, Linux, or Windows
Version : 3.148.2
Author : Microsoft Corporation
Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=613738)
==============================================================================
Generating script.
##[error]Unable to locate executable file: 'bash'. 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.
##[section]Finishing: Install toolchains
I would expect bash to work on Windows 'Self Hosted' build agent when bash is available via the WSL. In other words on the if the Microsoft bash launcher: C:\Windows\system32\bash.exe is working as expected on the build agent machine I would expect bash to be available without further config.
I have filed a bug report here:
https://developercommunity.visualstudio.com/content/problem/568027/bash-step-doesnt-work-on-windows-self-hosted-agent.html
PLEASE update the the documentation on this page "How to configure bash on a Windows self-hosted build agent" to provide cross-platform scripting via bash!
We simply switched to pwsh - it works everywhere without any problems.
We simply switched to pwsh - it works everywhere without any problems.
pwsh is cross platform, however it needs to be installed explicitly where in my case my case bash already exists (WSL is already installed) and runs just fine but the build agent has issues with it and it should be running...
@EM1L well, I compared the time/effort to install pwsh (~1 min) and expecting this bug to be fixed (and then a bunch of totally new ones after WSL 2.0 is out) and made an obvious choice.
BTW to all the commenters - this issue was regarding seeing Git bash in the documentation vs. WSL bash in reality, not the fact that it didn't work (which is another problem), sorry for the misleading title.