-
Notifications
You must be signed in to change notification settings - Fork 314
feat(prow-job): add JIRA export feature for test failure analysis #321
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -117,7 +117,7 @@ gcloud storage cp gs://test-platform-results/{bucket-path}/build-log.txt .work/p | |
|
|
||
| ### Step 4.5: Check for Must-Gather Availability | ||
|
|
||
| 1. **Check for --fast flag** | ||
| 1. **Parse optional flags** | ||
| - Parse user input for `--fast` flag | ||
| - If `--fast` flag present: | ||
| - Skip must-gather detection and analysis entirely | ||
|
|
@@ -357,30 +357,35 @@ Only if user chose "Yes" in Step 4.5: | |
|
|
||
| if [ -z "$OUTPUT_DIR" ]; then | ||
| echo "ERROR: Could not find output directory in unified dump" | ||
| # Skip to Step 5 | ||
| fi | ||
|
|
||
| # Move management cluster data (root level in output/) | ||
| # Exclude hostedcluster-* directories | ||
| for item in "$OUTPUT_DIR"/*; do | ||
| if [ -e "$item" ] && [[ ! "$(basename "$item")" =~ ^hostedcluster- ]]; then | ||
| mv "$item" .work/prow-job-analyze-test-failure/{build_id}/must-gather-mgmt/logs/ | ||
| rm -rf "$TMP_EXTRACT" | ||
| # Clear variables to prevent subsequent usage | ||
| HAS_HOSTED_CLUSTER="false" | ||
| unset HOSTED_DIR | ||
| unset OUTPUT_DIR | ||
| # Skip to Step 5 - no must-gather analysis possible | ||
| else | ||
| # Move management cluster data (root level in output/) | ||
| # Exclude hostedcluster-* directories | ||
| for item in "$OUTPUT_DIR"/*; do | ||
| if [ -e "$item" ] && [[ ! "$(basename "$item")" =~ ^hostedcluster- ]]; then | ||
| mv "$item" .work/prow-job-analyze-test-failure/{build_id}/must-gather-mgmt/logs/ | ||
| fi | ||
| done | ||
|
|
||
| # Move hosted cluster data (hostedcluster-* subdirectory) | ||
| if [ "$HAS_HOSTED_CLUSTER" = "true" ]; then | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is this getting set to true prior to this? I'm missing it.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
So by the time execution reaches this block (Pattern 1 extraction at line 376), the variable was already determined during archive detection. This code block at line 376 is pre-existing from PR #294 β this PR only restructured it into an |
||
| HOSTED_DIR=$(find "$OUTPUT_DIR" -maxdepth 1 -type d -name "hostedcluster-*" | head -1) | ||
| if [ -n "$HOSTED_DIR" ]; then | ||
| mv "$HOSTED_DIR"/* .work/prow-job-analyze-test-failure/{build_id}/must-gather-hosted/logs/ | ||
| echo "β Hosted cluster data extracted from unified archive" | ||
| else | ||
| echo "WARNING: Expected hosted cluster data but hostedcluster-* directory not found" | ||
| fi | ||
| fi | ||
| done | ||
|
|
||
| # Move hosted cluster data (hostedcluster-* subdirectory) | ||
| if [ "$HAS_HOSTED_CLUSTER" = "true" ]; then | ||
| HOSTED_DIR=$(find "$OUTPUT_DIR" -maxdepth 1 -type d -name "hostedcluster-*" | head -1) | ||
| if [ -n "$HOSTED_DIR" ]; then | ||
| mv "$HOSTED_DIR"/* .work/prow-job-analyze-test-failure/{build_id}/must-gather-hosted/logs/ | ||
| echo "β Hosted cluster data extracted from unified archive" | ||
| else | ||
| echo "WARNING: Expected hosted cluster data but hostedcluster-* directory not found" | ||
| fi | ||
| # Cleanup temporary extraction directory | ||
| rm -rf "$TMP_EXTRACT" | ||
| fi | ||
|
|
||
| # Cleanup temporary extraction directory | ||
| rm -rf "$TMP_EXTRACT" | ||
| ``` | ||
|
|
||
| For Pattern 2 (dual): | ||
|
|
@@ -884,6 +889,83 @@ Synthesize all gathered evidence to determine the most likely root cause for the | |
| - **Hosted cluster must-gather**: `.work/prow-job-analyze-test-failure/{build_id}/must-gather-hosted/logs/` | ||
| ``` | ||
|
|
||
| ### Step 5.5: Ask User About JIRA Export | ||
|
|
||
| After completing the analysis, ask the user if they want to export to JIRA format. | ||
|
|
||
| 1. **Ask user using AskUserQuestion tool** | ||
|
|
||
| ``` | ||
| Question: "Analysis complete! Would you like to export this to JIRA format?" | ||
| Header: "JIRA Export" | ||
| Options: | ||
| - Label: "Yes - Export to JIRA (OCPBUGS format)" | ||
| Description: "Generate JIRA-formatted output using OCPBUGS template for easy copy-paste" | ||
| - Label: "No - Skip JIRA export" | ||
| Description: "Only keep the Markdown analysis file" | ||
| ``` | ||
|
|
||
| 2. **If user chooses "Yes - Export to JIRA (OCPBUGS format)"** | ||
|
|
||
| Generate `.work/prow-job-analyze-test-failure/{build_id}/analysis-jira.txt` using OCPBUGS format: | ||
|
|
||
| ``` | ||
| Description of problem: | ||
| [Summarize the test failure in 1-2 sentences] | ||
|
|
||
| Version-Release number of selected component (if applicable): | ||
| [OpenShift version from prowjob, if available] | ||
|
|
||
| How reproducible: | ||
| [Based on test history - e.g., "Intermittent", "Always", "Sometimes in this job configuration"] | ||
|
|
||
| Steps to Reproduce: | ||
| 1. Run Prow CI job: [job-name] | ||
| 2. Execute test: [test-name] | ||
| 3. [Any specific conditions that triggered the failure] | ||
|
|
||
| Actual results: | ||
| [What actually happened - include error messages, stack traces] | ||
| {noformat} | ||
| [Stack trace or error output] | ||
| {noformat} | ||
|
|
||
| Expected results: | ||
| [What should have happened - test should pass] | ||
|
|
||
| Additional info: | ||
| [Include correlation analysis, timeline, affected components] | ||
|
|
||
| Job Details: | ||
| - Job URL: [prow-job-url] | ||
| - Build ID: {{build_id}} | ||
| - Test artifacts: {{.work/prow-job-analyze-test-failure/{build_id}/}} | ||
|
|
||
| [If must-gather was analyzed, include cluster diagnostics summary] | ||
|
|
||
| Root Cause Analysis: | ||
| [Detailed analysis from Step 5] | ||
| ``` | ||
|
|
||
| 3. **Display completion message** | ||
|
|
||
| If JIRA export chosen: | ||
| ```text | ||
| β Analysis complete! | ||
| π Reports generated: | ||
| - Markdown: .work/prow-job-analyze-test-failure/{build_id}/analysis.md | ||
| - JIRA (OCPBUGS format): .work/prow-job-analyze-test-failure/{build_id}/analysis-jira.txt | ||
|
|
||
| π‘ Tip: Copy the contents of analysis-jira.txt directly into a JIRA OCPBUGS issue | ||
| ``` | ||
|
|
||
| If JIRA export skipped: | ||
| ```text | ||
| β Analysis complete! | ||
| π Report generated: | ||
| - Markdown: .work/prow-job-analyze-test-failure/{build_id}/analysis.md | ||
| ``` | ||
|
|
||
| ## Error Handling | ||
|
|
||
| Handle errors in the same way as "Error handling" in "Prow Job Analyze Resource" skill, with these additional must-gather-specific cases: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't hold up this PR, but you could then just turn around and use the jira plugin/skills to make the OCPBUGS instead of copying into Jira manually
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea! We actually discussed this exact enhancement β adding a third option like "Yes - File a JIRA using the jira:create command" that would feed the analysis data directly into
/jira:createto file the bug automatically. Noted as a follow-up enhancement.