Schemas
You can validate deployment targets you have defined in the deployment configuration using custom Joi validation schemas.
Take a look at custom validation schemas documentation to learn more about custom schemas.
You associate schemas with a deployment group using the targetsSchema
property, which accepts a single schema or a list of schemas. Takomo uses the schemas associated with a deployment group to validate all deployment targets located under it in the deployment groups hierarchy.
You can also specify the targetsSchema
property at the top-level of the deployment configuration. Top-level schemas are applied to all deployment groups.
The schemas used to validate deployment targets must be object schemas because the deployment targets to validate are given as an object whose keys are paths to deployment targets in the deployment groups hierarchy, and values are configurations of the deployment target themselves.
Example
Let's add two custom validation schemas. One to validate that if the budget variable is given, it must be a non-negative number, and another to validate that the environment variable is given and is one of the allowed values. The schemas are located in the schemas directory.
With these schemas available, we can modify our deployment configuration and refer to the schemas with their names.
We use the budget schema for all deployment targets and the environment schema for the targets under the all/applications deployment group.
With this configuration, the object that gets passed to our custom schemas looks like this:
Last updated