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

Show stdout + stderr from CalledProcessError #333

Closed
Zlopez opened this issue Jun 9, 2021 · 0 comments · Fixed by #342
Closed

Show stdout + stderr from CalledProcessError #333

Zlopez opened this issue Jun 9, 2021 · 0 comments · Fixed by #342
Milestone

Comments

@Zlopez
Copy link
Contributor

Zlopez commented Jun 9, 2021

When command fails, it would be nice to have stdout and stderr attached to bugzilla. We could handle this in scratch_build_use_case.

Bellow is the example from log:

[2021-06-09 01:00:44,852 hotness.hotness_consumer INFO] Handling anitya msg 'd6ebf98a-c82b-41ea-9c57-da54f712f667'
[2021-06-09 01:00:47,371 hotness.validators.mdapi INFO] Comparing upstream 5.22.0 against repo 5.15.1-1.fc30
[2021-06-09 01:00:47,372 hotness.validators.mdapi INFO] 5.22.0 is newer than 5.15.1-1.fc30
[2021-06-09 01:00:48,751 hotness.notifiers.bugzilla INFO] There is already bug opened for previous version ''https://partner-bugzilla.redhat.com/show_bug.cgi?id=1676593'' . Let's update this one.
[2021-06-09 01:00:49,608 hotness.notifiers.bugzilla INFO] Updated bug: 1676593
[2021-06-09 01:00:49,609 hotness.notifiers.fedora_messaging INFO] publishing topic 'hotness.update.bug.file'
[2021-06-09 01:00:49,707 hotness.builders.koji INFO] Cloning 'https://src.fedoraproject.org/rpms/plymouth-kcm.git'  to '/var/tmp/thn-erp9ki3e'
./plymouth-kcm-5.22.0.tar.xz already exists, skipping download
[2021-06-09 01:00:51,232 hotness.builders.koji INFO] Creating a new Koji session to https://koji.stg.fedoraproject.org/kojihub 
[2021-06-09 01:00:51,283 hotness.builders.koji INFO] Uploading /var/tmp/thn-erp9ki3e/./SRPMS/plymouth-kcm-5.22.0-1.fc32.src.rpm to koji
[2021-06-09 01:00:51,309 hotness.builders.koji INFO] Intiating koji build for {'name': 'plymouth-kcm', 'target': 'rawhide', 'source': 'cli-build/1623200451.283134.oFqvsMbf/plymouth-kcm-5.22.0-1.fc32.src.rpm', 'opts': {'scratch': True}}
[2021-06-09 01:00:51,324 hotness.builders.koji INFO] Scratch build created for plymouth-kcm: https://koji.stg.fedoraproject.org/koji/taskinfo?taskID=90004029 
[2021-06-09 01:00:51,345 hotness.use_cases.package_scratch_build_use_case ERROR] Package scratch build use case failure
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/hotness/use_cases/package_scratch_build_use_case.py", line 56, in build
    result = self.builder.build(request.package, request.opts)
  File "/usr/local/lib/python3.8/site-packages/hotness/builders/koji.py", line 174, in build
    sp.check_output(
  File "/usr/lib64/python3.8/subprocess.py", line 415, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib64/python3.8/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['git', 'commit', '-a', '-m', 'Update to 5.22.0 (#1676593)']' returned non-zero exit status 1.
[2021-06-09 01:00:51,345 hotness.notifiers.bugzilla INFO] Bug id provided. Updating 1676593
[2021-06-09 01:00:52,126 hotness.notifiers.bugzilla INFO] Updated bug: 1676593
@Zlopez Zlopez added this to the 1.0 milestone Jun 9, 2021
Zlopez added a commit to Zlopez/the-new-hotness that referenced this issue Aug 2, 2021
This commit adds stdout and stderr output (if available)
to bugzilla ticket when error in build happens with traceback if
available.

It also adds the link to the-new-hotness issue tracker to this ticket,
so packagers knows where to report these issues.

Closes fedora-infra#333

Signed-off-by: Michal Konečný <mkonecny@redhat.com>
Zlopez added a commit to Zlopez/the-new-hotness that referenced this issue Aug 2, 2021
This commit adds additional attributes to ResponseFailure class.
* std_out and std_err for BuilderException - this will allow us to print
  stdout and stderr from CalledProcessError to bugzilla issue
* output for BuilderException - this will help us to be able to print
  build link in the future
* traceback - to be able to print traceback in the bugzilla ticket so
  packagers could report the issue

This information are added as comment to bugzilla ticket whenewer the
build fails.

The build failure now also contains a link to the-new-hotness issue
tracker, so it will be easier for packagers to report new issues in the
future.

Closes fedora-infra#333

Signed-off-by: Michal Konečný <mkonecny@redhat.com>
Zlopez added a commit that referenced this issue Aug 2, 2021
This commit adds additional attributes to ResponseFailure class.
* std_out and std_err for BuilderException - this will allow us to print
  stdout and stderr from CalledProcessError to bugzilla issue
* output for BuilderException - this will help us to be able to print
  build link in the future
* traceback - to be able to print traceback in the bugzilla ticket so
  packagers could report the issue

This information are added as comment to bugzilla ticket whenewer the
build fails.

The build failure now also contains a link to the-new-hotness issue
tracker, so it will be easier for packagers to report new issues in the
future.

Closes #333

Signed-off-by: Michal Konečný <mkonecny@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant