hookbuildkite

Buildkite Windows agent - hook scripts location


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!


Solution

  • 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"