Skip to content
This repository has been archived by the owner on May 5, 2024. It is now read-only.

Commit

Permalink
✨ Added support for summaryTable
Browse files Browse the repository at this point in the history
  • Loading branch information
davidahouse committed Feb 21, 2021
1 parent 5fae872 commit 7ea7384
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
20 changes: 20 additions & 0 deletions bin/stampede-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const conf = require("rc")("stampede", {
stderrLogFile: null,
taskTimeout: 1800000, // Default timeout: 30 minutes
artifactListFile: "artifacts.csv",
summaryTableFile: "summarytable.json",
// Log file configuration
taskDetailsLogFile: "worker.log",
releaseBodyFile: "releasebody.txt",
Expand Down Expand Up @@ -472,6 +473,7 @@ async function executeTask(taskExecutionConfig, workingDirectory, environment) {
"",
taskExecutionConfig.errorTextFile,
taskExecutionConfig.artifactListFile,
taskExecutionConfig.summaryTableFile,
resolve
);
} else {
Expand All @@ -485,6 +487,7 @@ async function executeTask(taskExecutionConfig, workingDirectory, environment) {
"",
taskExecutionConfig.successTextFile,
taskExecutionConfig.artifactListFile,
taskExecutionConfig.summaryTableFile,
resolve
);
}
Expand Down Expand Up @@ -686,6 +689,7 @@ async function updateTask(task, responseQueue) {
* @param {*} defaultText
* @param {*} textFile
* @param {*} artifactListFile
* @param {*} summaryTableFile
* @return {*} The conclusion object to set in our task details
*/
async function prepareConclusion(
Expand All @@ -697,6 +701,7 @@ async function prepareConclusion(
defaultText,
textFile,
artifactListFile,
summaryTableFile,
resolve
) {
let summary = defaultSummary;
Expand Down Expand Up @@ -731,12 +736,27 @@ async function prepareConclusion(
}
}

let summaryTable = [];
if (summaryTableFile != null && summaryTableFile.length > 0) {
if (fs.existsSync(workingDirectory + "/" + summaryTableFile)) {
try {
const results = fs.readFileSync(
workingDirectory + "/" + summaryTableFile
);
summaryTable = JSON.parse(results);
} catch (e) {
console.log("Error reading summary table: " + e);
}
}
}

resolve({
conclusion: conclusion,
title: title,
summary: summary,
text: text,
artifacts: artifacts,
summaryTable: summaryTable,
});
}

Expand Down
4 changes: 4 additions & 0 deletions lib/executionConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ async function prepareExecutionConfig(task, conf, logger) {
workerConfig.artifactListFile != null
? workerConfig.artifactListFile
: conf.artifactListFile,
summaryTableFile:
workerConfig.summaryTableFile != null
? workerConfig.summaryTableFile
: conf.summaryTableFile,
};
}

Expand Down

0 comments on commit 7ea7384

Please sign in to comment.