Skip to content

Conversation

@NotTheEvilOne
Copy link
Contributor

@NotTheEvilOne NotTheEvilOne commented Oct 2, 2025

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

Which issue(s) this PR fixes:
Closes #199
Closes #200

@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 87.11656% with 42 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.18%. Comparing base (9bc3c1f) to head (67d413d).

Files with missing lines Patch % Lines
src/gardenlinux/oci/podman.py 81.30% 23 Missing ⚠️
src/gardenlinux/oci/__main__.py 86.02% 13 Missing ⚠️
src/gardenlinux/oci/container.py 91.17% 3 Missing ⚠️
src/gardenlinux/oci/podman_context.py 95.52% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #211      +/-   ##
==========================================
- Coverage   91.54%   91.18%   -0.36%     
==========================================
  Files          42       44       +2     
  Lines        2070     2372     +302     
==========================================
+ Hits         1895     2163     +268     
- Misses        175      209      +34     

☔ 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
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 4 times, most recently from 677b956 to 0915535 Compare November 28, 2025 17:00
@NotTheEvilOne NotTheEvilOne force-pushed the feature/oci-podman-interaction branch 12 times, most recently from 7aa9d6a to 7029e14 Compare December 17, 2025 08:03
Signed-off-by: Tobias Wolf <wolf@b1-systems.de>
@NotTheEvilOne NotTheEvilOne force-pushed the feature/oci-podman-interaction branch from 7029e14 to b9039cc Compare December 17, 2025 13:24
@NotTheEvilOne
Copy link
Contributor Author

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

Code is now ready for review, I would highly appreciate your feedback @vivus-ignis.

@NotTheEvilOne NotTheEvilOne marked this pull request as ready for review December 17, 2025 15:45
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.

The code looks good to me, but the user experience of the gl-oci has a room for improvements. It's not obvious what is this tool is for in general and how to use it (see my comments on naming).

#!/usr/bin/env python3

"""
gl-oci main entrypoint
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please replace this docstring with some useful description of what this script does? Because this text is displayed in click's autogenerated help message. Just a sentence for someone who has no idea about the codebase.

"""
Build an OCI container based on the defined `Containerfile`.
:since: 1.0.0
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the point in this since metadata line? What this '1.0.0' version relates to?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Docstring "since" is used to document since when a class, method or function has been added to the codebase.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, that is obvious, but what '1.0.0' refers to?

)
def pull_container(container: str, tag: str, platform: str, insecure: bool) -> None:
"""
Push to an OCI registry.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe pull?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"pull" would usually work as well. As we have "push" as well and are able to push multiple data like containers, metadata etc. it seems to be confusing to "pull" something. Therefore "container" has been added here for naming convention reasons as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean your function is called "pull_container" but in the docstring you write "Push".

default=False,
help="Use HTTP to communicate with the registry",
)
def pull_container(container: str, tag: str, platform: str, insecure: bool) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

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

When I try to run it like this:

$ poetry run gl-oci pull-container --container foo --tag ubuntu:16.04

the output is "None". I think there's a room for improvement for user interaction and error message (I'm not even sure if "None" here is considered an error).
And, as I said, naming needs more attention. Examples in help output would also help.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This sounds like a bug, will have a look at it.

Copy link
Contributor Author

@NotTheEvilOne NotTheEvilOne Dec 19, 2025

Choose a reason for hiding this comment

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

Can't reproduce it. I get podman.errors.exceptions.APIError: 500 Server Error: Internal Server Error ({"message":"invalid reference format"}.

Could it be that podman is not installed on your system. If I remember correctly this is catched in the code as well thought. Will dig deeper.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On a system without podman the error is: FileNotFoundError: [Errno 2] No such file or directory: 'podman'. Please provide more information when you get the output None. Please note that the correct arguments would be:

$ poetry run gl-oci pull-container --container ubuntu --tag 16.04

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got None if a valid argument is used for pull.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's better to have no output than print "None" as it is confusing for a user.

Signed-off-by: Tobias Wolf <wolf@b1-systems.de>
On-behalf-of: SAP <tobias.wolf@sap.com>
Signed-off-by: Tobias Wolf <wolf@b1-systems.de>
On-behalf-of: SAP <tobias.wolf@sap.com>
@NotTheEvilOne NotTheEvilOne force-pushed the feature/oci-podman-interaction branch from 0dbdc21 to 67d413d Compare December 20, 2025 14:00
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.

Analyse existing possibilities to push OCI images tagged in podman locally Add support to create a image manifest with given container tags

4 participants