Fixed multipipelining

This commit is contained in:
Dunemask 2022-08-12 20:10:57 +00:00
parent 82a4865404
commit 1bb588f294
13 changed files with 66 additions and 27 deletions

View file

@ -133,9 +133,21 @@ const testsMock = () => {
const mappingsMock = () => {
return [
["primary", "secondary1", "tertiary1"],
["primary", "secondary1", "tertiary2"],
["primary", "secondary2", "tertiary3"],
[
{ name: "primary", delay: 0 },
{ name: "secondary1", delay: 1000 },
{ name: "tertiary1", delay: 0 },
],
[
{ name: "primary", delay: 0 },
{ name: "secondary1", delay: 1000 },
{ name: "tertiary2", delay: 8000 },
],
[
{ name: "primary", delay: 0 },
{ name: "secondary2", delay: 0 },
{ name: "tertiary3", delay: 3000 },
],
];
};

View file

@ -26,7 +26,7 @@ const wrapCommand = (jobId, command) => {
JSON.stringify({ jobId, command, url: qualiteerUrl }),
"utf8"
).toString("base64");
const curlCmd = `curl -o qltr-executor ${executorUrl} && ${bin} ${payload}`;
const curlCmd = `curl -o qltr-executor ${executorUrl} || true && ${bin} ${payload}`;
return curlCmd;
};

View file

@ -109,6 +109,7 @@ export const JobProvider = ({ children }) => {
const onPipelineTrigger = (p) => {
const { triggers } = p;
for (var t in triggers) {
if (t === "__testDelay") continue;
const delay = triggers[t].__testDelay ?? 0;
delete triggers[t].__testDelay;
const jobReq = {

View file

@ -10,7 +10,7 @@ const localStorage = { setItem: () => {}, getItem: () => {} };
const localSettings = localStorage.getItem("settings");
const defaultSettings = {
focusJob: true,
simplifiedControls: true,
simplifiedControls: false,
logAppDetails: true,
defaultRegion: "us",
defaultPage: "failing",

View file

@ -44,12 +44,13 @@ export const usePipelineIconState = (pipeline) => {
if (jobStatuses.includes(jobStatus.PENDING))
return statusIcon(jobStatus.PENDING);
if (pipeline.isCanceled) return statusIcon(jobStatus.CANCELED);
if (jobStatuses.includes(jobStatus.OK)) return statusIcon(jobStatus.OK);
return statusIcon(jobStatus.QUEUED);
};
export const selectedPipelineBranches = (pipeline) =>
pipeline.branches.map((b) =>
b.filter((t) => pipeline.selectedBranches.includes(t))
b.filter((t) => pipeline.selectedBranches.find((b) => b.name == t.name))
);
export const findPipelineJobByTestName = (pipeline, jobs, testName) =>

View file

@ -2,7 +2,7 @@ import _ from "lodash";
const nest = (arr) => {
const obj = {};
arr.reduce((o, s) => (o[s] = {}), obj);
arr.reduce((o, s) => (o[s.name] = { __testDelay: s.delay }), obj);
return obj;
};
@ -13,10 +13,10 @@ export const asTree = (branches) => {
export const asBranches = (array) => {
const merged = [];
array.forEach((p, i) => {
array.forEach((p) => {
p.forEach((v, i) => {
if (!merged[i]) merged[i] = [];
if (!merged[i].includes(v)) merged[i].push(v);
if (!merged[i].find((t) => t.name == v.name)) merged[i].push(v);
});
});
return merged;

View file

@ -2,7 +2,7 @@ import { useQuery } from "@tanstack/react-query";
const QUALITEER_URL = "https://qualiteer.elijahparker3.repl.co/api";
const useMock = true;
const useMock = false;
const asMock = (data) => ({ data });
@ -134,9 +134,21 @@ export const useCatalogTests = () =>
export const usePipelineMappings = () =>
useMock
? asMock([
["primary", "secondary1", "tertiary1"],
["primary", "secondary1", "tertiary2"],
["primary", "secondary2", "tertiary3"],
[
{ name: "primary", delay: 0 },
{ name: "secondary1", delay: 1000 },
{ name: "tertiary1", delay: 0 },
],
[
{ name: "primary", delay: 0 },
{ name: "secondary1", delay: 1000 },
{ name: "tertiary2", delay: 8000 },
],
[
{ name: "primary", delay: 0 },
{ name: "secondary2", delay: 20000 },
{ name: "tertiary3", delay: 3000 },
],
])
: useQuery(["pipelineMappings"], fetchApi("/catalog/pipeline-mappings"));

View file

@ -53,7 +53,13 @@ export default function CatalogBox(props) {
};
const runPipelineTest = () => {
const primaries = pipelineMappings.filter((m) => m.includes(testName));
if (isLoading) {
console.log("Pipeline mappings are loading, retrying in 5 seconds");
setTimeout(runPipelineTest, 5000);
}
const primaries = pipelineMappings.filter((m) =>
m.find((t) => t.name === testName)
);
const builderCache = {
branches: asBranches(primaries),
tree: asTree(primaries),

View file

@ -83,7 +83,9 @@ export default function FailingBox(props) {
}
const retryPipelineTest = () => {
const primaries = pipelineMappings.filter((m) => m.includes(testName));
const primaries = pipelineMappings.filter((m) =>
m.find((t) => t.name === testName)
);
const builderCache = {
branches: asBranches(primaries),
tree: asTree(primaries),

View file

@ -122,7 +122,7 @@ function JobPipelineDisplay(props) {
disableGutters={true}
square
key={j}
onClick={selectJob(test)}
onClick={selectJob(test.name)}
>
<AccordionSummary
style={{
@ -134,11 +134,11 @@ function JobPipelineDisplay(props) {
component={"span"}
style={{ wordBreak: "break-word", margin: "auto 0" }}
>
{test}
{test.name}
</Typography>
<Stack sx={{ ml: "auto" }}>
<IconButton aria-label="retry" component="span">
{jobIcon(test)}
{jobIcon(test.name)}
</IconButton>
</Stack>
</AccordionSummary>

View file

@ -35,7 +35,7 @@ export default function Jobs() {
justifyContent="center"
sx={{ flexFlow: "wrap" }}
>
<Typography variant="h4">No jobs found! </Typography>{" "}
<Typography variant="h4">No jobs found!</Typography>
</Box>
<Box
display="flex"
@ -49,7 +49,9 @@ export default function Jobs() {
</Box>
</React.Fragment>
) : null}
<JobBuilder />
{location.hash === "" && (
<React.Fragment>
{jobState.jobs

View file

@ -17,8 +17,8 @@ function PipelineSelector(props) {
if (isLoading) return {};
const primaryMappings = {};
for (var pm of pipelineMappings) {
if (!(pm[0] in primaryMappings)) primaryMappings[pm[0]] = [];
primaryMappings[pm[0]].push(pm);
if (!(pm[0].name in primaryMappings)) primaryMappings[pm[0].name] = [];
primaryMappings[pm[0].name].push(pm);
}
return primaryMappings;
};
@ -54,8 +54,10 @@ function PipelineSelector(props) {
component={"span"}
style={{ wordBreak: "break-word", margin: "auto 0" }}
color={
(cache.primarySelectedMappings ?? [[]])[0][0] === k
? "primary"
cache.primarySelectedMappings
? cache.primarySelectedMappings[0][0].name === k
? "primary"
: null
: null
}
>

View file

@ -27,7 +27,7 @@ function PipelineTrackSelector(props) {
const removeTrack = (test) => {
const { tracks } = cache;
for (var i in tracks) {
const index = tracks[i].indexOf(test);
const index = tracks[i].findIndex((t) => t.name === test.name);
if (index === -1) continue;
tracks[i] = tracks[i].slice(0, index);
}
@ -35,12 +35,13 @@ function PipelineTrackSelector(props) {
};
const selectTrack = (test) => () => {
if (as1d(cache.tracks).includes(test)) return removeTrack(test);
if (as1d(cache.tracks).find((t) => t.name === test.name))
return removeTrack(test);
addTrack(test);
};
const getColor = (test) =>
as1d(cache.tracks).includes(test) ? "primary" : null;
as1d(cache.tracks).find((t) => t.name === test.name) ? "primary" : null;
const nextClick = () => {
setCache({
@ -79,7 +80,7 @@ function PipelineTrackSelector(props) {
style={{ wordBreak: "break-word", margin: "auto 0" }}
color={getColor(test)}
>
{test}
{test.name}
</Typography>
<Stack sx={{ ml: "auto" }}>I</Stack>
</AccordionSummary>