Add an integration test for uploading SARIF when the run fails
This commit is contained in:
parent
8337c2be0f
commit
122b180b66
5 changed files with 58 additions and 23 deletions
9
lib/init-action-post-helper.js
generated
9
lib/init-action-post-helper.js
generated
|
|
@ -64,14 +64,23 @@ async function run(uploadDatabaseBundleDebugArtifact, uploadLogsDebugArtifact, p
|
|||
logger.warning("Debugging artifacts are unavailable since the 'init' Action failed before it could produce any.");
|
||||
return;
|
||||
}
|
||||
// Environment variable used to integration test uploading a SARIF file for failed runs
|
||||
const expectFailedSarifUpload = process.env["CODEQL_ACTION_EXPECT_UPLOAD_FAILED_SARIF"] === "true";
|
||||
if (process.env[shared_environment_1.CODEQL_ACTION_ANALYZE_DID_UPLOAD_SARIF] !== "true") {
|
||||
try {
|
||||
await uploadFailedSarif(config, repositoryNwo, featureEnablement, logger);
|
||||
}
|
||||
catch (e) {
|
||||
if (expectFailedSarifUpload) {
|
||||
throw new Error("Expected to upload a SARIF file for the failed run, but encountered " +
|
||||
`the following error: ${e}`);
|
||||
}
|
||||
logger.warning(`Failed to upload a SARIF file for the failed run. Error: ${e}`);
|
||||
}
|
||||
}
|
||||
else if (expectFailedSarifUpload) {
|
||||
throw new Error("Expected to upload a SARIF file for the failed run, but didn't.");
|
||||
}
|
||||
// Upload appropriate Actions artifacts for debugging
|
||||
if (config.debugMode) {
|
||||
core.info("Debug mode is on. Uploading available database bundles and logs as Actions debugging artifacts...");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue