Skip to content
Merged
Show file tree
Hide file tree
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
32 changes: 19 additions & 13 deletions src/job/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,22 +378,12 @@ def upload_archive(self):
testresult_exists = False

if os.path.exists(self.infrabox_archive_dir):
files = self.get_files_in_dir(self.infrabox_archive_dir)

if files:
c.collect("Uploading /infrabox/upload/archive", show=True)
if self.get_files_in_dir(self.infrabox_archive_dir):
archive_exists = True
for f in files:
c.collect("%s" % f, show=True)
self.post_file_to_api_server("/archive", f, filename=f.replace(self.infrabox_upload_dir+'/', ''))

if os.path.exists(self.infrabox_testresult_dir):
files = self.get_files_in_dir(self.infrabox_testresult_dir)

if files:
if self.get_files_in_dir(self.infrabox_testresult_dir):
testresult_exists = True
for f in files:
c.collect("%s" % f, show=True)

tar_file = os.path.join(self.infrabox_upload_dir, 'all_archives' + '.tar.gz')
with tarfile.open(tar_file, mode='w:gz') as archive:
Expand All @@ -404,6 +394,12 @@ def upload_archive(self):

self.post_file_to_api_server("/archive", tar_file)

if archive_exists:
c.collect("Uploading /infrabox/upload/archive", show=True)
for f in self.get_files_in_dir(self.infrabox_archive_dir):
c.collect("%s" % f, show=True)
self.post_file_to_api_server("/archive", f, filename=f.replace(self.infrabox_upload_dir+'/', ''))


def upload_coverage_results(self):
if not os.path.exists(self.infrabox_coverage_dir):
Expand Down Expand Up @@ -501,16 +497,24 @@ def _get_size(self, start_path):
return total_size

def finalize_upload(self):
self.upload_archive()
self.upload_coverage_results()
self.upload_test_results()
self.upload_markup_files()
self.upload_badge_files()
self.upload_archive()

def handle_abort(self, signum, sigframe):
if not self.aborted:
self.aborted = True
self.console.collect("##Aborted", show=True)
if hasattr(self, '_compose_file_new'):
try:
subprocess.call(
['docker-compose', '-f', self._compose_file_new, 'stop', '--timeout', '30'],
env=self.environment,
timeout=35)
except Exception:
pass
self.finalize_upload()

def main_run_job(self):
Expand Down Expand Up @@ -722,6 +726,8 @@ def run_job_docker_compose(self, c):
with open(compose_file_new, "w+") as out:
json.dump(compose_file_content, out)

self._compose_file_new = compose_file_new

collector = StatsCollector()

self._login_source_registries()
Expand Down
2 changes: 1 addition & 1 deletion src/scheduler/kubernetes/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ def _sync(self, fi):
'automountServiceAccountToken': False,
'containers': containers,
'restartPolicy': 'Never',
'terminationGracePeriodSeconds': 60,
'terminationGracePeriodSeconds': 180,
'volumes': f['spec']['volumes'],
'imagePullSecrets': f['spec'].get('imagePullSecrets', None)
},
Expand Down
Loading