Super Pipelines and display
This commit is contained in:
parent
8ad56e8d38
commit
c05502f15c
8 changed files with 223 additions and 75 deletions
|
@ -8,58 +8,60 @@ const pipelineMapping = [
|
|||
];
|
||||
|
||||
const buildCommon = (jobRequest) => {
|
||||
const { testName } = jobRequest;
|
||||
if (!testName) throw Error("'testName' must be provided!");
|
||||
const command = [baseCommand, suiteEntry, `test=${testName}`];
|
||||
|
||||
const { isTriage, ignore, region, testNames } = jobRequest;
|
||||
const command = [baseCommand, suiteEntry];
|
||||
// Apply Common Flags
|
||||
command.push("isRetry=false");
|
||||
|
||||
command.push(`isTriage=${isTriage}`);
|
||||
if(ignore && ignore.length > 0) console.log("Would ignore", ignore);
|
||||
if(region)
|
||||
command.push(`region=${region}`);
|
||||
|
||||
// Return new request
|
||||
return { ...jobRequest, command };
|
||||
};
|
||||
|
||||
const buildSingle = (jobReq) => jobReq;
|
||||
|
||||
const buildMarker = (jobReq) => {};
|
||||
|
||||
const buildProject = (jobReq) => {};
|
||||
|
||||
const pipelineMaxLife = (testName) => {
|
||||
const pipelines = pipelineMapping
|
||||
.filter((m) => m.pipeline.find((t) => t.name === testName))
|
||||
.map((m) => m.pipeline);
|
||||
return Math.max(pipelines.map((p) => p.length)) + 1;
|
||||
};
|
||||
|
||||
const buildCompound = (jobReq, socketId) => {
|
||||
const { testName, command } = jobReq;
|
||||
const { pipeline } = jobReq;
|
||||
if (pipeline) {
|
||||
pipeline.dashboardSocketId = socketId;
|
||||
const pipelineArg = Buffer.from(JSON.stringify(pipeline), "utf8").toString(
|
||||
"base64"
|
||||
);
|
||||
command.push(`pipeline=${pipelineArg}`);
|
||||
}
|
||||
const buildManual = (jobReq) => {
|
||||
const {testNames} = jobReq;
|
||||
if(testNames.length > 1) throw Error("Currently only 1 test can be selected!");
|
||||
|
||||
command.push(`test=${testNames[0]}`);
|
||||
|
||||
return { ...jobReq, command };
|
||||
};
|
||||
|
||||
function nextCompound(previousTest) {}
|
||||
const buildTags = (jobReq) => {
|
||||
const {command, tags, testNames} = jobReq;
|
||||
if(testNames && testNames.length > 0){
|
||||
return console.log("Would run tags as manual");
|
||||
}
|
||||
const arg = Buffer.from(JSON.stringify(tags), "utf8").toString(
|
||||
"base64"
|
||||
);
|
||||
command.push(`tags=${arg}`);
|
||||
return {...jobReq, command};
|
||||
};
|
||||
|
||||
const buildPipeline = (jobReq, socketId) => {
|
||||
const { command, pipeline } = jobReq;
|
||||
const {__test: test} = pipeline;
|
||||
if(!test) throw Error("__test is required for pipeline jobs!");
|
||||
pipeline.dashboardSocketId = socketId;
|
||||
const arg = Buffer.from(JSON.stringify(pipeline), "utf8").toString(
|
||||
"base64"
|
||||
);
|
||||
command.push(`pipeline=${arg}`);
|
||||
command.push(`test=${test}`);
|
||||
return { ...jobReq, command };
|
||||
};
|
||||
|
||||
export default function jobBuilder(jobRequest, id) {
|
||||
const jobReq = buildCommon(jobRequest, id);
|
||||
switch (jobRequest.type) {
|
||||
case "single":
|
||||
return buildSingle(jobReq);
|
||||
case "marker":
|
||||
return buildMarker(jobReq);
|
||||
case "project":
|
||||
return buildProject(jobReq);
|
||||
case "compound":
|
||||
return buildCompound(jobReq, id);
|
||||
default:
|
||||
throw Error("No Job Request Type Specified!");
|
||||
}
|
||||
const {pipeline, testNames, tags } = jobReq;
|
||||
if(pipeline)
|
||||
return buildPipeline(jobReq, id);
|
||||
else if(tags)
|
||||
return buildTags(jobReq);
|
||||
else if(testNames)
|
||||
return buildManual(jobReq); //TODO currently does nothing
|
||||
else throw Error("At least 1 'pipeline or tags or testNames' is required! ");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue