podman-compose icon indicating copy to clipboard operation
podman-compose copied to clipboard

podman-compose build exits 0 when build fails

Open OneMoreByte opened this issue 2 years ago • 6 comments

Hello!

I have been using podman-compose for a bit and love it but I noticed that when I run podman-compose build it always exits 0 regardless of if the build failed or not.

It does print out the exit code of the underlying podman command but I don't want to parse the output for that. Would it be possible to have the build command exit with the underlying exit code if it runs into a failure?

I have my local version of podman-compose patched with:

obj = types.SimpleNamespace()
compose.podman.run([], "build", build_args, sleep=0, obj=obj)
if obj.exit_code != 0:
  sys.exit(obj.exit_code)

on https://github.com/containers/podman-compose/blob/devel/podman_compose.py#L1898. I'm not sure if there's a better solution.

OneMoreByte avatar Apr 15 '22 21:04 OneMoreByte

Hi, we're running into the same issue, is there an expected fix for this?

rsevilla87 avatar May 25 '22 14:05 rsevilla87

This is not an enhacement, this is a bug

morenod avatar May 25 '22 14:05 morenod

Facing this behavior as well, pretty inconsistent when podman-compose is being used in CI workflows.

defanator avatar Jul 17 '22 10:07 defanator

@muayyad-alsadi Are you considering PR #521 or is that now how you'd perfer podman-compose to work?

OneMoreByte avatar Jul 28 '22 14:07 OneMoreByte

What is worse, podman-compose up --build continues even though the build fails for one image, and it starts the old version of the image and to figure that out I'd just have to keep eye on whatever output podman-compose spits out

ztane avatar Aug 26 '22 08:08 ztane

This affects our efforts to have the same recipes for running services in both Docker and Podman as we migrate. It also makes debugging significantly more difficult, because if the image fails to build, then typically Podman will also fail for a different reason, such as the container not being present.

BrianHVB avatar Oct 02 '23 19:10 BrianHVB