Fix handle_failure() crash when assembly report is missing - #3150
Fix handle_failure() crash when assembly report is missing#3150redhat-chai-bot wants to merge 1 commit into
Conversation
When doozer crashes early (e.g. OSError from assembly_inspector), the assembly report file gen-payload-artifacts/assembly-report.yaml is never generated. This caused handle_failure() to crash with FileNotFoundError via get_unpermissable_assembly_issues(), preventing Slack notifications and Jenkins title updates from running. Two fixes: 1. Guard get_unpermissable_assembly_issues() against missing/empty file: add os.path.exists() check before opening; add null check for data from yaml.safe_load; move return outside the 'assembly_issues' key check to avoid implicit None return. 2. Wrap the assembly report analysis block in handle_failure() with try/except as a safety net, so any unexpected error in that path still results in a proper failure report and Jenkins title update. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: openshift-eng/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
WalkthroughAssembly report analysis now handles missing or empty YAML safely, preserves permitted-issue filtering, and prevents analysis failures from interrupting Jenkins failure handling. ChangesAssembly report resilience
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 10 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (10 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@redhat-chai-bot: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Problem
When doozer crashes early in
build-sync-konflux(e.g.OSError: RPM openshift-ansible claims to have a rhel-8 build target, but no build was detected), the assembly report filegen-payload-artifacts/assembly-report.yamlis never generated. Thehandle_failure()method then crashes withFileNotFoundErrorwhenget_unpermissable_assembly_issues()tries to open the missing file. This secondary crash prevents:#openshift-{version}or#forum-ocp-release[UNVIABLE]/[FAILURE]ChildProcessErrorfrom being cleanly re-raisedFix
1. Guard
get_unpermissable_assembly_issues()against missing fileos.path.exists()check before opening the file{'assembly_issues': {}}with a warning when file is missingdatafromyaml.safe_load()(could returnNonefor empty files)return filtered_issuesoutside theif 'assembly_issues' in data:block to fix implicitNonereturn2. Safety net in
handle_failure()try/except Exceptionso notification logic always runs even if report analysis fails unexpectedlyVerification
Tested with
build-sync-konflux#25999 usingART_TOOLS_COMMIT=redhat-chai-bot@fix-build-sync-handle-failure:[FAILURE](was missing before)WARNING Assembly report file not foundlogged (instead ofFileNotFoundErrorcrash)Failure count for 5.0: 10— counter incrementedChildProcessError(no secondary exception)Fixes: ART-21634
@locriandev requested in Slack thread
Summary by CodeRabbit