DevSpace allows you to define execution of custom commands during certain lifecycle events. This makes it possible to customize the deployment and development process with DevSpace.
Hooks can be defined in the
hooks section of
For a complete example take a look at this example project on GitHub.
This tells DevSpace to execute the command
echo before image building before any image will be built. You are able to define hooks for the following life cycle events:
- before image building: Will be executed before building any images. Value:
- after image building: Will be executed after images have been successfully built. Value:
- before deploying: Will be executed before any deployment is deployed. Value:
- after deploying: Will be executed after all deployments are deployed. Value:
- before certain deployment: Will be executed before a certain deployment is deployed. Value:
- after certain deployment: Will be executed after a certain deployment is deployed. Value:
Errors in Hooks
If any hook returns a non zero exit code, DevSpace will abort and print an error message.