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.
For a complete example take a look at hooks
Define a hook
To define a hook modify your
devspace.yaml like this:
hooks: - command: echo args: - before image building when: before: images: all
This tells DevSpace to execute the command
echo before image building before any image will be build. 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:
If any hook returns a non zero exit code, DevSpace will abort and print an error message!