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

Docker build sometimes produces empty stdout.log #522

Open
MakisH opened this issue Apr 13, 2024 · 0 comments
Open

Docker build sometimes produces empty stdout.log #522

MakisH opened this issue Apr 13, 2024 · 0 comments

Comments

@MakisH
Copy link
Member

MakisH commented Apr 13, 2024

See comments in #521 (comment)

I have not yet understood under which situations this happens. The relevant code is here:

def _build_docker(self):
"""
Builds the docker image
"""
logging.debug(f"Building docker image for {self}")
time_start = time.perf_counter()
docker_compose_content = self.__get_docker_compose_file()
with open(self.system_test_dir / "docker-compose.tutorial.yaml", 'w') as file:
file.write(docker_compose_content)
stdout_data = []
stderr_data = []
try:
# Execute docker-compose command
process = subprocess.Popen(['docker',
'compose',
'--file',
'docker-compose.tutorial.yaml',
'build'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
start_new_session=True,
cwd=self.system_test_dir)
try:
stdout, stderr = process.communicate(timeout=GLOBAL_TIMEOUT)
except KeyboardInterrupt as k:
process.kill()
# process.send_signal(9)
raise KeyboardInterrupt from k
except Exception as e:
logging.critical(
f"systemtest {self} had serious issues building the docker images via the `docker compose build` command. About to kill the docker compose command. Please check the logs! {e}")
process.communicate(timeout=SHORT_TIMEOUT)
process.kill()
stdout_data.extend(stdout.decode().splitlines())
stderr_data.extend(stderr.decode().splitlines())
elapsed_time = time.perf_counter() - time_start
return DockerComposeResult(process.returncode, stdout_data, stderr_data, self, elapsed_time)
except Exception as e:
logging.critical(f"Error executing docker compose build command: {e}")
elapsed_time = time.perf_counter() - time_start
return DockerComposeResult(1, stdout_data, stderr_data, self, elapsed_time)

In the same context, it would be nice if the Docker build output was always archived, even in case it succeeds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants