Skip to content

Commit 8971798

Browse files
committed
fix(DM01-5918): gracefully stop docker-compose containers before archive upload on timeout
1 parent f8fcb19 commit 8971798

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/job/job.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,14 @@ def handle_abort(self, signum, sigframe):
511511
if not self.aborted:
512512
self.aborted = True
513513
self.console.collect("##Aborted", show=True)
514+
if hasattr(self, '_compose_file_new'):
515+
try:
516+
subprocess.call(
517+
['docker-compose', '-f', self._compose_file_new, 'stop', '--timeout', '30'],
518+
env=self.environment,
519+
timeout=35)
520+
except Exception:
521+
pass
514522
self.finalize_upload()
515523

516524
def main_run_job(self):
@@ -722,6 +730,8 @@ def run_job_docker_compose(self, c):
722730
with open(compose_file_new, "w+") as out:
723731
json.dump(compose_file_content, out)
724732

733+
self._compose_file_new = compose_file_new
734+
725735
collector = StatsCollector()
726736

727737
self._login_source_registries()

0 commit comments

Comments
 (0)