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 2 commits into
base: dev
Choose a base branch
from

Conversation

D3vil0p3r
Copy link

@D3vil0p3r D3vil0p3r commented Oct 24, 2024

Description

Refactoring code to support Podman

Point of attention

TO DO

  • DockerUtils.py:

  • ExegolImage.py:

    • [FIXED]

      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.

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

  • ConstantConfig.py:

@Dramelac
Copy link
Member

Hello

Thanks for this PR, it is indeed a more complete approach to integrate podman in a stable way in Exegol.
A few comments:

  • for the filter, you should test whether “docker.io/” would not be necessary in the current version of the lib.
  • the way DockerUtils tries to load docker or podman doesn't seem right to me, as the original exceptions are caught in the __connect_to_[...] function and therefore never retrieved by the __handle_connection_error function
  • your branch is not up to date with the dev version (which should soon be a new release), there are conflicts to manage
  • is the fact that the podman lib is the same as the docker lib done on purpose? aren't there risks of divergence at times?

Thanks in any case for your help with this integration, there will be a lot of testing to do to make sure everything is compatible with podman and exegol before officially integrating it into the project, but it's certainly a very good starting point.

@D3vil0p3r
Copy link
Author

D3vil0p3r commented Oct 27, 2024

I'll try to give answer

  • for the filter, you should test whether “docker.io/” would not be necessary in the current version of the lib.

FIXED on podman-py upstream. I wouldn't suggest to add docker.io on IMAGE_NAME constant. I would keep it as is because docker does not add that registry name, and adding it could break some if statements.

  • the way DockerUtils tries to load docker or podman doesn't seem right to me, as the original exceptions are caught in the __connect_to_[...] function and therefore never retrieved by the __handle_connection_error function

FIXED. PS: in the future DockerUtils can be renamed as ContainerUtils.

  • your branch is not up to date with the dev version (which should soon be a new release), there are conflicts to manage

FIXED. Meanwhile I try to align it with dev branch over time.

  • is the fact that the podman lib is the same as the docker lib done on purpose? aren't there risks of divergence at times?

Not all functions are the same. The risk of divergence depends on how we will adapt podman on Exegol. On this PR we are not using Docker Py functions to manage podman daemon, but we are invoking original Podman Py libs to manage its daemon.

Overall, before to continue to work on this PR, I think we need to wait for those issues/PRs I opened on Podman Py project.

@D3vil0p3r D3vil0p3r force-pushed the patch-1 branch 7 times, most recently from b4f83e7 to 008d6fc Compare December 19, 2024 13:43
@D3vil0p3r D3vil0p3r force-pushed the patch-1 branch 3 times, most recently from c3b6486 to e331d70 Compare December 20, 2024 03:10
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.

2 participants