mirror of
https://github.com/containers/podman-compose.git
synced 2025-04-09 17:41:03 +02:00
Merge pull request #1168 from underground-software/build_exit
Properly surface errors from build commands
This commit is contained in:
commit
8b1bd0123c
@ -2613,7 +2613,7 @@ async def compose_build(compose, args):
|
|||||||
status = 0
|
status = 0
|
||||||
for t in asyncio.as_completed(tasks):
|
for t in asyncio.as_completed(tasks):
|
||||||
s = await t
|
s = await t
|
||||||
if s is not None:
|
if s is not None and s != 0:
|
||||||
status = s
|
status = s
|
||||||
|
|
||||||
return status
|
return status
|
||||||
|
0
tests/integration/build_fail_multi/__init__.py
Normal file
0
tests/integration/build_fail_multi/__init__.py
Normal file
3
tests/integration/build_fail_multi/bad/Dockerfile
Normal file
3
tests/integration/build_fail_multi/bad/Dockerfile
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
FROM busybox
|
||||||
|
|
||||||
|
RUN false
|
8
tests/integration/build_fail_multi/docker-compose.yml
Normal file
8
tests/integration/build_fail_multi/docker-compose.yml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
version: "3"
|
||||||
|
services:
|
||||||
|
bad:
|
||||||
|
build:
|
||||||
|
context: bad
|
||||||
|
good:
|
||||||
|
build:
|
||||||
|
context: good
|
3
tests/integration/build_fail_multi/good/Dockerfile
Normal file
3
tests/integration/build_fail_multi/good/Dockerfile
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
FROM busybox
|
||||||
|
#ensure that this build finishes second so that it has a chance to overwrite the return code
|
||||||
|
RUN sleep 0.5
|
@ -0,0 +1,31 @@
|
|||||||
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
|
|
||||||
|
import os
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
from tests.integration.test_utils import RunSubprocessMixin
|
||||||
|
from tests.integration.test_utils import podman_compose_path
|
||||||
|
from tests.integration.test_utils import test_path
|
||||||
|
|
||||||
|
|
||||||
|
def compose_yaml_path():
|
||||||
|
""" "Returns the path to the compose file used for this test module"""
|
||||||
|
base_path = os.path.join(test_path(), "build_fail_multi")
|
||||||
|
return os.path.join(base_path, "docker-compose.yml")
|
||||||
|
|
||||||
|
|
||||||
|
class TestComposeBuildFailMulti(unittest.TestCase, RunSubprocessMixin):
|
||||||
|
def test_build_fail_multi(self):
|
||||||
|
output, error = self.run_subprocess_assert_returncode(
|
||||||
|
[
|
||||||
|
podman_compose_path(),
|
||||||
|
"-f",
|
||||||
|
compose_yaml_path(),
|
||||||
|
"build",
|
||||||
|
# prevent the successful build from being cached to ensure it runs long enough
|
||||||
|
"--no-cache",
|
||||||
|
],
|
||||||
|
expected_returncode=1,
|
||||||
|
)
|
||||||
|
self.assertIn("RUN false", str(output))
|
||||||
|
self.assertIn("while running runtime: exit status 1", str(error))
|
Loading…
Reference in New Issue
Block a user