Compare commits

...

2 Commits

Author SHA1 Message Date
Joshua Hale
4cd2eff354 report exceptions during upload 2020-05-06 14:14:14 +01:00
Joshua Hale
cce113b7fc don't catch error initializing config 2020-05-06 14:03:29 +01:00
8 changed files with 158 additions and 175 deletions

5
lib/config-utils.js generated
View File

@@ -71,7 +71,6 @@ function initConfig() {
core.debug('No configuration file was provided');
return config;
}
try {
const parsedYAML = yaml.safeLoad(fs.readFileSync(configFile, 'utf8'));
if (parsedYAML.name && typeof parsedYAML.name === "string") {
config.name = parsedYAML.name;
@@ -103,10 +102,6 @@ function initConfig() {
}
});
}
}
catch (err) {
core.setFailed(err);
}
return config;
}
async function saveConfig(config) {

2
lib/finalize-db.js generated
View File

@@ -126,7 +126,7 @@ async function run() {
await runQueries(codeqlCmd, databaseFolder, sarifFolder, config);
if ('true' === core.getInput('upload')) {
if (!await upload_lib.upload(sarifFolder)) {
await util.reportActionFailed('failed', 'upload');
await util.reportActionFailed('finish', 'upload');
return;
}
}

2
lib/setup-tracer.js generated
View File

@@ -205,8 +205,8 @@ async function run() {
await util.reportActionFailed('init', error.message, error.stack);
return;
}
core.exportVariable(sharedEnv.CODEQL_ACTION_INIT_COMPLETED, 'true');
await util.reportActionSucceeded('init');
core.exportVariable(sharedEnv.CODEQL_ACTION_INIT_COMPLETED, 'true');
}
run().catch(e => {
core.setFailed("init action failed: " + e);

5
lib/upload-lib.js generated
View File

@@ -125,7 +125,6 @@ exports.upload = upload;
async function uploadFiles(sarifFiles) {
core.startGroup("Uploading results");
let succeeded = false;
try {
// Check if an upload has happened before. If so then abort.
// This is intended to catch when the finish and upload-sarif actions
// are used together, and then the upload-sarif action is invoked twice.
@@ -170,10 +169,6 @@ async function uploadFiles(sarifFiles) {
succeeded = await uploadPayload(payload);
// Mark that we have made an upload
fs.writeFileSync(sentinelFile, '');
}
catch (error) {
core.setFailed(error.message);
}
core.endGroup();
return succeeded;
}

View File

@@ -75,7 +75,6 @@ function initConfig(): Config {
return config;
}
try {
const parsedYAML = yaml.safeLoad(fs.readFileSync(configFile, 'utf8'));
if (parsedYAML.name && typeof parsedYAML.name === "string") {
@@ -112,9 +111,6 @@ function initConfig(): Config {
}
});
}
} catch (err) {
core.setFailed(err);
}
return config;
}

View File

@@ -151,7 +151,7 @@ async function run() {
if ('true' === core.getInput('upload')) {
if (!await upload_lib.upload(sarifFolder)) {
await util.reportActionFailed('failed', 'upload');
await util.reportActionFailed('finish', 'upload');
return;
}
}

View File

@@ -238,8 +238,8 @@ async function run() {
await util.reportActionFailed('init', error.message, error.stack);
return;
}
core.exportVariable(sharedEnv.CODEQL_ACTION_INIT_COMPLETED, 'true');
await util.reportActionSucceeded('init');
core.exportVariable(sharedEnv.CODEQL_ACTION_INIT_COMPLETED, 'true');
}
run().catch(e => {

View File

@@ -127,7 +127,7 @@ export async function upload(input: string): Promise<boolean> {
async function uploadFiles(sarifFiles: string[]): Promise<boolean> {
core.startGroup("Uploading results");
let succeeded = false;
try {
// Check if an upload has happened before. If so then abort.
// This is intended to catch when the finish and upload-sarif actions
// are used together, and then the upload-sarif action is invoked twice.
@@ -182,9 +182,6 @@ async function uploadFiles(sarifFiles: string[]): Promise<boolean> {
// Mark that we have made an upload
fs.writeFileSync(sentinelFile, '');
} catch (error) {
core.setFailed(error.message);
}
core.endGroup();
return succeeded;