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

Upload per-database diagnostic SARIFs on green and red runs #1556

Merged
merged 28 commits into from
Mar 20, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5d87d01
Refactor golang autobuild env variable
angelapwen Mar 3, 2023
6b27d47
Add database diagnostic command, cluster env var
angelapwen Mar 3, 2023
0277876
Upload per-database failed SARIFs, if applicable
angelapwen Mar 3, 2023
b780f5b
Add autogenerated files
angelapwen Mar 3, 2023
1d4190a
Add `database export-diagnostics` command
angelapwen Mar 3, 2023
e6c90ea
Call `export diagnostics` if there is no database
angelapwen Mar 8, 2023
1f1b68b
Add new export_diagnostics feature flag
angelapwen Mar 8, 2023
3200bf1
Pass "--sarif-include-diagnostics" when feature flag on
angelapwen Mar 13, 2023
1e4efb1
Resolve merge conflicts
angelapwen Mar 13, 2023
ec89543
Remove --sarif-include-diagnostics from diagnotics export
angelapwen Mar 13, 2023
6cce51b
Fix export-diagnostics call
angelapwen Mar 13, 2023
ed73efb
Improve unit tests
angelapwen Mar 14, 2023
c193f61
Merge remote-tracking branch 'upstream/main' into failed-database-dia…
angelapwen Mar 15, 2023
30ddec6
Gate `database export-diagnostics` behind feature flag
angelapwen Mar 15, 2023
0c2bb50
[WIP] Add diagnostics export test
angelapwen Mar 15, 2023
0d25a3c
Try `database add-diagnostic`
angelapwen Mar 17, 2023
1fdf5c4
Move add diagnostic to before analyze
angelapwen Mar 17, 2023
7bda3d2
Add diagnostics option for green runs
angelapwen Mar 17, 2023
18c0c1a
Check SARIF in test for expected properties
angelapwen Mar 17, 2023
817a0e5
Rename test for consistency, stop db upload
angelapwen Mar 17, 2023
cb3dd65
Comment/import cleanup
angelapwen Mar 18, 2023
6ea3eb9
Test `nightly-latest` for diagnostics, config export
angelapwen Mar 20, 2023
9e6750d
Stop relying on SARIF ordering
angelapwen Mar 20, 2023
1954584
Print database diagnostics args if unit test fails
angelapwen Mar 20, 2023
9116cc1
Apply suggestions from code review
angelapwen Mar 20, 2023
0271b54
Add JSDoc comment
angelapwen Mar 20, 2023
3465159
Improve failure message, some autogenerated fixes
angelapwen Mar 20, 2023
e7e7280
Refactor inclusion check
angelapwen Mar 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Refactor inclusion check
  • Loading branch information
angelapwen committed Mar 20, 2023
commit e7e728015880abdc83ae8ea99e6d5afaac35f34e
24 changes: 6 additions & 18 deletions .github/workflows/__diagnostics-export.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 6 additions & 18 deletions pr-checks/checks/diagnostics-export.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,27 +38,15 @@ steps:
const run = sarif.runs[0];

const toolExecutionNotifications = run.invocations[0].toolExecutionNotifications;
let foundDiagnosticToolExecutionNotification = false;
for (toolExecutionNotification of toolExecutionNotifications) {
if (toolExecutionNotification.descriptor.id === 'lang/diagnostics/example' && toolExecutionNotification.message.text === 'Plaintext message') {
foundDiagnosticToolExecutionNotification = true;
break;
}
};
if (foundDiagnosticToolExecutionNotification === false) {
core.setFailed('An entry for this diagnostic was not found in the `runs[].invocations[].toolExecutionNotifications` SARIF property');
const diagnosticToolExecutionNotification = toolExecutionNotifications.filter(n => n.descriptor.id === 'lang/diagnostics/example' && n.message.text === 'Plaintext message');
if (diagnosticToolExecutionNotification.length !== 1) {
core.setFailed(`Expected exactly 1 entry for this diagnostic in the 'runs[].invocations[].toolExecutionNotifications[]' SARIF property, found ${diagnosticToolExecutionNotification.length}`);
}

const notifications = run.tool.driver.notifications;
let foundDiagnosticNotification = false;
for (notification of notifications) {
if (notification.id === 'lang/diagnostics/example' && notification.name === 'lang/diagnostics/example' && notification.fullDescription.text && 'Diagnostic name') {
foundDiagnosticNotification = true;
break;
}
}
if (foundDiagnosticNotification === false) {
core.setFailed('An entry for this diagnostic was not found in the `runs[].tool.driver.notifications[]` SARIF property.');
const diagnosticNotification = notifications.filter(n => n.id === 'lang/diagnostics/example' && n.name === 'lang/diagnostics/example' && n.fullDescription.text && 'Diagnostic name');
if (diagnosticNotification.length !== 1) {
core.setFailed(`Expected exactly 1 entry for this diagnostic in the 'runs[].tool.driver.notifications[]' SARIF property, found ${diagnosticNotification.length}`);
}

core.info('Finished diagnostic export test');