in app_dart/lib/src/request_handlers/update_existing_flaky_issues.dart [95:134]
Future<void> _updateExistingFlakyIssue(
GithubService gitHub,
RepositorySlug slug,
pb.SchedulerConfig schedulerConfig, {
required List<BuilderStatistic> prodBuilderStatisticList,
required List<BuilderStatistic> stagingBuilderStatisticList,
required Map<String?, Issue> nameToExistingIssue,
}) async {
final Map<String, bool> builderFlakyMap = <String, bool>{};
for (pb.Target target in schedulerConfig.targets) {
builderFlakyMap[target.name] = target.bringup;
}
// For prod builder stats, updates an existing flaky bug when the builder is not marked as flaky.
//
// If a builder is marked as flaky, it is expected to run in `staging` pool.
// It is possible that a flaky bug exists for a builder, but the builder is not marked as flaky,
// such as a shard builder. For this case, it is still running in `prod` pool.
for (final BuilderStatistic statistic in prodBuilderStatisticList) {
if (nameToExistingIssue.containsKey(statistic.name) &&
builderFlakyMap.containsKey(statistic.name) &&
builderFlakyMap[statistic.name] == false &&
_buildsAreEnough(statistic)) {
await _addCommentToExistingIssue(gitHub, slug,
bucket: _getBucket(builderFlakyMap, statistic.name),
statistic: statistic,
existingIssue: nameToExistingIssue[statistic.name]!);
}
}
// For all staging builder stats, updates any existing flaky bug.
for (final BuilderStatistic statistic in stagingBuilderStatisticList) {
if (nameToExistingIssue.containsKey(statistic.name) &&
builderFlakyMap[statistic.name] == true &&
_buildsAreEnough(statistic)) {
await _addCommentToExistingIssue(gitHub, slug,
bucket: _getBucket(builderFlakyMap, statistic.name),
statistic: statistic,
existingIssue: nameToExistingIssue[statistic.name]!);
}
}
}