tools/osbuild-mpp: resolve manifest lists
Add support for resolving manifest lists in osbuild-mpp. Adds an `index` boolean field to the container image struct for mpp-resolve-images. When enabled, the preprocessor will also store the manifest-list digest as a separate skopeo-index source and add it to the skopeo stage under the `manifest-lists` input.
This commit is contained in:
parent
ac2f140d4c
commit
3e94088e1f
1 changed files with 19 additions and 0 deletions
|
|
@ -1495,12 +1495,14 @@ class ManifestFileV2(ManifestFile):
|
|||
return
|
||||
|
||||
refs = element_enter(inputs_images, "references", {})
|
||||
manifest_lists = []
|
||||
|
||||
for image in element_enter(mpp, "images", []):
|
||||
source = image["source"]
|
||||
name = image.get("name", source)
|
||||
digest = image.get("digest", None)
|
||||
tag = image.get("tag", None)
|
||||
index = image.get("index", False)
|
||||
|
||||
main_manifest = ImageManifest.load(source, tag=tag, digest=digest)
|
||||
|
||||
|
|
@ -1529,6 +1531,23 @@ class ManifestFileV2(ManifestFile):
|
|||
"name": name
|
||||
}
|
||||
|
||||
if index:
|
||||
manifest_lists.append(main_manifest.digest)
|
||||
container_index_source = element_enter(self.sources, "org.osbuild.skopeo-index", {})
|
||||
index_items = element_enter(container_index_source, "items", {})
|
||||
index_items[main_manifest.digest] = {
|
||||
"image": {
|
||||
"name": source
|
||||
}
|
||||
}
|
||||
|
||||
# if we collected manifest lists, create the manifest-lists input array for the stage
|
||||
if manifest_lists:
|
||||
inputs_manifests = element_enter(inputs, "manifest-lists", {})
|
||||
inputs_manifests["type"] = "org.osbuild.files"
|
||||
inputs_manifests["origin"] = "org.osbuild.source"
|
||||
inputs_manifests["references"] = manifest_lists
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Manifest pre processor")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue