base.py 894 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import abc
  2. class RuntimeBuilder(abc.ABC):
  3. @abc.abstractmethod
  4. def build(
  5. self,
  6. path: str,
  7. tags: list[str],
  8. ) -> str:
  9. """
  10. Build the runtime image.
  11. Args:
  12. path (str): The path to the runtime image's build directory.
  13. tags (list[str]): The tags to apply to the runtime image (e.g., ["repo:my-repo", "sha:my-sha"]).
  14. Returns:
  15. str: The name of the runtime image (e.g., "repo:sha").
  16. Raises:
  17. RuntimeError: If the build failed.
  18. """
  19. pass
  20. @abc.abstractmethod
  21. def image_exists(self, image_name: str) -> bool:
  22. """
  23. Check if the runtime image exists.
  24. Args:
  25. image_name (str): The name of the runtime image (e.g., "repo:sha").
  26. Returns:
  27. bool: Whether the runtime image exists.
  28. """
  29. pass