You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Include diagnostics in failed SARIF if they were created before a database was initialised - #4223
Diagnostics are typically written to the database cluster and are then included in the SARIF that is generated by the CLI. However, in the CodeQL Action we may produce diagnostics before the database cluster is initialised. To work around this, we have so far relied on tracking diagnostics in memory that were created before the database cluster is ready. After the cluster is initialised, those diagnostics are then flushed to disk. However, this represents a problem if the database cluster is never successfully initialised.
This PR changes this so that diagnostics are written directly to a temporary directory on disk if the database cluster is not yet ready. They are then moved to the database cluster once it is initialised. If the cluster is never initialised, then we point the CLI at the temporary directory on disk using a --diagnostic-dir argument. The CLI will then pick up any diagnostics that are still in that location and include them in the failed SARIF.
Risk assessment
For internal use only. Please select the risk level of this change:
Low risk: Changes are fully under feature flags, or have been fully tested and validated in pre-production environments and are highly observable, or are documentation or test only.
Which use cases does this change impact?
Workflow types:
Advanced setup - Impacts users who have custom CodeQL workflows.
Code Scanning - The changes impact analyses when analysis-kinds: code-scanning.
Code Quality - The changes impact analyses when analysis-kinds: code-quality.
Other first-party - The changes impact other first-party analyses.
Environments:
Dotcom - Impacts CodeQL workflows on github.com and/or GitHub Enterprise Cloud with Data Residency.
GHES - Impacts CodeQL workflows on GitHub Enterprise Server.
How did/will you validate this change?
Unit tests - I am depending on unit test coverage (i.e. tests in .test.ts files).
End-to-end tests - I am depending on PR checks (i.e. tests in pr-checks).
If something goes wrong after this change is released, what are the mitigation and rollback strategies?
Rollback - Change can only be disabled by rolling back the release or releasing a new version with a fix.
How will you know if something goes wrong after this change is released?
Telemetry - I rely on existing telemetry or have made changes to the telemetry.
Dashboards - I will watch relevant dashboards for issues after the release. Consider whether this requires this change to be released at a particular time rather than as part of a regular release.
Alerts - New or existing monitors will trip if something goes wrong with this change.
Are there any special considerations for merging or releasing this change?
No special considerations - This change can be merged at any time.
Merge / deployment checklist
Confirm this change is backwards compatible with existing workflows.
Consider adding a changelog entry for this change.
Confirm the readme and docs have been updated if necessary.
Diagnostics are typically written to the database cluster and are then included in the SARIF that is generated by the CLI. However, in the CodeQL Action we may produce diagnostics before the database cluster is initialised. To work around this, we have so far relied on tracking diagnostics in memory that were created before the database cluster is ready. After the cluster is initialised, those diagnostics are then flushed to disk. However, this represents a problem if the database cluster is never successfully initialised.
This PR changes this so that diagnostics are written directly to a temporary directory on disk if the database cluster is not yet ready. They are then moved to the database cluster once it is initialised. If the cluster is never initialised, then we point the CLI at the temporary directory on disk using a
--diagnostic-dirargument. The CLI will then pick up any diagnostics that are still in that location and include them in the failed SARIF.Risk assessment
For internal use only. Please select the risk level of this change:
Which use cases does this change impact?
Workflow types:
dynamicworkflows (Default Setup, Code Quality, ...).Products:
analysis-kinds: code-scanning.analysis-kinds: code-quality.Environments:
github.comand/or GitHub Enterprise Cloud with Data Residency.How did/will you validate this change?
.test.tsfiles).pr-checks).If something goes wrong after this change is released, what are the mitigation and rollback strategies?
How will you know if something goes wrong after this change is released?
Are there any special considerations for merging or releasing this change?
Merge / deployment checklist