Skip to content

Conversation

@NotTheEvilOne
Copy link
Contributor

What this PR does / why we need it:
This PR adds support to interact with a local podman installation.

@NotTheEvilOne NotTheEvilOne force-pushed the feature/oci-podman-interaction branch 2 times, most recently from 6d29503 to 9aff29a Compare October 2, 2025 08:54
@codecov
Copy link

codecov bot commented Oct 2, 2025

Codecov Report

❌ Patch coverage is 86.41975% with 33 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.83%. Comparing base (4165839) to head (584de78).

Files with missing lines Patch % Lines
src/gardenlinux/oci/podman.py 81.31% 17 Missing ⚠️
src/gardenlinux/oci/__main__.py 83.63% 9 Missing ⚠️
src/gardenlinux/oci/podman_context.py 92.30% 5 Missing ⚠️
src/gardenlinux/oci/container.py 92.85% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #211      +/-   ##
==========================================
- Coverage   90.22%   89.83%   -0.40%     
==========================================
  Files          42       44       +2     
  Lines        1995     2223     +228     
==========================================
+ Hits         1800     1997     +197     
- Misses        195      226      +31     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@NotTheEvilOne NotTheEvilOne force-pushed the feature/oci-podman-interaction branch from 9aff29a to 41c4a3a Compare October 2, 2025 09:14
Comment on lines +36 to +41
if logger is None or not logger.hasHandlers():
logger = LoggerSetup.get_logger("gardenlinux.oci")

self._logger = logger
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we try to use loguru instead (https://loguru.readthedocs.io/en/stable/overview.html#ready-to-use-out-of-the-box-without-boilerplate)? Standard logger requires so much dancing and results in a bunch of repeated code in many files.

Comment on lines +46 to +49
if logger is None or not logger.hasHandlers():
logger = LoggerSetup.get_logger("gardenlinux.oci")

self._logger = logger
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This boilerplate can be avoided had we used loguru :)

Comment on lines +128 to +144
def _wait_for_socket(self, sock: str):
"""
Waits for the socket file to be created.

:since: 0.11.0
"""

sock_path = Path(sock)

for _ in range(0, 5 * PODMAN_CONNECTION_MAX_IDLE_SECONDS):
if sock_path.exists():
break

sleep(0.2)

if not sock_path.exists():
raise TimeoutError()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def _wait_for_socket(self, sock: str):
"""
Waits for the socket file to be created.
:since: 0.11.0
"""
sock_path = Path(sock)
for _ in range(0, 5 * PODMAN_CONNECTION_MAX_IDLE_SECONDS):
if sock_path.exists():
break
sleep(0.2)
if not sock_path.exists():
raise TimeoutError()
@retry(stop_max_delay=PODMAN_CONNECTION_MAX_IDLE_SECONDS)
def _wait_for_socket(self, sock: str):
if not Path(sock).is_socket():
raise Exception

Copy link
Contributor

@vivus-ignis vivus-ignis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add tests. I've also added some suggestions.

@NotTheEvilOne NotTheEvilOne force-pushed the feature/oci-podman-interaction branch 4 times, most recently from 5eea9cf to 0f14ce7 Compare October 3, 2025 14:46
@NotTheEvilOne NotTheEvilOne force-pushed the feature/oci-podman-interaction branch 18 times, most recently from 4d6fba8 to 01a90ec Compare October 23, 2025 07:10
@NotTheEvilOne NotTheEvilOne force-pushed the feature/oci-podman-interaction branch 5 times, most recently from 9ac0ae9 to 0b95980 Compare October 26, 2025 12:12
Signed-off-by: Tobias Wolf <wolf@b1-systems.de>
@NotTheEvilOne NotTheEvilOne force-pushed the feature/oci-podman-interaction branch from 0b95980 to 584de78 Compare October 26, 2025 12:14
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