util/containers: add the checksum to the image data
When parsing a container input, add the checksum to the data as well. Usually with other inputs, the stage only needs to know the filepath where it can find the source content. In most (all, so far) cases, this is a checksum appended to the content type. In this case, the filepath is the location of the storage bind mount and the checksum is needed to retrieve the container. The name might only be a destination name (a name to use for storing the container in the image), so we can't rely on it being valid in the source.
This commit is contained in:
parent
591593ea00
commit
423819a80e
1 changed files with 4 additions and 1 deletions
|
|
@ -71,12 +71,14 @@ def parse_containers_input(inputs):
|
|||
list_path = os.path.join(manifests["path"], list_digest)
|
||||
|
||||
if data["format"] == "containers-storage":
|
||||
# filepath is the storage bindmount
|
||||
filepath = os.path.join(images["path"], "storage")
|
||||
|
||||
res[checksum] = {
|
||||
"filepath": filepath,
|
||||
"manifest-list": list_path,
|
||||
"data": data,
|
||||
"checksum": checksum, # include the checksum in the value
|
||||
}
|
||||
|
||||
if manifest_files:
|
||||
|
|
@ -123,7 +125,8 @@ def containers_storage_source(image, image_filepath, container_format):
|
|||
# the containers-storage store even when bind mounted.
|
||||
mg.mount(image_filepath, storage_path, rw=True)
|
||||
|
||||
image_source = f"{container_format}:[{driver}@{storage_path}+/run/containers/storage]{image_name}"
|
||||
image_id = image["checksum"].split(":")[1]
|
||||
image_source = f"{container_format}:[{driver}@{storage_path}+/run/containers/storage]{image_id}"
|
||||
yield image_source
|
||||
|
||||
if driver == "overlay":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue