How do you write and execute pre or post-command script in buildkite?

I am confuse with how to do it, Do i call script in a yaml file?

Hey @Joe,

pre-command and post-command are one of the hooks an agent runs in the context of running a job. The docs describe the purpose of each.

You have a few options on how to get them to execute for a job. The simplest option would be to write a hook in your repository. If you create an executable script in .buildkite/hooks/pre-command, the agent will find that and execute it at the pre-command stage of the job lifecycle. The same goes for post-command or any other hooks that can be read from the repository (the docs show which ones)

I see. Thank you,

1 Like