Skip to content

Commit 3d4781c

Browse files
committed
Add property documentation_reference for usage in READMEs
The current `reference` property is usually too detailed for user facing documentation, where a shorter version is sufficient.
1 parent 321c3ec commit 3d4781c

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

src/bci_build/package/__init__.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -957,6 +957,16 @@ def reference(self) -> str:
957957
"""
958958
pass
959959

960+
@property
961+
@abc.abstractmethod
962+
def documentation_reference(self) -> str:
963+
"""The reference via which this image can be pulled, but not necessarily
964+
a fully unique version. This url shall point to a reasonable compromise
965+
to be used in the documentation, e.g. only the major version and not
966+
including the release.
967+
968+
"""
969+
960970
@property
961971
def description(self) -> str:
962972
"""The description of this image which is inserted into the
@@ -1324,6 +1334,12 @@ def reference(self) -> str:
13241334
+ f":{self.version_label}-{self._release_suffix}"
13251335
)
13261336

1337+
@property
1338+
def documentation_reference(self) -> str:
1339+
return f"{self.registry}/{self._registry_prefix}/{self.name}:" + (
1340+
"latest" if self.is_latest else self.version_label
1341+
)
1342+
13271343
@property
13281344
def build_version(self) -> Optional[str]:
13291345
build_ver = super().build_version
@@ -1398,6 +1414,10 @@ def build_tags(self) -> List[str]:
13981414
def reference(self) -> str:
13991415
return f"{self.registry}/{self._registry_prefix}/bci-{self.name}:{self.version_label}"
14001416

1417+
@property
1418+
def documentation_reference(self) -> str:
1419+
return f"{self.registry}/{self._registry_prefix}/bci-{self.name}:%OS_VERSION_ID_SP%"
1420+
14011421

14021422
def generate_disk_size_constraints(size_gb: int) -> str:
14031423
"""Creates the contents of a :file:`_constraints` file for OBS to require

0 commit comments

Comments
 (0)