-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Feat podman runner #17786
base: develop2
Are you sure you want to change the base?
Feat podman runner #17786
Conversation
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("\\","/") |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
#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) |
There was a problem hiding this comment.
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
.
_, 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()) |
There was a problem hiding this comment.
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.
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
intorunner/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.
develop
branch, documenting this one.Closes #17743