Custom Hooks
After filling in details regarding Access level, Resource Quota, Configurations, Secrets & PVC, Environment Variables, Node & Service Affinity, Liveness & Readiness and Labels and Annotations, you can also specify Pre-Hooks and Post-Hooks. Providing information regarding Pre-Hooks and Post-Hooks is not mandatory. It is completely optional to fill in details for this section.
#
What are Pre-Hooks and Post-Hooks?Pre-Hooks and Post-Hooks are common types of custom hooks used during deployment to execute custom code at specific points in the deployment process. These hooks are typically used to perform actions that are not part of the standard deployment process, such as configuring the environment, running automated tests, or updating a database schema. Using hooks reduces the risk of errors and improves the quality of your deployments.
For example, a pre-deploy hook might be used to validate that all necessary dependencies are installed and that the environment is properly configured before beginning the deployment process.
For example, a post-deploy hook might be used to run automated tests to verify that the application is working as expected after the deployment.
#
How you can add Pre-Hooks and Post-Hooks?Adding Pre-Hooks/Post-Hooks can be done by following these simple steps. The product offers three options to add custom Pre-Hooks/Post-Hooks. You can add hooks via,
- Entering Commands
- Uploading File
- Selecting Git URL
#
Adding Pre-Hooks/Post-Hooks via CommandsHere’s how you can add Pre-Hooks/Post-Hooks by entering commands.
- Click “Yes” if you want to deploy Pre-Hooks/Post-Hooks via Commands else click “No”.
- Choose “Command” as an option to add Pre-Hooks/Post-Hooks.
- Enter commands to specify the hooks.
- Click “Add Row” to add more commands.
#
Adding Pre-Hooks/Post-Hooks via File UploadHere’s how you can add Pre-Hooks/Post-Hooks by uploading the file containing Pre-Hooks/Post-Hooks that you want to add.
- Click “Yes” if you want to deploy Pre-Hooks/Post-Hooks via File Upload else click “No”.
- Choose the file that contains the custom hooks.
- Enter command ARGS (optional arguments that modify or specify the behavior of the command) and then press Enter.
- Click “Add Row” to add more files.
#
Adding Pre-Hooks/Post-Hooks via GitHere’s how you can add Pre-Hooks/Post-Hooks by specifying the Git URL and File or Folder Path of the repository of the file which contains the Pre-Hooks/Post-Hooks.
- Click “Yes” if you want to deploy Pre-Hooks/Post-Hooks via Git else click “No”.
- Choose “Git URL” as an option to add Pre-hooks/Post-Hooks.
- Select the Git URL of the repository of the file that contains the Pre-Hooks/Post-Hooks.
- Load the Branches
- Choose the Git Branch.
- Enter the folder/file path of the repository of the file which contains the Pre-Hooks/Post-Hooks.
- Specify the command ARGS (optional arguments that modify or specify the behavior of the command)and then press Enter.
- Click “Add Row” to add more Git URLs.