Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app_dart/lib/cocoon_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ export 'src/service/config.dart';
export 'src/service/firestore.dart';
export 'src/service/flags/dynamic_config.dart';
export 'src/service/flags/ordered_presubmit_flags.dart';
export 'src/service/flags/unified_check_run_flow_flags.dart';
export 'src/service/gerrit_service.dart';
export 'src/service/github_checks_service.dart';
export 'src/service/issue_service.dart';
Expand Down
11 changes: 6 additions & 5 deletions app_dart/lib/src/model/common/presubmit_completed_check.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class PresubmitCompletedJob {
final int checkRunId;
final int? checkSuiteId;
final String? headBranch;
final bool isUnifiedCheckRun;
final CiStage? stage;
final int? prNum;
final int attempt;
Expand All @@ -53,7 +52,6 @@ class PresubmitCompletedJob {
required this.checkRunId,
required this.checkSuiteId,
required this.headBranch,
required this.isUnifiedCheckRun,
this.stage,
this.prNum,
this.attempt = 1,
Expand All @@ -80,7 +78,6 @@ class PresubmitCompletedJob {
checkRunId: userData.guardCheckRunId ?? userData.checkRunId!,
checkSuiteId: userData.checkSuiteId,
headBranch: userData.commit.branch,
isUnifiedCheckRun: userData.guardCheckRunId != null,
stage: userData.stage,
prNum: userData.pullRequestNumber,
attempt: _getAttempt(build),
Expand All @@ -103,7 +100,7 @@ class PresubmitCompletedJob {
cocoon_checks.CheckRun get checkRun {
return cocoon_checks.CheckRun(
id: checkRunId,
name: isUnifiedCheckRun ? Config.kDashboardCheckName : name,
name: Config.kDashboardCheckName,
headSha: sha,
conclusion: status.toConclusion(),
checkSuite: CheckSuite(
Expand All @@ -121,7 +118,11 @@ class PresubmitCompletedJob {
slug: slug,
prNum: prNum ?? 0,
checkRunId: checkRunId,
stage: stage ?? CiStage.fusionTests,
stage:
stage ??
(slug == Config.flutterSlug
? CiStage.fusionTests
: CiStage.genericTests),
);
}

Expand Down
14 changes: 8 additions & 6 deletions app_dart/lib/src/request_handlers/presubmit_subscription.dart
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,12 @@ base class PresubmitSubscription extends SubscriptionHandler {
tagSet ??= BuildTags.fromStringPairs(build.tags);
final builderName = build.builder.builder;
var rescheduled = false;
final isUnifiedCheckRun = userData.guardCheckRunId != null;
log.info('Unified Check Run ${isUnifiedCheckRun ? 'Enabled' : 'Disabled'}');
final isMergeQueue = tagSet.containsType<InMergeQueueBuildTag>();
log.info(
'Processing Build for ${isMergeQueue ? 'Merge Queue' : 'Presubmit'}',
);
if (build.status.isTaskFailed()) {
if (isUnifiedCheckRun) {
if (!isMergeQueue) {
// If failed we need summaryMarkdown. For github check run flow this
// called in [GithubChecksService.updateCheckStatus(...)]
build = await _luciBuildService.getBuildById(
Expand All @@ -165,7 +167,7 @@ base class PresubmitSubscription extends SubscriptionHandler {
if (tagSet.currentAttempt < maxAttempt) {
rescheduled = true;
log.info('Rerunning failed task: $builderName');
if (isUnifiedCheckRun) {
if (!isMergeQueue) {
await UnifiedCheckRun.reInitializeInProgressJob(
firestoreService: _firestore,
completedJob: PresubmitCompletedJob.fromBuild(
Expand Down Expand Up @@ -199,9 +201,9 @@ base class PresubmitSubscription extends SubscriptionHandler {
'### ⚠️ Test failed but marked as suppressed on dashboard';
}
}
if (!isUnifiedCheckRun) {
if (isMergeQueue) {
if (userData.checkRunId == null) {
log.error('checkRunId is null for non-unified check run');
log.error('checkRunId is required for merge queue builds.');
return;
}
await _githubChecksService.updateCheckStatus(
Expand Down
8 changes: 2 additions & 6 deletions app_dart/lib/src/service/firestore/unified_check_run.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,10 @@ final class UnifiedCheckRun {
CheckRun? mergeQueueGuard,
@visibleForTesting DateTime Function() utcNow = DateTime.timestamp,
}) async {
if (dashboardChecks != null &&
pullRequest != null &&
config.flags.isUnifiedCheckRunFlowEnabledForUser(
pullRequest.user!.login!,
)) {
if (dashboardChecks != null && pullRequest != null) {
// Create the presubmit_guard and associated presubmit_job documents.
log.info(
'Storing UnifiedCheckRun data for ${slug.fullName}#${pullRequest.number} as it enabled for user ${pullRequest.user!.login}.',
'Storing UnifiedCheckRun data for ${slug.fullName}#${pullRequest.number}.',
);
// We store the creation time of the guard since there might be several
// guards for the same PR created and each new one created after previous
Expand Down
8 changes: 3 additions & 5 deletions app_dart/lib/src/service/luci_build_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,6 @@ class LuciBuildService {
final slug = pullRequest.base!.repo!.slug();
final commitBranch = pullRequest.base!.ref!.replaceAll('refs/heads/', '');
final isFusion = slug == Config.flutterSlug;
final isUnifiedCheckRunFlow = _config.flags
.isUnifiedCheckRunFlowEnabledForUser(pullRequest.user!.login!);
final isOrderedPresubmit = _config.flags.isOrderedPresubmitEnabledForUser(
pullRequest.user!.login!,
);
Expand All @@ -307,7 +305,7 @@ class LuciBuildService {
late PresubmitUserData userData;
// If the unified check run flow is enabled, do not create individual
// check runs for each target but use the guard check run instead.
if (isUnifiedCheckRunFlow && dashboardChecks != null) {
if (dashboardChecks != null) {
userData = PresubmitUserData(
commit: CommitRef(slug: slug, sha: commitSha, branch: commitBranch),
guardCheckRunId: dashboardChecks.id!,
Expand All @@ -326,7 +324,7 @@ class LuciBuildService {
for (final MapEntry(key: target, value: attemptNumber) in targets.entries) {
// If the unified check run flow is disabled create individual check runs
// for each target.
if (!isUnifiedCheckRunFlow || dashboardChecks == null) {
if (dashboardChecks == null) {
final checkRun = await _githubChecksUtil.createCheckRun(
_config,
target.slug,
Expand Down Expand Up @@ -396,7 +394,7 @@ class LuciBuildService {
userData: userData,
properties: properties,
// if unified check run flow is enabled, use guard check run othervise check run id.
tags: isUnifiedCheckRunFlow && dashboardChecks != null
tags: dashboardChecks != null
? BuildTags([
GuardCheckRunIdBuildTag(
guardCheckRunId: dashboardChecks.id!,
Expand Down
Loading
Loading