Skip to content

Feat podman runner#17786

Draft
dyamon wants to merge 3 commits intoconan-io:develop2from
dyamon:feat-podman-runner
Draft

Feat podman runner#17786
dyamon wants to merge 3 commits intoconan-io:develop2from
dyamon:feat-podman-runner

Conversation

@dyamon
Copy link
Copy Markdown

@dyamon dyamon commented Feb 14, 2025

Changelog: (Feature): Add podman runner
Docs: https://github.com/conan-io/docs/pull/XXXX (TBD)

The first commit of the pull request is a plain copy of runner/docker.py into runner/podman.py. This makes the second commit an actual overview of the differences between the two runners.

I'm leaving a couple of comments on the code to highlight some potential issue with this runner. Then, I guess, we can move to tests and documentation.

  • I've read the Contributing guide.
  • I've followed the PEP8 style guides for Python code.
  • I've opened another PR in the Conan docs repo to the develop branch, documenting this one.

Closes #17743

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Feb 14, 2025

CLA assistant check
All committers have signed the CLA.

Comment on lines +110 to +112
self.podman_user_name = self.configfile.run.user or 'root'
self.podman_user_home = f'/{"home/" if self.podman_user_name != "root" else ""}{self.podman_user_name}'
self.abs_podman_path = os.path.join(f'{self.podman_user_home}/conanrunner', os.path.basename(self.abs_host_path)).replace("\\","/")
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Here I'm placing the conanrunner folder in the user home. This is slightly different from what is done for the docker runner.

workdir = workdir or self.abs_podman_path
if log:
_podman_info(f'Running in container: "{command}"')
_, exec_output = self.container.exec_run(f"/bin/bash -c '{command}'", stream=True, workdir=workdir, demux=True)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Here, if I add tty=True, no output is returned. Can't really tell why.

Comment on lines +222 to +224
#exit_metadata = self.docker_api.exec_inspect(exec_instance['Id'])
#if exit_metadata['Running'] or exit_metadata['ExitCode'] > 0:
# raise RunnerException(command=command, stdout_log=stdout_log, stderr_log=stderr_log)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

There seems to be no way to check for the command exit code while using stream=True.

Comment on lines +185 to +197
_, podman_build_logs = self.podman_client.images.build(
dockerfile=dockerfile_file_path,
path=build_path,
tag=self.image,
buildargs=self.configfile.build.build_args,
cache_from=self.configfile.build.cache_from,
)
for chunk in podman_build_logs:
for line in chunk.decode("utf-8").split('\r\n'):
if line:
stream = json.loads(line).get('stream')
if stream:
ConanOutput().status(stream.strip())
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

No streaming of the output here. The output of the build command is spit out all at once.

@perseoGI perseoGI self-assigned this Feb 19, 2025
@samuel-emrys
Copy link
Copy Markdown
Contributor

Where is this one at @dyamon ? This is a feature that I'd find useful so keen for it to make it in. Is it worth unmarking this as draft?

@dyamon
Copy link
Copy Markdown
Author

dyamon commented Aug 29, 2025

@samuel-emrys hey, I guess I was looking for some feedback on the comments I left. Honestly it works for me but it still needs testing and documentation. Did you get the chance to try it?

@perseoGI
Copy link
Copy Markdown
Contributor

perseoGI commented Sep 1, 2025

Hi @samuel-emrys,

Thank you very much for your contribution to Conan! 🙌

We had a look at your PR when it was opened and it looks very promising. At the moment, we’re focusing on finalizing and merging the next runners in our roadmap (SSH and WSL). In parallel, we’d like to gather more feedback from users of the existing Docker runner and make some refinements to it before introducing additional runners.

For that reason, we’d prefer to hold off on adding new ones until the current implementation is more mature. We really appreciate your effort and initiative here, and we hope you understand the reasoning. Your contribution is valuable, and we’d be happy to revisit this once the Docker runner stabilizes further.

Thanks again for your patience and support!

@samuel-emrys
Copy link
Copy Markdown
Contributor

@perseoGI would love to take credit for this work but it was @dyamon who put in the hard yards to bring this together.

The response is a bit of a shame though - RHEL doesn't ship with docker by default; it ships with podman, so it would have been good to have support for those enterprise environments that rely on RHEL.

Is there a way that runners can be provided as extensions to allow us to manage these independently of the conan client?

@perseoGI
Copy link
Copy Markdown
Contributor

perseoGI commented Sep 1, 2025

runners can be provided as extensions to allow us to manage these independently of the conan client?

Greetings,
This could be a good idea, this will allow users manage and create their custom runners without having to wait for a native solution (because, in some cases, we would not be able, due to different reasons and lack of bandwidth, to deliver most of the runners users desire).

I'll propose this idea in our next "look intos", thank you!

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.

[feature] Podman runner

4 participants