Skip to content

Commit ad0c3a8

Browse files
authored
Merge branch 'flutter:main' into main
2 parents c89443c + 13fcae5 commit ad0c3a8

File tree

24 files changed

+2147
-1742
lines changed

24 files changed

+2147
-1742
lines changed

.ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ platform_properties:
1414
os: Linux
1515
mac:
1616
properties:
17-
os: Mac-12
17+
os: "Mac-12|Mac-13"
1818
cpu: x86
1919
windows:
2020
properties:

.github/workflows/scorecards-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
persist-credentials: false
2929

3030
- name: "Run analysis"
31-
uses: ossf/scorecard-action@08b4669551908b1024bb425080c797723083c031
31+
uses: ossf/scorecard-action@483ef80eb98fb506c348f7d62e28055e49fe2398
3232
with:
3333
results_file: results.sarif
3434
results_format: sarif

analyze/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ environment:
88
dependencies:
99
file: 7.0.0
1010
path: 1.8.3
11-
platform: 3.1.2
11+
platform: 3.1.3
1212

1313
dev_dependencies:
1414
mockito: 5.4.2
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"targets":[{"name":"Linux Cocoon","properties":{"add_recipes_cq":"true"},"recipe":"cocoon/cocoon"},{"name":"Linux device_doctor","properties":{"script":"cipd_packages/device_doctor/tool/build.sh","cipd_name":"flutter/device_doctor/linux-amd64"},"runIf":["cipd_packages/device_doctor/**",".ci.yaml"],"recipe":"cocoon/cipd"},{"name":"Mac device_doctor","properties":{"script":"cipd_packages/device_doctor/tool/build.sh","cipd_name":"flutter/device_doctor/mac-amd64","device_type":"none"},"runIf":["cipd_packages/device_doctor/**",".ci.yaml"],"recipe":"cocoon/cipd"},{"name":"Windows device_doctor","properties":{"script":"cipd_packages\\device_doctor\\tool\\build.bat","cipd_name":"flutter/device_doctor/windows-amd64"},"runIf":["cipd_packages/device_doctor/**",".ci.yaml"],"recipe":"cocoon/cipd"},{"name":"Linux doxygen","properties":{"script":"cipd_packages/doxygen/tool/build.sh","cipd_name":"flutter/doxygen/linux-amd64"},"runIf":["cipd_packages/doxygen/**",".ci.yaml"],"recipe":"cocoon/cipd"},{"name":"Mac codesign","properties":{"script":"cipd_packages/codesign/tool/build.sh","cipd_name":"flutter/codesign/mac-amd64","device_type":"none"},"runIf":["cipd_packages/codesign/**",".ci.yaml"],"recipe":"cocoon/cipd"},{"name":"Mac arm_codesign","properties":{"script":"cipd_packages/codesign/tool/build.sh","cipd_name":"flutter/codesign/mac-arm64","cpu":"arm64","device_type":"none"},"runIf":["cipd_packages/codesign/**",".ci.yaml"],"recipe":"cocoon/cipd"},{"name":"Linux ci_yaml roller","properties":{"add_recipes_cq":"true","backfill":"false"},"recipe":"infra/ci_yaml"}],"enabledBranches":["main"],"platformProperties":{"linux":{"properties":{"os":"Linux"}},"mac":{"properties":{"os":"Mac-12","cpu":"x86"}},"windows":{"properties":{"os":"Windows"}}}}
1+
{"targets":[{"name":"Linux Cocoon","properties":{"add_recipes_cq":"true"},"recipe":"cocoon/cocoon"},{"name":"Linux device_doctor","properties":{"script":"cipd_packages/device_doctor/tool/build.sh","cipd_name":"flutter/device_doctor/linux-amd64"},"runIf":["cipd_packages/device_doctor/**",".ci.yaml"],"recipe":"cocoon/cipd"},{"name":"Mac device_doctor","properties":{"script":"cipd_packages/device_doctor/tool/build.sh","cipd_name":"flutter/device_doctor/mac-amd64","device_type":"none"},"runIf":["cipd_packages/device_doctor/**",".ci.yaml"],"recipe":"cocoon/cipd"},{"name":"Windows device_doctor","properties":{"script":"cipd_packages\\device_doctor\\tool\\build.bat","cipd_name":"flutter/device_doctor/windows-amd64"},"runIf":["cipd_packages/device_doctor/**",".ci.yaml"],"recipe":"cocoon/cipd"},{"name":"Linux doxygen","properties":{"script":"cipd_packages/doxygen/tool/build.sh","cipd_name":"flutter/doxygen/linux-amd64"},"runIf":["cipd_packages/doxygen/**",".ci.yaml"],"recipe":"cocoon/cipd"},{"name":"Mac codesign","properties":{"script":"cipd_packages/codesign/tool/build.sh","cipd_name":"flutter/codesign/mac-amd64","device_type":"none"},"runIf":["cipd_packages/codesign/**",".ci.yaml"],"recipe":"cocoon/cipd"},{"name":"Mac arm_codesign","properties":{"script":"cipd_packages/codesign/tool/build.sh","cipd_name":"flutter/codesign/mac-arm64","cpu":"arm64","device_type":"none"},"runIf":["cipd_packages/codesign/**",".ci.yaml"],"recipe":"cocoon/cipd"},{"name":"Linux ci_yaml roller","properties":{"add_recipes_cq":"true","backfill":"false"},"recipe":"infra/ci_yaml"}],"enabledBranches":["main"],"platformProperties":{"linux":{"properties":{"os":"Linux"}},"mac":{"properties":{"os":"Mac-12|Mac-13","cpu":"x86"}},"windows":{"properties":{"os":"Windows"}}}}

app_dart/lib/src/service/config.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@ class Config {
8080
return defaultBranches[slug] ?? kDefaultBranchName;
8181
}
8282

83+
// The name of the bot that generates automated revert requests.
84+
String get autosubmitBot => 'auto-submit[bot]';
85+
86+
// The name of the label that the bot uses to identify the automatically
87+
// created pull request.
88+
static const String revertOfLabel = 'revert of';
89+
8390
/// Memorystore subcache name to store [CocoonConfig] values in.
8491
static const String configCacheName = 'config';
8592

app_dart/lib/src/service/github_checks_service.dart

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,17 @@ class GithubChecksService {
101101
if (rescheduled) {
102102
status = github.CheckRunStatus.queued;
103103
conclusion = null;
104+
output = github.CheckRunOutput(
105+
title: checkRun.name!,
106+
summary: 'Note: this is an auto rerun. The timestamp above is based on the first attempt of this check run.',
107+
);
104108
} else {
105109
final Build buildbucketBuild =
106110
await luciBuildService.getBuildById(buildPushMessage.build!.id, fields: 'id,builder,summaryMarkdown');
107-
output =
108-
github.CheckRunOutput(title: checkRun.name!, summary: getGithubSummary(buildbucketBuild.summaryMarkdown));
111+
output = github.CheckRunOutput(
112+
title: checkRun.name!,
113+
summary: getGithubSummary(buildbucketBuild.summaryMarkdown),
114+
);
109115
log.fine('Updating check run with output: [$output]');
110116
}
111117
}

app_dart/lib/src/service/luci_build_service.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,9 @@ class LuciBuildService {
353353
final Build build = builds.first;
354354
final String prString = build.tags!['buildset']!.firstWhere((String? element) => element!.startsWith('pr/git/'))!;
355355
final String cipdVersion = build.tags!['cipd_version']![0]!;
356-
final String branch = cipdVersion.split('/')[2];
356+
final String githubLink = build.tags!['github_link']![0]!;
357+
final String repoName = githubLink.split('/')[4];
358+
final String branch = Config.defaultBranch(github.RepositorySlug('flutter', repoName));
357359
final int prNumber = int.parse(prString.split('/')[2]);
358360

359361
final Map<String, dynamic> userData = <String, dynamic>{

app_dart/lib/src/service/scheduler.dart

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,10 @@ class Scheduler {
142142
policy = GuaranteedPolicy();
143143
}
144144
final int? priority = await policy.triggerPriority(task: task, datastore: datastore);
145-
// Skip scheduling `bringup: true` targets. They may be newly created and
146-
// their corresponding LUCI builder configs may not be ready yet considering we
147-
// disabled the `ci_yaml roller` backfill. Existing `bringup: true` targets
148-
// can rely on backfiller to get tasks scheduled and executed.
149-
if (priority != null && !target.value.bringup) {
145+
if (_shouldSchedule(priority, target.value.bringup, policy)) {
150146
// Mark task as in progress to ensure it isn't scheduled over
151147
task.status = Task.statusInProgress;
152-
toBeScheduled.add(Tuple<Target, Task, int>(target, task, priority));
148+
toBeScheduled.add(Tuple<Target, Task, int>(target, task, priority!));
153149
}
154150
}
155151

@@ -169,6 +165,22 @@ class Scheduler {
169165
await _uploadToBigQuery(commit);
170166
}
171167

168+
/// Checks whether the task should be scheduled.
169+
///
170+
/// Skips scheduling `bringup: true` targets for BatchPolicy. For BatchPolicy,
171+
/// targets may be newly created and their corresponding LUCI builder configs may
172+
/// not be ready yet considering we disabled the `ci_yaml roller` backfill.
173+
/// Existing `bringup: true` targets can rely on backfiller to get tasks scheduled and executed.
174+
bool _shouldSchedule(int? priority, bool bringup, SchedulerPolicy policy) {
175+
if (priority == null) {
176+
return false;
177+
}
178+
if (bringup) {
179+
return policy is! BatchPolicy;
180+
}
181+
return true;
182+
}
183+
172184
/// Schedule all builds in batch requests instead of a single request.
173185
///
174186
/// Each batch request contains [Config.batchSize] builds to be scheduled.
@@ -320,12 +332,19 @@ class Scheduler {
320332
final github.RepositorySlug slug = pullRequest.base!.repo!.slug();
321333
dynamic exception;
322334
try {
323-
final List<Target> presubmitTargets = await getPresubmitTargets(pullRequest);
324-
final List<Target> presubmitTriggerTargets = getTriggerList(presubmitTargets, builderTriggerList);
325-
await luciBuildService.scheduleTryBuilds(
326-
targets: presubmitTriggerTargets,
327-
pullRequest: pullRequest,
328-
);
335+
// Both the author and label should be checked to make sure that no one is
336+
// attempting to get a pull request without check through.
337+
if (pullRequest.user!.login == config.autosubmitBot &&
338+
pullRequest.labels!.any((element) => element.name == Config.revertOfLabel)) {
339+
log.info('Skipping generating the full set of checks for revert request.');
340+
} else {
341+
final List<Target> presubmitTargets = await getPresubmitTargets(pullRequest);
342+
final List<Target> presubmitTriggerTargets = getTriggerList(presubmitTargets, builderTriggerList);
343+
await luciBuildService.scheduleTryBuilds(
344+
targets: presubmitTriggerTargets,
345+
pullRequest: pullRequest,
346+
);
347+
}
329348
} on FormatException catch (error, backtrace) {
330349
log.warning('FormatException encountered when scheduling presubmit targets for ${pullRequest.number}');
331350
log.warning(backtrace.toString());

app_dart/pubspec.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,24 @@ dependencies:
2020
file: 6.1.4
2121
fixnum: 1.1.0
2222
gcloud: 0.8.11
23-
github: 9.18.0
23+
github: 9.19.0
2424
googleapis: 11.4.0
2525
googleapis_auth: 1.4.1
26-
gql: 0.14.0
27-
graphql: 5.1.3
26+
gql: 1.0.1-alpha+1691943394579
27+
graphql: 5.2.0-beta.6
2828
grpc: 3.2.4
29-
http: 0.13.6
29+
http: 1.1.0
3030
json_annotation: 4.8.1
3131
logging: 1.2.0
3232
meta: 1.10.0
3333
mime: 1.0.4
34-
mutex: 3.0.1
34+
mutex: 3.1.0
3535
neat_cache: 2.0.3
3636
path: 1.8.3
3737
process: 4.2.4
3838
process_runner: 4.1.2
3939
protobuf: 2.1.0
40-
retry: 3.1.1
40+
retry: ^3.1.2
4141
truncate: 3.0.1
4242
yaml: 3.1.2
4343

@@ -48,8 +48,8 @@ dev_dependencies:
4848
flutter_lints: 2.0.3
4949
json_serializable: 6.7.1
5050
mockito: 5.4.2
51-
platform: 3.1.2
52-
test: 1.24.6
51+
platform: 3.1.3
52+
test: 1.24.7
5353

5454
builders:
5555
json_serializable: 3.3.0

app_dart/test/service/luci_build_service_test.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,7 @@ void main() {
726726
tags: {
727727
'buildset': <String>['pr/git/123'],
728728
'cipd_version': <String>['refs/heads/main'],
729+
'github_link': <String>['https://github.com/flutter/flutter/pull/1'],
729730
},
730731
input: const Input(properties: {'test': 'abc'}),
731732
),
@@ -757,7 +758,7 @@ void main() {
757758
as Map<String, dynamic>;
758759
expect(userData, <String, dynamic>{
759760
'check_run_id': 1,
760-
'commit_branch': 'main',
761+
'commit_branch': 'master',
761762
'commit_sha': 'ec26c3e57ca3a959ca5aad62de7213c562f8c821',
762763
'repo_owner': 'flutter',
763764
'repo_name': 'flutter',

0 commit comments

Comments
 (0)