Base Abstraction
In the current version of ZenML, container registries have a rather basic base abstraction. In essence, their base configuration only features auri and their implementation features a non-abstract prepare_image_push method for validation.
Building your own container registry
If you want to create your own custom flavor for a container registry, you can follow the following steps:- Create a class which inherits from the
BaseContainerRegistryclass and if you need to execute any checks/validation before the image gets pushed, you can define these operations in theprepare_image_pushmethod. As an example, you can check theAWSContainerRegistry. - If you need further configuration, you can create a class which inherits from the
BaseContainerRegistryConfigclass. - Bring both of the implementation and the configuration together by inheriting from the
BaseContainerRegistryFlavorclass.
- The CustomContainerRegistryFlavor class is imported and utilized upon the creation of the custom flavor through the CLI.
- The CustomContainerRegistryConfig class is imported when someone tries to register/update a stack component with this custom flavor. Especially, during the registration process of the stack component, the config will be used to validate the values given by the user. As
Configobject are inherentlypydanticobjects, you can also add your own custom validators here. - The CustomContainerRegistry only comes into play when the component is ultimately in use.
CustomContainerRegistryFlavor and the CustomContainerRegistryConfig are implemented in a different module/path than the actual CustomContainerRegistry).