Skip to content
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

Resolving issue - #35 - Error display when docker-build perform #227

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions src/rocker/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,12 @@ def get_docker_client():

def docker_build(docker_client = None, output_callback = None, **kwargs):
image_id = None
build_success = False
error_message = []

if not docker_client:
docker_client = get_docker_client()

kwargs['decode'] = True
for line in docker_client.build(**kwargs):
output = line.get('stream', '').rstrip()
Expand All @@ -150,12 +153,16 @@ def docker_build(docker_client = None, output_callback = None, **kwargs):
match = re.match(r'Successfully built ([a-z0-9]{12})', output)
if match:
image_id = match.group(1)

if image_id:
build_success = True
elif "error" in output.lower():
error_message.append(output)


if build_success:
return image_id
else:
print("no more output and success not detected")
return None
error_msg = "\n".join(error_message)
raise Exception(f"Build failed:\n{error_msg}")


class SIGWINCHPassthrough(object):
Expand Down