kiwi: upload log for failed tasks

Related: https://pagure.io/koji/issue/3597
This commit is contained in:
Tomas Kopecek 2022-11-22 14:42:39 +01:00
parent ec3fc564c5
commit 0372a8e6a4
2 changed files with 10 additions and 9 deletions

View file

@ -371,19 +371,22 @@ class KiwiCreateImageTask(BaseBuildTask):
desc, types = self.prepareDescription(path, name, version, repos, arch)
self.uploadFile(desc)
target_dir = '/builddir/result/image'
root_log_path = os.path.join(broot.rootdir(), target_dir[1:], "build/image-root.log")
root_log_remote_name = f"image-root.{arch}.log"
cmd = ['kiwi-ng']
if self.opts.get('profile'):
cmd.extend(['--profile', self.opts['profile']])
if self.opts.get('type'):
cmd.extend(['--type', self.opts['type']])
target_dir = '/builddir/result/image'
cmd.extend([
'--kiwi-file', os.path.basename(desc), # global option for image/system commands
'system', 'build',
'--description', os.path.join(os.path.basename(scmsrcdir), base_path),
'--target-dir', target_dir,
])
rv = broot.mock(['--cwd', broot.tmpdir(within=True), '--chroot', '--'] + cmd)
rv = broot.mock(['--cwd', broot.tmpdir(within=True), '--chroot', '--'] + cmd,
additional_logs={root_log_remote_name: root_log_path})
if rv:
raise koji.GenericError("Kiwi failed")
@ -410,12 +413,6 @@ class KiwiCreateImageTask(BaseBuildTask):
'files': [],
}
# TODO: upload detailed log?
# build/image-root.log
root_log_path = os.path.join(broot.tmpdir(), target_dir[1:], "build/image-root.log")
if os.path.exists(root_log_path):
self.uploadFile(root_log_path, remoteName=f"image-root.{arch}.log")
bundle_path = os.path.join(broot.rootdir(), bundle_dir[1:])
for fname in os.listdir(bundle_path):
self.uploadFile(os.path.join(bundle_path, fname), remoteName=fname)