Skip to content

Commit fce4a6c

Browse files
committed
fix[fuzz]: longer retention for outputs
Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
1 parent af55eba commit fce4a6c

File tree

4 files changed

+96
-0
lines changed

4 files changed

+96
-0
lines changed

.github/scripts/fuzz_report/cli.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414

1515
TEMPLATES_DIR = Path(__file__).parent / "templates"
1616

17+
# Variables that must be set (non-empty) before creating or commenting on an issue.
18+
REQUIRED_REPORT_VARIABLES = ["FUZZ_TARGET", "CRASH_FILE", "ARTIFACT_URL"]
19+
1720

1821
def parse_var_arg(var_str: str) -> tuple[str, str]:
1922
"""Parse a -v KEY=VALUE argument into (key, value)."""
@@ -142,6 +145,16 @@ def cmd_check_duplicate(args: argparse.Namespace) -> int:
142145
return 0
143146

144147

148+
def _validate_required_variables(variables: dict[str, str]) -> list[str]:
149+
"""Return the names of any required variables that are missing or empty."""
150+
missing = []
151+
for name in REQUIRED_REPORT_VARIABLES:
152+
val = variables.get(name, "")
153+
if not val or val == "(not set)":
154+
missing.append(name)
155+
return missing
156+
157+
145158
def cmd_report(args: argparse.Namespace) -> int:
146159
"""Create or comment on a GitHub issue based on crash + dedup results."""
147160
if not Path(args.crash_info).exists():
@@ -163,6 +176,18 @@ def cmd_report(args: argparse.Namespace) -> int:
163176
variables = _build_template_variables(crash_info, args.var, claude_analysis)
164177
existing_issue = dedup.get("issue_number") if dedup else None
165178

179+
# Validate required variables before creating/commenting (skip is fine without them)
180+
if action != "skip":
181+
missing = _validate_required_variables(variables)
182+
if missing:
183+
print(
184+
f"Error: Required variables not set: {', '.join(missing)}",
185+
file=sys.stderr,
186+
)
187+
_write_github_output("validation_failed", "true")
188+
_write_github_output("missing_variables", ", ".join(missing))
189+
return 1
190+
166191
if action == "skip":
167192
print(f"Exact duplicate of #{existing_issue}, skipping.", file=sys.stderr)
168193
_write_github_output("issue_number", str(existing_issue))
@@ -279,6 +304,15 @@ def cmd_dry_run(args: argparse.Namespace) -> int:
279304
variables = _build_template_variables(crash_info, args.var, claude_analysis)
280305
existing_issue = dedup.get("issue_number") if dedup else None
281306

307+
# Validate required variables (same check as real report)
308+
if action != "skip":
309+
missing = _validate_required_variables(variables)
310+
if missing:
311+
print(
312+
f"Warning: Required variables not set: {', '.join(missing)}",
313+
file=sys.stderr,
314+
)
315+
282316
print(f"=== Action: {action.upper()} ===", file=sys.stderr)
283317

284318
if action == "skip":

.github/workflows/fuzz.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ jobs:
4848
secrets:
4949
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
5050
gh_token: ${{ secrets.GITHUB_TOKEN }}
51+
incident_io_alert_token: ${{ secrets.INCIDENT_IO_ALERT_TOKEN }}
5152

5253
attempt-fix-io:
5354
name: "Attempt Fix for IO Fuzz Crash"
@@ -98,6 +99,7 @@ jobs:
9899
secrets:
99100
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
100101
gh_token: ${{ secrets.GITHUB_TOKEN }}
102+
incident_io_alert_token: ${{ secrets.INCIDENT_IO_ALERT_TOKEN }}
101103

102104
# ============================================================================
103105
# Compress Roundtrip Fuzzer

.github/workflows/report-fuzz-crash.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ on:
3333
required: false
3434
gh_token:
3535
required: true
36+
# incident.io alert source token from Alerts > Alert sources > Custom HTTP.
37+
incident_io_alert_token:
38+
required: false
3639

3740
jobs:
3841
report:
@@ -126,3 +129,23 @@ jobs:
126129
-v "BRANCH=${{ inputs.branch }}" \
127130
-v "COMMIT=${{ inputs.commit }}" \
128131
-v "ARTIFACT_URL=${{ inputs.artifact_url }}"
132+
133+
- name: Alert incident.io on validation failure
134+
if: failure() && steps.report.outputs.validation_failed == 'true' && secrets.incident_io_alert_token != ''
135+
uses: incident-io/github-action@v0
136+
with:
137+
api-key: ${{ secrets.incident_io_alert_token }}
138+
alert-source-id: 01KH4EYTH3HA4PDZPRAPEV1Q10
139+
alert-title: "Fuzzer crash report failed: missing required variables"
140+
alert-description: |
141+
The fuzz_report pipeline failed because required variables were missing: ${{ steps.report.outputs.missing_variables }}.
142+
The fuzzer found a crash but could not file a GitHub issue.
143+
deduplication-key: fuzz-report-validation-${{ inputs.fuzz_target }}
144+
source-url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
145+
custom-fields: |
146+
{
147+
"fuzz_target": "${{ inputs.fuzz_target }}",
148+
"missing_variables": "${{ steps.report.outputs.missing_variables }}",
149+
"branch": "${{ inputs.branch }}",
150+
"commit": "${{ inputs.commit }}"
151+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Test incident.io Alert
2+
3+
on:
4+
push: {}
5+
workflow_dispatch: {}
6+
7+
jobs:
8+
test-alert:
9+
runs-on: ubuntu-latest
10+
timeout-minutes: 2
11+
steps:
12+
- name: Fire test alert
13+
id: fire
14+
uses: incident-io/github-action@v0
15+
with:
16+
api-key: ${{ secrets.INCIDENT_IO_ALERT_TOKEN }}
17+
alert-source-id: 01KH4EYTH3HA4PDZPRAPEV1Q10
18+
alert-title: "Test alert: ignore this"
19+
alert-description: |
20+
Testing incident.io integration from Vortex CI.
21+
Safe to dismiss.
22+
deduplication-key: test-alert-${{ github.run_id }}
23+
source-url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
24+
25+
- name: Print result
26+
run: |
27+
echo "Alert ID: ${{ steps.fire.outputs.alert-id }}"
28+
echo "Alert URL: ${{ steps.fire.outputs.alert-url }}"
29+
30+
- name: Resolve test alert
31+
uses: incident-io/github-action@v0
32+
with:
33+
api-key: ${{ secrets.INCIDENT_IO_ALERT_TOKEN }}
34+
alert-source-id: 01KH4EYTH3HA4PDZPRAPEV1Q10
35+
alert-title: "Test alert: resolved"
36+
alert-status: resolved
37+
deduplication-key: test-alert-${{ github.run_id }}

0 commit comments

Comments
 (0)