Skip to content

Commit 2ae6ae3

Browse files
authored
Fallback to re-running a full release build on missing builds. (#4665)
Closes flutter/flutter#168608.
1 parent bec9ea1 commit 2ae6ae3

2 files changed

Lines changed: 45 additions & 6 deletions

File tree

app_dart/lib/src/service/luci_build_service.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,8 +1113,11 @@ class LuciBuildService {
11131113
),
11141114
);
11151115
if (search.builds.isEmpty) {
1116-
log.error('No builds found for $buildId');
1117-
return false;
1116+
log.warn(
1117+
'No builds found for $buildId. This can occur when the previous build '
1118+
'completely failed, i.e. no builds were successfully spawned. A full '
1119+
'rebuild will be triggered',
1120+
);
11181121
}
11191122
final failedBuilds = [
11201123
for (final build in search.builds)

app_dart/test/service/luci_build_service/rerun_dart_internal_test.dart

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ void main() {
109109
);
110110
});
111111

112-
test('must find associated sub-builds or fails', () async {
112+
test('on missing associated sub-builds warns+does a full build', () async {
113113
when(mockBuildBucketClient.getBuild(any)).thenAnswer((_) async {
114114
return bbv2.Build(id: Int64(1001));
115115
});
@@ -127,6 +127,38 @@ void main() {
127127
return bbv2.SearchBuildsResponse(builds: []);
128128
});
129129

130+
when(mockBuildBucketClient.scheduleBuild(any)).thenAnswer((i) async {
131+
final [bbv2.ScheduleBuildRequest request] = i.positionalArguments;
132+
expect(
133+
request.builder,
134+
isA<bbv2.BuilderID>()
135+
.having((b) => b.project, 'project', 'dart-internal')
136+
.having((b) => b.bucket, 'bucket', 'flutter')
137+
.having(
138+
(b) => b.builder,
139+
'builder',
140+
'Linux flutter_release_builder',
141+
),
142+
);
143+
expect(
144+
request.exe,
145+
bbv2.Executable(cipdVersion: 'refs/heads/flutter-0.42-candidate.0'),
146+
);
147+
expect(
148+
request.gitilesCommit,
149+
bbv2.GitilesCommit(
150+
project: 'mirrors/flutter',
151+
host: 'flutter.googlesource.com',
152+
ref: 'refs/heads/flutter-0.42-candidate.0',
153+
id: 'abcdef',
154+
),
155+
);
156+
expect(request.hasNotify(), isFalse);
157+
expect(request.properties, bbv2.Struct(fields: {}));
158+
expect(request.priority, LuciBuildService.kRerunPriority);
159+
return bbv2.Build();
160+
});
161+
130162
await expectLater(
131163
luci.rerunDartInternalReleaseBuilder(
132164
commit: CommitRef(
@@ -136,16 +168,19 @@ void main() {
136168
),
137169
task: task,
138170
),
139-
completion(isFalse),
171+
completion(isTrue),
140172
);
141173

142174
expect(
143175
log,
144176
bufferedLoggerOf(
145177
contains(
146178
logThat(
147-
message: contains('No builds found for'),
148-
severity: atLeastError,
179+
message: stringContainsInOrder([
180+
'No builds found for',
181+
'A full rebuild will be triggered',
182+
]),
183+
severity: atMostWarning,
149184
),
150185
),
151186
),
@@ -154,6 +189,7 @@ void main() {
154189
firestore,
155190
existsInStorage(fs.Task.metadata, [
156191
isTask.hasStatus(TaskStatus.failed).hasCurrentAttempt(1),
192+
isTask.hasStatus(TaskStatus.inProgress).hasCurrentAttempt(2),
157193
]),
158194
);
159195
});

0 commit comments

Comments
 (0)