Skip to content

Commit 34aab2d

Browse files
committed
add flavor and commit to annotations
1 parent 95ea4a2 commit 34aab2d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/python_gardenlinux_lib/oci/registry.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,8 @@ def push_image_manifest(
483483
build_artifacts_dir: str,
484484
oci_metadata: list,
485485
feature_set: str,
486+
flavor: str,
487+
commit: str,
486488
manifest_file: str,
487489
):
488490
"""
@@ -494,8 +496,9 @@ def push_image_manifest(
494496
:param str cname: canonical name of the target image
495497
:param str build_artifacts_dir: directory where the build artifacts are located
496498
:param str feature_set: the expanded list of the included features of this manifest. It will be set in the
497-
:param str manifest_file: a file where the index entry for the pushed manifest is written to.
498499
manifest itself and in the index entry for this manifest
500+
:param str flavor: the flavor of the image
501+
:param str commit: the commit hash of the image
499502
:returns the digest of the pushed manifest
500503
"""
501504

@@ -541,6 +544,8 @@ def push_image_manifest(
541544
manifest_image["annotations"]["cname"] = cname
542545
manifest_image["annotations"]["architecture"] = architecture
543546
manifest_image["annotations"]["feature_set"] = feature_set
547+
manifest_image["annotations"]["flavor"] = flavor
548+
manifest_image["annotations"]["commit"] = commit
544549
description = (
545550
f"Image: {cname} "
546551
f"Architecture: {architecture} "
@@ -705,6 +710,7 @@ def push_from_dir(
705710
)
706711

707712
features = ""
713+
commit = ""
708714
for artifact in oci_metadata:
709715
if artifact["media_type"] == "application/io.gardenlinux.release":
710716
file = open(f"{directory}/{artifact["file_name"]}", "r")
@@ -715,8 +721,15 @@ def push_from_dir(
715721
"GARDENLINUX_FEATURES="
716722
)
717723
break
724+
elif line.strip().startswith("GARDENLINUX_COMMIT_ID="):
725+
commit = line.strip().removeprefix(
726+
"GARDENLINUX_COMMIT_ID="
727+
)
728+
break
718729
file.close()
719730

731+
flavor = get_flavor_from_cname(cname, get_arch=True)
732+
720733
digest = self.push_image_manifest(
721734
architecture,
722735
cname,

0 commit comments

Comments
 (0)