diff --git a/blueos_repository/extension/extension.py b/blueos_repository/extension/extension.py index 3483674..7a16da0 100644 --- a/blueos_repository/extension/extension.py +++ b/blueos_repository/extension/extension.py @@ -1,4 +1,5 @@ import asyncio +import uuid from typing import Dict, List import aiohttp @@ -148,7 +149,16 @@ async def __create_version_from_tag_blob(self, version_tag: Tag, blob: Blob) -> Logger.warning(self.identifier, str(error)) readme = str(error) + images = self.__extract_images_from_tag(version_tag) + if not images: + Logger.error( + self.identifier, + f"Could not find images associated with tag {version_tag.name} for extension {self.identifier}" + ) + + tag_identifier = str(uuid.uuid5(uuid.NAMESPACE_DNS, f"{self.identifier}.{version_tag.name}")) return ExtensionVersion( + identifier=tag_identifier, tag=version_tag.name, type=labels.get("type", ExtensionType.OTHER), website=links.pop("website", labels.get("website", None)), diff --git a/blueos_repository/extension/models.py b/blueos_repository/extension/models.py index 2130661..0428287 100644 --- a/blueos_repository/extension/models.py +++ b/blueos_repository/extension/models.py @@ -90,6 +90,8 @@ class ExtensionVersion: Represents a version of an extension. Attributes: + identifier (str): Unique identifier of this tag version, in extension repository is the 256 sha digest from the + first compatible image, in BlueOS cloud is a uuid v4. tag (Optional[str]): Tag of the version. type (ExtensionType): Type of the extension. website (str): URL to the extension's website. @@ -105,6 +107,7 @@ class ExtensionVersion: images (List[Image]): Images available for the extension. """ + identifier: str # TODO - In future try to unify with identifiers coming from cloud type: ExtensionType website: str images: List[Image]