Skip to content

Commit e728401

Browse files
committed
only pass commit not flavor
1 parent 17c2f7c commit e728401

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/python_gardenlinux_lib/oci/registry.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,6 @@ def push_image_manifest(
483483
build_artifacts_dir: str,
484484
oci_metadata: list,
485485
feature_set: str,
486-
flavor: str,
487486
commit: str,
488487
manifest_file: str,
489488
):
@@ -497,7 +496,6 @@ def push_image_manifest(
497496
:param str build_artifacts_dir: directory where the build artifacts are located
498497
:param str feature_set: the expanded list of the included features of this manifest. It will be set in the
499498
manifest itself and in the index entry for this manifest
500-
:param str flavor: the flavor of the image
501499
:param str commit: the commit hash of the image
502500
:returns the digest of the pushed manifest
503501
"""
@@ -539,6 +537,7 @@ def push_image_manifest(
539537
if cleanup_blob and os.path.exists(file_path):
540538
os.remove(file_path)
541539
# This ends up in the manifest
540+
flavor = get_flavor_from_cname(cname, get_arch=True)
542541
manifest_image["annotations"] = {}
543542
manifest_image["annotations"]["version"] = version
544543
manifest_image["annotations"]["cname"] = cname
@@ -548,8 +547,10 @@ def push_image_manifest(
548547
manifest_image["annotations"]["commit"] = commit
549548
description = (
550549
f"Image: {cname} "
550+
f"Flavor: {flavor} "
551551
f"Architecture: {architecture} "
552-
f"Features: {feature_set}"
552+
f"Features: {feature_set} "
553+
f"Commit: {commit} "
553554
)
554555
manifest_image["annotations"][
555556
"org.opencontainers.image.description"
@@ -654,6 +655,7 @@ def push_from_tar(self, architecture: str, version: str, cname: str, tar: str):
654655
)
655656

656657
features = ""
658+
commit = ""
657659
for artifact in oci_metadata:
658660
if artifact["media_type"] == "application/io.gardenlinux.release":
659661
file = open(f"{tmpdir}/{artifact["file_name"]}", "r")
@@ -664,6 +666,9 @@ def push_from_tar(self, architecture: str, version: str, cname: str, tar: str):
664666
"GARDENLINUX_FEATURES="
665667
)
666668
break
669+
elif line.strip().startswith("GARDENLINUX_COMMIT_ID="):
670+
commit = line.strip().removeprefix("GARDENLINUX_COMMIT_ID=")
671+
break
667672
file.close()
668673

669674
digest = self.push_image_manifest(
@@ -673,6 +678,7 @@ def push_from_tar(self, architecture: str, version: str, cname: str, tar: str):
673678
tmpdir,
674679
oci_metadata,
675680
features,
681+
commit,
676682
"/dev/null",
677683
)
678684
except Exception as e:
@@ -735,6 +741,7 @@ def push_from_dir(
735741
directory,
736742
oci_metadata,
737743
features,
744+
commit,
738745
manifest_file,
739746
)
740747
except Exception as e:

tests/test_push_image.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ def test_push_example(version, cname, arch):
4949
f"{GARDENLINUX_ROOT_DIR_EXAMPLE}/.build",
5050
oci_metadata,
5151
features,
52-
flavor,
5352
commit,
5453
manifest_file,
5554
)

0 commit comments

Comments
 (0)