Initial loading of AutoPipeline (#6)
Co-authored-by: Dunemask <dunemask@gmail.com> Reviewed-on: https://gitea.dunemask.net/elysium/qualiteer/pulls/6
This commit is contained in:
parent
124151207f
commit
ba8e6ded26
2 changed files with 20 additions and 2 deletions
|
@ -1,8 +1,10 @@
|
||||||
// Imports
|
// Imports
|
||||||
import { Worker } from "rabbiteer";
|
import { Worker } from "rabbiteer";
|
||||||
import { VERB } from "../../util/logging.js";
|
import { VERB } from "../../util/logging.js";
|
||||||
|
import { getPipelineMappings } from "../../database/queries/catalog.js";
|
||||||
import { insertTestResult } from "../../database/queries/results.js";
|
import { insertTestResult } from "../../database/queries/results.js";
|
||||||
import evt from "../../../common/sockets/events.js";
|
import evt from "../../../common/sockets/events.js";
|
||||||
|
import { asTree, asBranches, as1d } from "../../../../src/util/pipelines.js";
|
||||||
// Class
|
// Class
|
||||||
export default class TestResultsWorker extends Worker {
|
export default class TestResultsWorker extends Worker {
|
||||||
constructor(skio) {
|
constructor(skio) {
|
||||||
|
@ -26,8 +28,9 @@ export default class TestResultsWorker extends Worker {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
async onMessage(testResult) {
|
async onMessage(testResult) {
|
||||||
const { pipeline } = testResult;
|
const { pipeline, autoPipeline } = testResult;
|
||||||
await this.handleReporting(testResult);
|
await this.handleReporting(testResult);
|
||||||
|
if(autoPipeline) return this.autoPipeline(testResult);
|
||||||
// Alter to start next test
|
// Alter to start next test
|
||||||
// TODO the delay should be autopopulated either by the suite, or filled in by the server
|
// TODO the delay should be autopopulated either by the suite, or filled in by the server
|
||||||
if (pipeline) return this.pipelineTrigger(pipeline);
|
if (pipeline) return this.pipelineTrigger(pipeline);
|
||||||
|
@ -38,6 +41,22 @@ export default class TestResultsWorker extends Worker {
|
||||||
this.skio.to(dsi).emit(evt.PPL_TRG, pipeline);
|
this.skio.to(dsi).emit(evt.PPL_TRG, pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async autoPipeline(testResult){
|
||||||
|
const {name} = testResult;
|
||||||
|
console.log(testResult);
|
||||||
|
const mappings = await getPipelineMappings();
|
||||||
|
const primaries = mappings.filter((m) =>
|
||||||
|
m.find((t) => t.name === name)
|
||||||
|
);
|
||||||
|
const pipelineTree = asTree(primaries);
|
||||||
|
const pipelineReq = pipelineTree[name];
|
||||||
|
delete pipelineReq.__testDelay;
|
||||||
|
for(var k of Object.keys(pipelineReq)){
|
||||||
|
console.log("Would auto start: ", k);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
handleReporting(result) {
|
handleReporting(result) {
|
||||||
VERB("TestResults", result.name);
|
VERB("TestResults", result.name);
|
||||||
insertTestResult(result);
|
insertTestResult(result);
|
||||||
|
|
|
@ -3,7 +3,6 @@ import {
|
||||||
getTests,
|
getTests,
|
||||||
getPipelineMappings,
|
getPipelineMappings,
|
||||||
upsertTest,
|
upsertTest,
|
||||||
truncateTests,
|
|
||||||
removeDroppedTests,
|
removeDroppedTests,
|
||||||
} from "../database/queries/catalog.js";
|
} from "../database/queries/catalog.js";
|
||||||
const router = Router();
|
const router = Router();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue