Open benjaoming opened 4 years ago
Same for me when attempting to build an image. Has there been some change in podman
which is not yet implemented in podman-compose
?
I use the following patch to get a fail-fast exit on a build failure:
diff --git a/podman-compose b/podman-compose
index b3ac14fa..69823aeb 100755
--- a/podman-compose
+++ b/podman-compose
@@ -684,7 +684,7 @@ class Podman:
cmd = [self.podman_path]+podman_args
return subprocess.check_output(cmd)
- def run(self, podman_args, wait=True, sleep=1):
+ def run(self, podman_args, wait=True, sleep=1, exit_on_fail=False):
podman_args_str = [str(arg) for arg in podman_args]
print("podman " + " ".join(podman_args_str))
if self.dry_run:
@@ -693,7 +693,10 @@ class Podman:
# subprocess.Popen(args, bufsize = 0, executable = None, stdin = None, stdout = None, stderr = None, preexec_fn = None, close_fds = False, shell = False, cwd = None, env = None, universal_newlines = False, startupinfo = None, creationflags = 0)
p = subprocess.Popen(cmd)
if wait:
- print(p.wait())
+ exit_code = p.wait()
+ print(exit_code)
+ if exit_on_fail and exit_code != 0:
+ exit(exit_code)
if sleep:
time.sleep(sleep)
return p
@@ -1079,7 +1082,7 @@ def build_one(compose, args, cnt):
for build_arg in args_list + args.build_arg:
build_args.extend(("--build-arg", build_arg,))
build_args.append(ctx)
- compose.podman.run(build_args, sleep=0)
+ compose.podman.run(build_args, sleep=0, exit_on_fail=True)
@cmd_run(podman_compose, 'build', 'build stack images')
def compose_build(compose, args):
Example output:
...
Lint errors found in the listed files.
STEP 9: FROM docker.io/nginxinc/nginx-unprivileged:1.18.0-alpine
Error: error building at STEP "RUN ./node_modules/@angular/cli/bin/ng lint": error while running runtime: exit status 1
125
$
Thanks for a great project! I have a
docker-compose.yml
looking like this:If
base
fails to build,podman-compose build
should exit immediately. But it just keeps building and then fails. Here's an example:Version: