Custom repository hook location

In our project, we put all our build tool configuration stuff in a top-level build_tools directory. This helps to keep infrastructure organized separately from the core source code and avoids cluttering the landing page when someone first visits the repository. It looks like Buildkite repository hooks have to go in “.buildkite/hooks” at the root of the repo (docs). I see this is currently hardcoded in the agent bootstrap. Could it instead be moved into the agent config?

(for now, I’ve just added a symlink)

Hey @gcmn!

The agent hooks exist on the agent file system and it’s configured by the hooks-path setting. I believe you can set it to your new location.
By default, you can find the location of the agent hooks directory in your platform’s installation documentation. Then during the agent’s startup, you can pass the hooks-path as shown below:
buildkite-agent start --hooks-path ~/.new-buildkite-agent-dire/hooks

Best!

Yeah that’s for the agent hooks that are installed on the agents. I’m talking about the repo hooks that are triggered in the job lifecycle for every job that checks out the repository.

Oh right! I misread :sweat_smile:

It’s a good suggestion :+1:t2:. Can you also create an issue on the agent repo? So the maintainers of the repo can provide you with feedback. And if you are willing to create a PR would be much appreciated! :blush:

Best!

Filed Make location of repository hooks configurable · Issue #1668 · buildkite/agent · GitHub