in app_dart/lib/src/service/scheduler.dart [246:311]
Future<void> triggerPresubmitTargets({
required github.PullRequest pullRequest,
String reason = 'Newer commit available',
}) async {
// Always cancel running builds so we don't ever schedule duplicates.
log.fine('about to cancel presubmit targets');
await cancelPreSubmitTargets(
pullRequest: pullRequest,
reason: reason,
);
final github.CheckRun ciValidationCheckRun = await githubChecksService.githubChecksUtil.createCheckRun(
config,
pullRequest.base!.repo!.slug(),
pullRequest.head!.sha!,
kCiYamlCheckName,
output: const github.CheckRunOutput(
title: kCiYamlCheckName,
summary: 'If this check is stuck pending, push an empty commit to retrigger the checks',
),
);
final github.RepositorySlug slug = pullRequest.base!.repo!.slug();
dynamic exception;
try {
final List<Target> presubmitTargets = await getPresubmitTargets(pullRequest);
await luciBuildService.scheduleTryBuilds(
targets: presubmitTargets,
pullRequest: pullRequest,
);
} on FormatException catch (error, backtrace) {
log.warning(backtrace.toString());
exception = error;
} catch (error, backtrace) {
log.warning(backtrace.toString());
exception = error;
}
// Update validate ci.yaml check
if (exception == null) {
// Success in validating ci.yaml
await githubChecksService.githubChecksUtil.updateCheckRun(
config,
slug,
ciValidationCheckRun,
status: github.CheckRunStatus.completed,
conclusion: github.CheckRunConclusion.success,
);
} else {
log.warning('Marking PR #${pullRequest.number} $kCiYamlCheckName as failed');
log.warning(exception.toString());
// Failure when validating ci.yaml
await githubChecksService.githubChecksUtil.updateCheckRun(
config,
slug,
ciValidationCheckRun,
status: github.CheckRunStatus.completed,
conclusion: github.CheckRunConclusion.failure,
output: github.CheckRunOutput(
title: kCiYamlCheckName,
summary: '.ci.yaml has failures',
text: exception.toString(),
),
);
}
log.info(
'Finished triggering builds for: pr ${pullRequest.number}, commit ${pullRequest.base!.sha}, branch ${pullRequest.head!.ref} and slug ${pullRequest.base!.repo!.slug()}}');
}