Skip to content

Commit

Permalink
Merge branch 'flutter:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardoamador authored Dec 4, 2023
2 parents 59decbb + 3459092 commit da68249
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 31 deletions.
2 changes: 1 addition & 1 deletion app_dart/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


# Dart Docker official images can be found here: https://hub.docker.com/_/dart
FROM dart:beta@sha256:8ecef6dda0e56347ce8ec6c5b114e7a6c599d041651c39b57eae160e178f4c9a
FROM dart:beta@sha256:a719c761acc751554a81f71ed78bff3ff3525b7df5e78e95d2a1c6403b663d4b

WORKDIR /app

Expand Down
4 changes: 3 additions & 1 deletion app_dart/lib/src/model/ci_yaml/target.dart
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ class Target {
}

Map<String, Object> _getTargetProperties() {
final Map<String, Object> properties = <String, Object>{};
final Map<String, Object> properties = <String, Object>{
'recipe': value.recipe,
};
for (String key in value.properties.keys) {
properties[key] = _parseProperty(key, value.properties[key]!);
}
Expand Down
17 changes: 11 additions & 6 deletions app_dart/lib/src/service/branch_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,17 @@ class BranchService {
required gh.RepositorySlug slug,
required String branchName,
}) async {
return (await githubService.getFileContent(
slug,
'bin/internal/release-candidate-branch.version',
ref: branchName,
))
.trim();
return githubService
.getFileContent(
slug,
'bin/internal/release-candidate-branch.version',
ref: branchName,
)
.then((String value) => value.trim())
.onError((e, _) {
log.severe('Could not fetch release version file: $e');
return '';
});
}

/// Retrieve the latest canidate branch from all candidate branches.
Expand Down
2 changes: 2 additions & 0 deletions app_dart/test/model/ci_yaml/target_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ void main() {
expect(target.getProperties(), <String, Object>{
'bringup': false,
'dependencies': <String>[],
'recipe': 'devicelab/devicelab',
});
});

Expand Down Expand Up @@ -91,6 +92,7 @@ void main() {
'runtime_versions': ['ios-13-0', 'ios-15-0'],
'sdk_version': '14e222b',
},
'recipe': 'devicelab/devicelab',
});
});

Expand Down
36 changes: 35 additions & 1 deletion app_dart/test/service/branch_service_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'package:mockito/mockito.dart';
import 'package:retry/retry.dart';
import 'package:test/test.dart';

import '../request_handlers/check_flaky_builders_test_data.dart';
import '../src/datastore/fake_datastore.dart';
import '../src/service/fake_gerrit_service.dart';
import '../src/service/fake_github_service.dart';
Expand All @@ -26,10 +27,11 @@ void main() {
late FakeGerritService gerritService;
late FakeGithubService githubService;
late MockRepositoriesService repositories;
late MockGitHub github;

setUp(() {
db = FakeDatastoreDB();
final MockGitHub github = MockGitHub();
github = MockGitHub();
githubService = FakeGithubService(client: github);
repositories = MockRepositoriesService();
when(github.repositories).thenReturn(repositories);
Expand All @@ -53,6 +55,18 @@ void main() {
when(githubService.github.repositories).thenReturn(mockRepositoriesService);
});

test('return empty when branch version file does not exist', () async {
final gh.Branch candidateBranch = generateBranch(3, name: 'flutter-3.4-candidate.5', sha: '789dev');
when(mockRepositoriesService.listBranches(any)).thenAnswer((_) => Stream.value(candidateBranch));
when(mockRepositoriesService.getContents(any, any)).thenThrow(gh.GitHubError(github, '404 file not found'));
final List<Map<String, String>> result =
await branchService.getReleaseBranches(githubService: githubService, slug: Config.cocoonSlug);
final betaBranch = result.singleWhere((Map<String, String> branch) => branch['name'] == 'beta');
expect(betaBranch['branch']?.isEmpty, isTrue);
final stableBranch = result.singleWhere((Map<String, String> branch) => branch['name'] == 'stable');
expect(stableBranch['branch']?.isEmpty, isTrue);
});

test('return beta, stable, and latest candidate branches', () async {
final gh.Branch stableBranch = generateBranch(1, name: 'flutter-2.13-candidate.0', sha: '123stable');
final gh.Branch betaBranch = generateBranch(2, name: 'flutter-3.2-candidate.5', sha: '456beta');
Expand All @@ -64,6 +78,26 @@ void main() {
final gh.Branch candidateCherrypickBranch =
generateBranch(6, name: 'cherry-picks-flutter-3.11-candidate.3', sha: 'bad');

when(
mockRepositoriesService.getContents(
Config.flutterSlug,
'bin/internal/release-candidate-branch.version',
ref: 'beta',
),
).thenAnswer(
(_) async => gh.RepositoryContents(file: gh.GitHubFile(content: gitHubEncode('flutter-3.2-candidate.5\n'))),
);

when(
mockRepositoriesService.getContents(
Config.flutterSlug,
'bin/internal/release-candidate-branch.version',
ref: 'stable',
),
).thenAnswer(
(_) async => gh.RepositoryContents(file: gh.GitHubFile(content: gitHubEncode('flutter-2.13-candidate.0\n'))),
);

when(mockRepositoriesService.listBranches(any)).thenAnswer((Invocation invocation) {
return Stream.fromIterable([
candidateBranch,
Expand Down
4 changes: 4 additions & 0 deletions app_dart/test/service/luci_build_service_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ void main() {
'git_url': 'https://github.com/flutter/flutter',
'git_ref': 'refs/pull/123/head',
'exe_cipd_version': 'refs/heads/main',
'recipe': 'devicelab/devicelab',
});
expect(dimensions.length, 1);
expect(dimensions[0].key, 'os');
Expand Down Expand Up @@ -391,6 +392,7 @@ void main() {
'git_url': 'https://github.com/flutter/flutter',
'git_ref': 'refs/pull/123/head',
'exe_cipd_version': 'refs/heads/main',
'recipe': 'devicelab/devicelab',
LuciBuildService.propertiesGithubBuildLabelName: [
'${LuciBuildService.githubBuildLabelPrefix}hello',
'${LuciBuildService.githubBuildLabelPrefix}world',
Expand Down Expand Up @@ -439,6 +441,7 @@ void main() {
generateTarget(
1,
properties: <String, String>{
'recipe': 'devicelab/devicelab',
'os': 'debian-10.12',
},
slug: Config.packagesSlug,
Expand Down Expand Up @@ -479,6 +482,7 @@ void main() {
'git_branch': 'master',
'exe_cipd_version': 'refs/heads/master',
'os': 'debian-10.12',
'recipe': 'devicelab/devicelab',
});
expect(scheduleBuild.exe, <String, String>{
'cipdVersion': 'refs/heads/master',
Expand Down
11 changes: 1 addition & 10 deletions app_dart/test/src/service/fake_github_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,7 @@ class FakeGithubService implements GithubService {

@override
Future<String> getFileContent(RepositorySlug slug, String path, {String? ref}) async {
if (path == 'bin/internal/release-candidate-branch.version') {
if (ref == 'beta') {
return 'flutter-3.2-candidate.5\n';
} else if (ref == 'stable') {
return 'flutter-2.13-candidate.0\n';
}
return Future<String>.value('');
} else {
return Future<String>.value('');
}
return GithubService(github).getFileContent(slug, path, ref: ref);
}

@override
Expand Down
2 changes: 2 additions & 0 deletions app_dart/test/src/utilities/entity_generators.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ Target generateTarget(
bool? bringup,
github.RepositorySlug? slug,
pb.SchedulerSystem? schedulerSystem,
String recipe = 'devicelab/devicelab',
}) {
final pb.SchedulerConfig config = schedulerConfig ?? exampleConfig.config;
if (platformProperties != null && platformDimensions != null) {
Expand All @@ -129,6 +130,7 @@ Target generateTarget(
runIf: runIf ?? <String>[],
runIfNot: runIfNot ?? <String>[],
bringup: bringup ?? false,
recipe: recipe,
scheduler: schedulerSystem ?? pb.SchedulerSystem.cocoon,
),
);
Expand Down
2 changes: 1 addition & 1 deletion auto_submit/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


# Dart Docker official images can be found here: https://hub.docker.com/_/dart
FROM dart:beta@sha256:041c5624cabe298d12774cd03969e8139c02e73055d2f3edd7f5d1c2f7e943a3
FROM dart:beta@sha256:a719c761acc751554a81f71ed78bff3ff3525b7df5e78e95d2a1c6403b663d4b

WORKDIR /app

Expand Down
14 changes: 7 additions & 7 deletions gh_actions/third_party/no-response/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion gh_actions/third_party/no-response/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"devDependencies": {
"@octokit/webhooks-types": "^7.3.1",
"@types/jest": "^29.5.10",
"@types/node": "^20.10.1",
"@types/node": "^20.10.2",
"@typescript-eslint/parser": "^6.13.1",
"@vercel/ncc": "^0.38.1",
"eslint": "^8.54.0",
Expand Down
6 changes: 3 additions & 3 deletions triage_bot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ The following updates are among those that update the model:
- changes to labels
- updates to who is a team member
- changes to an issue's lock state

Most of these updates are just a matter of tracking whether the issue
is still open, and whether the update came from a team member, so that
we can track how long it's been since an issue was updated.
Expand All @@ -54,7 +54,7 @@ The following updates are among those repeated on Discord:
- when comments are left on issues and PRs
- when issues are locked or unlocked
- when the wiki is updated

The channels used vary based on the message. Most of them go to
`#github2`, some go to `#hidden-chat`.

Expand Down Expand Up @@ -114,7 +114,7 @@ invariants applied, as follows:
automatically unlocked.
- Issues that have gained a lot of thumbs-up recently are flagged for
additional triage.

## The self-test issue

Every now and then (`selfTestPeriod`), an issue is filed to test the
Expand Down

0 comments on commit da68249

Please sign in to comment.