diff options
author | Bastien Abadie <bastien@mozilla.com> | 2019-06-07 16:53:03 +0000 |
---|---|---|
committer | Bastien Abadie <bastien@mozilla.com> | 2019-06-07 16:53:03 +0000 |
commit | e0017e99b16df74b5bdd951b04a7be1ba49ea5b1 (patch) | |
tree | cff722f2307b56b75cc91c20ce3757748b4fd0c9 | |
parent | 6e22abb94dbbe43081b7c9127c6a5511f374c1f1 (diff) | |
download | nss-hg-e0017e99b16df74b5bdd951b04a7be1ba49ea5b1.tar.gz |
Bug 1557675 - Add code-review ending task in automation graph, r=jcj
Differential Revision: https://phabricator.services.mozilla.com/D34135
-rw-r--r-- | automation/taskcluster/graph/src/extend.js | 40 | ||||
-rw-r--r-- | automation/taskcluster/graph/src/queue.js | 23 |
2 files changed, 63 insertions, 0 deletions
diff --git a/automation/taskcluster/graph/src/extend.js b/automation/taskcluster/graph/src/extend.js index 9c9a10358..d7bd3f547 100644 --- a/automation/taskcluster/graph/src/extend.js +++ b/automation/taskcluster/graph/src/extend.js @@ -296,6 +296,10 @@ export default async function main() { await scheduleMac("Mac (opt)", {collection: "opt"}, "--opt"); await scheduleMac("Mac (debug)", {collection: "debug"}); + + // Must be executed after all other tasks are scheduled + queue.clearFilters(); + await scheduleCodeReview(); } @@ -1007,6 +1011,7 @@ async function scheduleTools() { symbol: "coverity", name: "coverity", image: FUZZ_IMAGE, + tags: ['code-review'], env: { USE_64: "1", CC: "clang", @@ -1118,3 +1123,38 @@ async function scheduleTools() { return queue.submit(); } + +async function scheduleCodeReview() { + let tasks = queue.taggedTasks("code-review"); + if(! tasks) { + console.debug("No code review tasks, skipping ending task"); + return + } + + // From https://hg.mozilla.org/mozilla-central/file/tip/taskcluster/ci/code-review/kind.yml + queue.scheduleTask({ + platform: "nss-tools", + name: "code-review-issues", + description: "List all issues found in static analysis and linting tasks", + + // No logic on that task + image: LINUX_IMAGE, + command: ["/bin/true"], + + // This task must run after all analyzer tasks are completed + parents: tasks, + + // This option permits to run the task + // regardless of the analyzers tasks exit status + // as we are interested in the task failures + requires: "all-resolved", + + // Publish code review trigger on pulse + routes: ["project.relman.codereview.v1.try_ending"], + + kind: "code-review", + symbol: "E" + }); + + return queue.submit(); +}; diff --git a/automation/taskcluster/graph/src/queue.js b/automation/taskcluster/graph/src/queue.js index 603648c0c..feebd6f56 100644 --- a/automation/taskcluster/graph/src/queue.js +++ b/automation/taskcluster/graph/src/queue.js @@ -12,6 +12,7 @@ let maps = []; let filters = []; let tasks = new Map(); +let tags = new Map(); let image_tasks = new Map(); let queue = new taskcluster.Queue({ @@ -101,6 +102,9 @@ function convertTask(def) { dependencies.push(def.parent); env.TC_PARENT_TASK_ID = def.parent; } + if (def.parents) { + dependencies = dependencies.concat(def.parents); + } if (def.tests) { env.NSS_TESTS = def.tests; @@ -148,6 +152,7 @@ function convertTask(def) { deadline: fromNow(24), dependencies, + requires: def.requires || "all-completed", routes: parseRoutes(def.routes || []), metadata: { @@ -173,6 +178,14 @@ export function filter(fun) { filters.push(fun); } +export function clearFilters(fun) { + filters = []; +} + +export function taggedTasks(tag) { + return tags[tag]; +} + export function scheduleTask(def) { let taskId = slugid.v4(); tasks.set(taskId, merge({}, def)); @@ -194,6 +207,16 @@ export async function submit() { let log_id = `${task.name} @ ${task.platform}[${task.collection || "opt"}]`; console.log(`+ Submitting ${log_id}.`); + // Index that task for each tag specified + if(task.tags) { + task.tags.map(tag => { + if(!tags[tag]) { + tags[tag] = []; + } + tags[tag].push(taskId); + }); + } + let parent = task.parent; // Convert the task definition. |