I’m having some issues on executing a plugin hook on a Windows agent (v3).
Currently my agent is being run by nssm-2.4 as recommended by the installation documentation with my Windows user.
When I try to run the following steps I get a generic error:
This downloads the plugin from Github as expected and when it’s going to execute it I get the following logs with the error on the last line:
Running plugin test post-command hook
> C:\buildkite-agent\plugins\github-com-natasg-test-buildkite-plugin-v1-0-0\hooks\post-command
he file cannot be accessed by the system.
The file itself is in there and permission wise everything seems to be fine.
Is this related to a permission issue (seems fine for me), because I’m using Powershell as the SHELL and the hook is written in Bash or am I missing something else?
That looks like its an issue between powershell and bash as you mentioned. Are you able to run an agent manually on your windows host using bash and see if it works that way?
Executing the agent through bash and changing the SHELL to “C:\Windows\System32/bash.exe” gave me some weird results, I replaced the ‘example command’ with a ‘echo “-----”’ just to have a bash command in place.
> echo "-----"
/bin/bash: echo "-----": No such file or directory
🚨 Error: The command exited with status 127
Running plugin test post-command hook
> C:\buildkite-agent\plugins\github-com-natasg-test-buildkite-plugin-v1-0-0\hooks\post-command
/bin/bash: C:/Users/AVATAR~1/AppData/Local/Temp/buildkite-agent-bootstrap-hook-runner-1514048708: No such file or directory
user command error: exit status 127
Now the command itself cannot be executed too. Just to be sure which value should I use for the SHELL configuration inside buildkite-agent.cfg?
I think the issue here is actually going to be the hooks in general on Windows; Windows doesn’t offer a means to run shell scripts natively, so anything you’re trying to run that ends in .sh or starts with