Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring code for podman support #234

Draft
wants to merge 11 commits into
base: dev
Choose a base branch
from
Draft

Conversation

D3vil0p3r
Copy link

@D3vil0p3r D3vil0p3r commented Oct 24, 2024

Description

Refactoring code to support Podman

Point of attention

TO DO

  • DockerUtils.py:

    • Adapt the right api.pull/build/remove_volume function to podman: [FEATURE] - Add pull/build/remove_volume function for api/image.py as docker py containers/podman-py#456
    • In podman-py listing and filtering image list not working properly: [BUG] images.list() filter does not work properly containers/podman-py#457
    •     for img in images:
              # len tags = 0 handle exegol <none> images (nightly image lost their tag after update)
              if len(img.attrs.get('RepoTags', [])) == 0 or \
                      ConstantConfig.IMAGE_NAME in [repo_tag.split(':')[0] for repo_tag in img.attrs.get("RepoTags", [])]:
                  result.append(img)
                  ids.add(img.id)
      ConstantConfig.IMAGE_NAME in [repo_tag.split(':')[0] for repo_tag in img.attrs.get("RepoTags", [])]: does not manage well cases where user pulled manually exegol image containing also the registry name, for example docker.io/nwodtuhs/exegol. In this scenario, it won't enter in if statement. It is needed to add any to manage cases where locally I have more container images. [Fixed in PR]
  • ExegolImage.py:

    •  def __parseDigest(docker_image: Union[DockerImage, PodmanImage]) -> str:
           """Parse the remote image digest ID.
           Return digest id from the docker object."""
           for digest_id in docker_image.attrs["RepoDigests"]:
               print(digest_id)
               if digest_id.startswith(ConstantConfig.IMAGE_NAME):  # Find digest id from the right repository
                   return digest_id.split('@')[1]
           return ""

      As above, cannot enter in if statement in case user pulled manually an image by specifying docker.io. Need to use in instead of startswith. [Fixed in PR]

      Evaluate if it is needed to manage if statements involving ConstantConfig.IMAGE_NAME in other files to manage the presence of prefix docker.io in the image name.

  • ExegolController.py - Import podman and manage console.print_exception(show_locals=True, suppress=[docker, requests, git]) to consider podman module too.

  • ConstantConfig.py:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant