Skip to content

Commit

Permalink
Both Docker and Podman images are now reported with their right proce…
Browse files Browse the repository at this point in the history
…ssor architecture and operating system.

This one is related to issue #34
  • Loading branch information
jmfernandez committed Jun 7, 2023
1 parent bd23120 commit 732e267
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
1 change: 1 addition & 0 deletions wfexs_backend/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,7 @@ class Container(NamedTuple):
taggedName: "URIType"
type: "ContainerType"
architecture: "Optional[ProcessorArchitecture]" = None
operatingSystem: "Optional[ContainerOperatingSystem]" = None
localPath: "Optional[AbsPath]" = None
signature: "Optional[Fingerprint]" = None
fingerprint: "Optional[Fingerprint]" = None
Expand Down
8 changes: 8 additions & 0 deletions wfexs_backend/docker_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,13 +488,21 @@ def materializeContainers(
else:
containerPath = localContainerPath

# Learning about the intended processor architecture and variant
architecture = manifest.get("Architecture")
if architecture is not None:
variant = manifest.get("Variant")
if variant is not None:
architecture += "/" + variant
# And add to the list of containers
containersList.append(
Container(
origTaggedName=tag,
taggedName=cast("URIType", dockerTag),
signature=tagId,
fingerprint=fingerprint,
architecture=architecture,
operatingSystem=manifest.get("Os"),
type=self.containerType,
localPath=containerPath,
)
Expand Down
9 changes: 9 additions & 0 deletions wfexs_backend/podman_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,13 +504,22 @@ def materializeContainers(
else:
containerPath = localContainerPath

# Learning about the intended processor architecture and variant
architecture = manifest.get("Architecture")
# As of version 4.5.0, podman does not report the architecture variant
if architecture is not None:
variant = manifest.get("Variant")
if variant is not None:
architecture += "/" + variant
# And add to the list of containers
containersList.append(
Container(
origTaggedName=tag,
taggedName=cast("URIType", dockerTag),
signature=tagId,
fingerprint=fingerprint,
architecture=architecture,
operatingSystem=manifest.get("Os"),
type=self.containerType,
localPath=containerPath,
)
Expand Down
7 changes: 5 additions & 2 deletions wfexs_backend/ro_crate.py
Original file line number Diff line number Diff line change
Expand Up @@ -960,8 +960,11 @@ def add_containers_to_workflow(
)

software_container["softwareVersion"] = container.fingerprint
if containerEngineOs is not None:
software_container["operatingSystem"] = containerEngineOs
container_os = container.operatingSystem
if container_os is None:
container_os = containerEngineOs
if container_os is not None:
software_container["operatingSystem"] = container_os
# Getting the processor architecture of the container
container_arch = container.architecture
if container_arch is None:
Expand Down

0 comments on commit 732e267

Please sign in to comment.