Upgrades people!

This commit is contained in:
Dunemask 2022-08-09 04:29:10 +00:00
parent f84234150f
commit 8ad56e8d38
40 changed files with 483 additions and 379 deletions

View file

@ -7,7 +7,8 @@ const { default: executorConfig } = await import(
// Load config and args
const args = process.argv.slice(2);
const config = normalize(executorConfig(args));
const payload = JSON.parse(Buffer.from(args[0], "base64").toString("utf8"));
const config = normalize(executorConfig(payload));
// Start Executor
const exec = new Executor(args, config);
const exec = new Executor(config, payload);
exec.runJob();

View file

@ -34,9 +34,15 @@ const pipelineMaxLife = (testName) => {
const buildCompound = (jobReq, socketId) => {
const { testName, command } = jobReq;
const pipelineTriggers = jobReq.pipelineTriggers;
if (pipelineTriggers) command.push(`pipelineTriggers=${pipelineTriggers}`);
command.push(`pipelineDashboardSocket=${socketId}`);
const { pipeline } = jobReq;
if (pipeline) {
pipeline.dashboardSocketId = socketId;
const pipelineArg = Buffer.from(JSON.stringify(pipeline), "utf8").toString(
"base64"
);
command.push(`pipeline=${pipelineArg}`);
}
return { ...jobReq, command };
};

View file

@ -7,8 +7,8 @@ const { command } = job.spec.template.spec.containers[0];
INFO("EXEC", "Internal Executor Starting!");
cp.exec(command, (error, stdout, stderr) => {
if (error) ERR("EXEC", error);
//if(stdout) VERB("EXEC-STDOUT", stdout);
//if(stderr) VERB("EXEC-STDERR", stderr);
//if (stdout) VERB("EXEC-STDOUT", stdout);
//if (stderr) VERB("EXEC-STDERR", stderr);
OK("EXEC", "Internal Executor Finished!");
process.exit(error ? 1 : 0);
});

View file

@ -22,9 +22,11 @@ const wrapCommand = (jobId, command) => {
? `node ${executorBin}`
: `chmod +x ${executorBin} && ./${executorBin}`;
const cmd = command.map((arg) => JSON.stringify(arg));
const curlCmd = `curl -o qltr-executor ${executorUrl} && ${bin} ${qualiteerUrl} ${jobId} ${cmd.join(
" "
)}`;
const payload = Buffer.from(
JSON.stringify({ jobId, command, url: qualiteerUrl }),
"utf8"
).toString("base64");
const curlCmd = `curl -o qltr-executor ${executorUrl} && ${bin} ${payload}`;
return curlCmd;
};

View file

@ -7,25 +7,25 @@ const nest = (arr) => {
};
export const asTree = (branches) => {
const nests = branches.map((b)=>nest(b));
return _.merge(...nests);
};
const nests = branches.map((b) => nest(b));
return _.merge(...nests);
};
export const asBranches = (array) => {
const merged = [];
array.forEach((p, i) => {
p.forEach((v, i) => {
if (!merged[i]) merged[i] = [];
if (!merged[i].includes(v)) merged[i].push(v);
});
const merged = [];
array.forEach((p, i) => {
p.forEach((v, i) => {
if (!merged[i]) merged[i] = [];
if (!merged[i].includes(v)) merged[i].push(v);
});
return merged;
}
});
return merged;
};
export const as1d = (a) => [].concat.apply([], a);
export const selectBranch = (map,test) => {
const pipeline = map.find((pm)=>pm.includes(test));
const testIndex = pipeline.findIndex((t) => t === test);
return pipeline.slice(0, testIndex + 1);
}
export const selectBranch = (map, test) => {
const pipeline = map.find((pm) => pm.includes(test));
const testIndex = pipeline.findIndex((t) => t === test);
return pipeline.slice(0, testIndex + 1);
};