roger-mike commented on code in PR #24034:
URL: https://github.com/apache/beam/pull/24034#discussion_r1019587564
##########
scripts/ci/workflows-issues-manager/index.js:
##########
@@ -0,0 +1,130 @@
+const { ISSUES_MANAGER_TAG } = require("./constants.js");
+const { getRepoWorkflows, getRunsForWorkflow } = require("./workflows.js");
+const { getRepoIssues, closeIssue, createIssue} = require("./issues");
+
+
+const checkConclusions = (conclusions) => {
+ return ({ conclusion }) => {
+ return conclusions.includes(conclusion);
+ };
+};
+
+const filterRuns = (runs, conclusions) => {
+ return runs.filter((run) => conclusions.includes(run.conclusion));
+};
+
+const splitWorkflows = async ({ github, context }, workflows) => {
+ let lastKRuns = [];
+ let unstable = [];
+ let stable = [];
+ let permared = [];
+
+ //TODO: make it parallel
+ for (const workflow of workflows) {
+ const { workflow_runs } = await getRunsForWorkflow({ github, context },
workflow);
+ let filteredRuns = filterRuns(workflow_runs, ["success", "failure",
"timed_out"]);
+
+ const output = filteredRuns.map(
+ ({ id, name, conclusion, event, head_branch }) => `${id} | ${name} |
${conclusion} | ${event} |${head_branch}`
+ );
+ console.log("FILTERED WORKFLOW RUNS", output);
+
+ lastKRuns.push({
+ workflow,
+ filteredRuns,
+ });
+ }
+
+ const isSuccessful = checkConclusions(["success"]);
+ const isFailure = checkConclusions(["failure", "timed_out"]);
+
+ //TODO: Handle case when filteredRuns is empty
+
+ lastKRuns = lastKRuns.filter(({ filteredRuns }) => filteredRuns.length > 0);
+
+ unstable = lastKRuns.filter(({ filteredRuns }) =>
filteredRuns.some(isFailure) && !filteredRuns.every(isFailure));
Review Comment:
In the `createIssuesForWorkflows ` function we check if the workflow has an
issue associated with it. The `createIssuesForWorkflows` is only called for
unstable and permared workflows. So, if any of them already has an open issue
it won't be created again. About the rollout, which subset of workflow do you
think we can select?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]