0

Does anybody know where I should place my buildkite global hook scripts on a windows agent machine?

I place it in the hooks folder as specified in the buildkite-agent.cfg ... But it does not work. It works just fine when using an Ubuntu agent!

shwz
  • 426
  • 1
  • 6
  • 22

1 Answers1

1

Hooks support was added to the Windows release in Buildkite Agent version 3, which is currently in beta and available from the GitHub releases page. You need to download the latest beta.

You might also need to add .bat to the end of your hook file name, like ...\hooks\environment.bat.

To export your environment variables make sure you use set:

# ...\hooks\environment.bat

set FOO="bar"

Now in your job batch files or scripts you should be able to use the variable:

echo "%FOO%"

# outputs "bar"
sj26
  • 6,725
  • 2
  • 27
  • 24
  • I tried, but still cant get it to work...! I wonder if i still need to use `export`? or `set` as the windows command? the .bat file also needs to be run by admin rights for the envs to be set properly..! – shwz Nov 03 '17 at 10:14
  • If you're trying to change an environment variable, yes, make sure you do something like `set FOO "bar"` in the windows batch file. – sj26 Nov 07 '17 at 23:04
  • I've updated the answer to provide a few more hints, too. :-) – sj26 Nov 07 '17 at 23:13
  • Thank you sj26 , I just had to add a = sign for the set command to make it work – shwz Nov 08 '17 at 15:18