From ebe01f479fcd67b4554322e89052c4389c648d5b Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Thu, 28 Jan 2021 17:24:28 -0500 Subject: [PATCH] oscontainer: add com.coreos.os-extensions label This label contains a semi-colon-separated list of extensions baked in the oscontainer. This will be used by the humans and the MCO for validation: https://github.com/openshift/os/issues/409#issuecomment-764977556 --- src/oscontainer.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/oscontainer.py b/src/oscontainer.py index e9968ba3ce..2ea605c6f5 100755 --- a/src/oscontainer.py +++ b/src/oscontainer.py @@ -193,6 +193,13 @@ def oscontainer_build(containers_storage, tmpdir, src, ref, image_name_and_tag, os.makedirs(dest_dir, exist_ok=True) run_verbose(["tar", "-xf", tarball], cwd=dest_dir) + with open(os.path.join(dest_dir, 'extensions.json')) as f: + extensions = json.load(f) + + extensions_label = ';'.join([ext for (ext, obj) in extensions['extensions'].items() + if obj.get('kind', 'os-extension') == 'os-extension']) + config += ['-l', f"com.coreos.os-extensions={extensions_label}"] + if display_name is not None: config += ['-l', 'io.openshift.build.version-display-names=machine-os=' + display_name, '-l', 'io.openshift.build.versions=machine-os=' + ostree_version]