Commit ed0c950f authored by Garrett Beaty's avatar Garrett Beaty Committed by Commit Bot

Modify the sorting of consoles to place the overview consoles first.

The overview consoles currently appear in the middle of the console list
mixed in with all of the per-master consoles. This will change it so that
consoles that specify a title will be sorted before consoles that do not
specify a title, which will move the overview consoles to the top since
they specify a title and the per-master consoles do not.

Change-Id: I5bd4d872f4edf435ab8af70946da9d96e51ce8aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2242232Reviewed-by: default avatarStephen Martinis <martiniss@chromium.org>
Commit-Queue: Stephen Martinis <martiniss@chromium.org>
Auto-Submit: Garrett Beaty <gbeaty@chromium.org>
Cr-Commit-Position: refs/heads/master@{#778923}
parent 864073ac
This diff is collapsed.
def _sort_consoles(ctx):
milo = ctx.output['luci-milo.cfg']
# Sort so that the overview consoles appear at the top of the console list
# The overview consoles specify a title, so checking c.id == c.name will put
# the overview consoles first
milo.consoles = sorted(milo.consoles, key=lambda c: (c.id == c.name, c.id))
lucicfg.generator(_sort_consoles)
...@@ -277,7 +277,7 @@ def _get_overview_console_view_key_fn(console_name): ...@@ -277,7 +277,7 @@ def _get_overview_console_view_key_fn(console_name):
return key_fn return key_fn
def _sort_consoles(ctx): def _sort_console_entries(ctx):
milo = ctx.output['luci-milo.cfg'] milo = ctx.output['luci-milo.cfg']
consoles = [] consoles = []
for console in milo.consoles: for console in milo.consoles:
...@@ -288,9 +288,8 @@ def _sort_consoles(ctx): ...@@ -288,9 +288,8 @@ def _sort_consoles(ctx):
if key_fn: if key_fn:
console.builders = sorted(console.builders, key_fn) console.builders = sorted(console.builders, key_fn)
consoles.append(console) consoles.append(console)
milo.consoles = sorted(consoles, lambda c: c.id)
lucicfg.generator(_sort_consoles) lucicfg.generator(_sort_console_entries)
def ordering(*, short_names=None, categories=None): def ordering(*, short_names=None, categories=None):
......
...@@ -131,7 +131,7 @@ def _sorted_list_view_impl(ctx, *, console_name): ...@@ -131,7 +131,7 @@ def _sorted_list_view_impl(ctx, *, console_name):
_sorted_list_view = lucicfg.rule(impl=_sorted_list_view_impl) _sorted_list_view = lucicfg.rule(impl=_sorted_list_view_impl)
def _sort_consoles(ctx): def _sort_console_entries(ctx):
milo = ctx.output['luci-milo.cfg'] milo = ctx.output['luci-milo.cfg']
consoles = [] consoles = []
for console in milo.consoles: for console in milo.consoles:
...@@ -142,9 +142,8 @@ def _sort_consoles(ctx): ...@@ -142,9 +142,8 @@ def _sort_consoles(ctx):
if node: if node:
console.builders = sorted(console.builders, lambda b: b.name) console.builders = sorted(console.builders, lambda b: b.name)
consoles.append(console) consoles.append(console)
milo.consoles = sorted(consoles, lambda c: c.id)
lucicfg.generator(_sort_consoles) lucicfg.generator(_sort_console_entries)
def list_view(*, name, **kwargs): def list_view(*, name, **kwargs):
......
...@@ -103,5 +103,6 @@ master_only_exec('//generators/scheduler-bucketed-jobs.star') ...@@ -103,5 +103,6 @@ master_only_exec('//generators/scheduler-bucketed-jobs.star')
# The trybots should be update to not require no-op jobs to be triggered so that # The trybots should be update to not require no-op jobs to be triggered so that
# the no-op jobs can be removed # the no-op jobs can be removed
exec('//generators/scheduler-noop-jobs.star') exec('//generators/scheduler-noop-jobs.star')
exec('//generators/sort-consoles.star')
exec('//validators/builders-in-consoles.star') exec('//validators/builders-in-consoles.star')
...@@ -10,7 +10,7 @@ settings = struct( ...@@ -10,7 +10,7 @@ settings = struct(
ci_poller = 'master-gitiles-trigger', ci_poller = 'master-gitiles-trigger',
main_console_name = 'main', main_console_name = 'main',
main_console_title = 'Chromium Main Console', main_console_title = 'Chromium Main Console',
cq_mirrors_console_name = 'cq-mirrors', cq_mirrors_console_name = 'mirrors',
cq_mirrors_console_title = 'Chromium CQ Mirrors Console', cq_mirrors_console_title = 'Chromium CQ Mirrors Console',
try_bucket = 'try', try_bucket = 'try',
try_triggering_projects = ['angle', 'dawn', 'skia', 'v8'], try_triggering_projects = ['angle', 'dawn', 'skia', 'v8'],
......
...@@ -9,7 +9,7 @@ vars = struct( ...@@ -9,7 +9,7 @@ vars = struct(
ci_poller = 'm83-gitiles-trigger', ci_poller = 'm83-gitiles-trigger',
main_console_name = 'main-m83', main_console_name = 'main-m83',
main_console_title = 'Chromium M83 Console', main_console_title = 'Chromium M83 Console',
cq_mirrors_console_name = 'cq-mirrors-m83', cq_mirrors_console_name = 'mirrors-m83',
cq_mirrors_console_title = 'Chromium M83 CQ Mirrors Console', cq_mirrors_console_title = 'Chromium M83 CQ Mirrors Console',
try_bucket = 'try-m83', try_bucket = 'try-m83',
try_triggering_projects = [], try_triggering_projects = [],
......
...@@ -9,7 +9,7 @@ vars = struct( ...@@ -9,7 +9,7 @@ vars = struct(
ci_poller = 'm84-gitiles-trigger', ci_poller = 'm84-gitiles-trigger',
main_console_name = 'main-m84', main_console_name = 'main-m84',
main_console_title = 'Chromium M84 Console', main_console_title = 'Chromium M84 Console',
cq_mirrors_console_name = 'cq-mirrors-m84', cq_mirrors_console_name = 'mirrors-m84',
cq_mirrors_console_title = 'Chromium M84 CQ Mirrors Console', cq_mirrors_console_title = 'Chromium M84 CQ Mirrors Console',
try_bucket = 'try-m84', try_bucket = 'try-m84',
try_triggering_projects = [], try_triggering_projects = [],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment