Skip to content

Commit

Permalink
add logs in osbs build log to indicate platform specific
Browse files Browse the repository at this point in the history
build has started

* CLOUDBLD-10692

Signed-off-by: Harsh Modi <hmodi@redhat.com>
  • Loading branch information
hjmodi committed Aug 22, 2022
1 parent 1c69519 commit b0515e8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions koji_containerbuild/plugins/builder_containerbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,10 @@ def _write_logs(self, build_id, logs_dir, platforms: list = None):
if (task_platform != 'noarch') and (task_platform not in final_platforms):
continue

if task_platform != 'noarch':
logfiles['noarch'].write(bytearray(f'{task_platform} build has started. '
'Check platform specific logs\n', 'utf-8'))

log_filename = f'{task_platform}.log'
logfiles[task_platform] = open(os.path.join(logs_dir, log_filename),
'wb')
Expand Down
12 changes: 11 additions & 1 deletion tests/test_builder_containerbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ def check_meta_entry(filename):
else:
if task_platform != 'noarch':
log_filename = f'{task_platform}'
if log_filename not in log_contents:
log_contents[log_name] = '{old}{new}\n'.format(
old=log_contents.get(log_name, ''),
new=f'{task_platform} build has started. '
'Check platform specific logs')
else:
log_filename = log_name
log_contents[log_filename] = '{old}{new}\n'.format(
Expand Down Expand Up @@ -203,7 +208,12 @@ def test_write_logs(self, tmpdir, get_logs_exc, build_not_finished, final_platfo

koji_tmpdir = tmpdir.mkdir('koji')
koji_tmpdir.join('x.log').write('line 1\n'
'line 2\n')
'line 2\n'
'x86_64 build has started. Check platform specific logs\n'
's390x build has started. Check platform specific logs\n'
'ppc64le build has started. Check platform specific logs\n'
'aarch64 build has started. Check platform specific logs\n'
)

(flexmock(koji.pathinfo)
.should_receive('work')
Expand Down

0 comments on commit b0515e8

Please sign in to comment.