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
19 changes: 19 additions & 0 deletions app_dart/lib/src/service/luci_build_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,25 @@ class LuciBuildService {
);
}

if (isUnifiedCheckRunFlow && dashboardChecks != null) {
// For unified check run flow, update dashboard checks to in progress.
try {
await _githubChecksUtil.updateCheckRun(
_config,
slug,
dashboardChecks,
status: CheckRunStatus.inProgress,
);
} catch (e, s) {
// We are not going to block on this error.
log.warn(
'Failed to update dashboard checks for PR# ${pullRequest.number} to in progress',
e,
s,
);
}
}
Comment thread
ievdokdm marked this conversation as resolved.

return targets.keys.toList();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,15 @@ void main() {
// Should NOT create individual check runs
verifyNever(mockGithubChecksUtil.createCheckRun(any, any, any, any));

verify(
mockGithubChecksUtil.updateCheckRun(
any,
RepositorySlug.full('flutter/flutter'),
checkRunGuard,
status: CheckRunStatus.inProgress,
),
).called(1);

final bbv2.ScheduleBuildRequest scheduleBuild;
{
final batchRequest = bbv2.BatchRequest().createEmptyInstance();
Expand Down Expand Up @@ -528,6 +537,15 @@ void main() {
),
).called(1);

verifyNever(
mockGithubChecksUtil.updateCheckRun(
any,
any,
any,
status: anyNamed('status'),
),
);

final bbv2.ScheduleBuildRequest scheduleBuild;
{
final batchRequest = bbv2.BatchRequest().createEmptyInstance();
Expand All @@ -541,6 +559,77 @@ void main() {
expect(userData.checkRunId, 456);
expect(userData.guardCheckRunId, isNull);
});

test(
'does not update dashboard checks when unified flow is disabled',
() async {
final pullRequest = generatePullRequest(
id: 1,
repo: 'flutter',
headSha: 'headsha123',
);

final buildTarget = generateTarget(
1,
properties: {'os': 'abc'},
slug: RepositorySlug.full('flutter/flutter'),
name: 'Linux foo',
);

// Disable Unified Check Run Flow but provide a guard (unexpected but should be handled)
luci = LuciBuildService(
config: FakeConfig(
dynamicConfig: DynamicConfig(
unifiedCheckRunFlow: UnifiedCheckRunFlow(useForAll: false),
),
),
cache: CacheService.inMemory(),
buildBucketClient: mockBuildBucketClient,
githubChecksUtil: mockGithubChecksUtil,
pubsub: pubSub,
gerritService: gerritService,
firestore: firestore,
);

final checkRunGuard = generateCheckRun(1234, name: 'Guard');

when(
mockGithubChecksUtil.createCheckRun(any, any, any, any),
).thenAnswer((_) async => generateCheckRun(456, name: 'Linux foo'));

await expectLater(
luci.scheduleTryBuilds(
pullRequest: pullRequest,
targets: [buildTarget],
engineArtifacts: EngineArtifacts.builtFromSource(
commitSha: pullRequest.head!.sha!,
),
dashboardChecks: checkRunGuard, // Pass guard even though disabled
),
completion([isTarget.hasName('Linux foo')]),
);

// Should NOT update dashboard checks
verifyNever(
mockGithubChecksUtil.updateCheckRun(
any,
any,
any,
status: anyNamed('status'),
),
);

// Should create individual check run because unified flow is disabled
verify(
mockGithubChecksUtil.createCheckRun(
any,
RepositorySlug.full('flutter/flutter'),
'headsha123',
'Linux foo',
),
).called(1);
},
);
});

group('Ordered Presubmit', () {
Expand Down
Loading