Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Unified Diff: tools/gardening/lib/src/luci_services.dart

Issue 3005723002: Added ability to find builder-groups (Closed)
Patch Set: Landing with changes from johnniwinther Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gardening/lib/src/luci_api.dart ('k') | tools/gardening/lib/src/util.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gardening/lib/src/luci_services.dart
diff --git a/tools/gardening/lib/src/luci_services.dart b/tools/gardening/lib/src/luci_services.dart
index bf2adbdf57225d169eb730b2d967279aef0eaf2a..0ec7a3cfb53c87e721efc757f240b0269e7ee52a 100644
--- a/tools/gardening/lib/src/luci_services.dart
+++ b/tools/gardening/lib/src/luci_services.dart
@@ -6,22 +6,30 @@ import 'dart:async';
import 'try.dart';
import 'logger.dart';
import 'cache_new.dart';
-import 'luci_api.dart';
+import 'luci.dart';
+import 'util.dart';
+
+const UNINTERESTING_BUILDER_SUFFIXES = const [
+ "-dev",
+ "-stable",
+ "-integration"
+];
/// Fetches all builds for a given [commit]-hash, by searching the latest
/// [amount] builds.
-Future<Try<List<BuildDetail>>> fetchBuildsForCommmit(LuciApi api, Logger logger,
+Future<Try<List<BuildDetail>>> fetchBuildsForCommmit(Luci luci, Logger logger,
String client, String commit, CreateCacheFunction createCache,
[int amount = 1]) async {
logger.debug("Finding primary bots for client $client");
- var buildBots = await api.getPrimaryBuilders(
- client, createCache(duration: new Duration(minutes: 30)));
+ var buildBots = await getPrimaryBuilders(
+ luci, client, createCache(duration: new Duration(minutes: 30)));
var cache = createCache(duration: new Duration(minutes: 30));
- return (await buildBots.bindAsync((List<LuciBuildBot> buildBots) async {
+
+ return (await buildBots.bindAsync((List<String> buildBots) async {
var buildBotBuilds = new List<List<BuildDetail>>();
for (var buildBot in buildBots) {
- (await api.getBuildBotDetails(client, buildBot.name, cache, amount)).fold(
+ (await luci.getBuildBotDetails(client, buildBot, cache, amount)).fold(
(ex, st) {
logger.error("Problem getting results", ex, st);
}, buildBotBuilds.add);
@@ -35,3 +43,54 @@ Future<Try<List<BuildDetail>>> fetchBuildsForCommmit(LuciApi api, Logger logger,
});
});
}
+
+/// [getBuilderGroups] fetches all builder groups not in -dev, -stable and
+/// -integration from CBE.
+Future<Try<List<String>>> getBuilderGroups(
+ Luci luci, String client, WithCacheFunction withCache) async {
+ var result = await luci.getJsonFromChromeBuildExtract(client, withCache);
+ return result.bind((json) {
+ var builders = json["builders"];
+ return builders.keys.fold<Map<String, Object>>({},
+ (Map<String, Object> map, builderKey) {
+ if (UNINTERESTING_BUILDER_SUFFIXES.any((x) => builderKey.contains(x))) {
+ return map;
+ }
+ map[sanitizeCategory(builders[builderKey]["category"])] = true;
+ return map;
+ }).keys;
+ });
+}
+
+/// [getAllBuilders] fetches all builders from CBE.
+Future<Try<List<String>>> getAllBuilders(
+ Luci luci, String client, WithCacheFunction withCache) async {
+ var result = await luci.getJsonFromChromeBuildExtract(client, withCache);
+ return result.bind((json) {
+ return json["builders"].keys;
+ });
+}
+
+/// [getPrimaryBuilders] fetches all primary builders from CBE.
+Future<Try<List<String>>> getPrimaryBuilders(
+ Luci luci, String client, WithCacheFunction withCache) async {
+ var result = await getAllBuilders(luci, client, withCache);
+ return result.bind((builders) {
+ return builders
+ .where((builderKey) =>
+ !UNINTERESTING_BUILDER_SUFFIXES.any((x) => builderKey.contains(x)))
+ .toList();
+ });
+}
+
+/// [getPrimaryBuilders] gets all builders in builder group [builderGroup].
+Future<Try<List<String>>> getBuildersInBuilderGroup(Luci luci, String client,
+ WithCacheFunction withCache, String builderGroup) async {
+ var result = await luci.getJsonFromChromeBuildExtract(client, withCache);
+ return result.bind((json) {
+ var builders = json["builders"];
+ return builders.keys.where((builder) {
+ return sanitizeCategory(builders[builder]["category"]) == builderGroup;
+ });
+ });
+}
« no previous file with comments | « tools/gardening/lib/src/luci_api.dart ('k') | tools/gardening/lib/src/util.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698