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 Nov 9, 2023
2 parents bda6333 + db39fec commit 1a1a89a
Show file tree
Hide file tree
Showing 43 changed files with 13,578 additions and 283 deletions.
15 changes: 15 additions & 0 deletions .ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ targets:
recipe: cocoon/cocoon
properties:
add_recipes_cq: "true"
runIf:
- .ci.yaml
- analyze/**
- app_dart/**
- auto_submit/**
- cipd_packages/**
- cloud_build/**
- dashboard/**
- dev/**
- licenses/**
- packages/**
- test_utilities/**
- tooling/**

- name: Linux device_doctor
recipe: cocoon/cipd
Expand Down Expand Up @@ -145,3 +158,5 @@ targets:
recipe: infra/ci_yaml
properties:
backfill: "false"
runIf:
- .ci.yaml
5 changes: 5 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,8 @@ updates:
- "autosubmit"
allow:
- dependency-name: "github.com/slsa-framework/slsa-verifier/v2"
# Npm ecosystem.
- package-ecosystem: 'npm'
directory: '/gh_actions/third_party/no-response'
schedule:
interval: 'daily'
40 changes: 40 additions & 0 deletions .github/workflows/no-response_publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: no-response-publish

# Declare default permissions as read only.
permissions: read-all

on:
release:
types: [published, edited]
branches:
- main
paths:
- 'gh_actions/third_party/no-response/**'
- '.github/workflows/no-response_test.yaml'
- '.github/workflows/no-response_publish.yaml'
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
if: ${{ github.repository == 'flutter/cocoon' }}
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
ref: ${{ github.event.release.tag_name }}
sparse-checkout: 'gh_actions/third_party/no-response'
sparse-checkout-cone-mode: false
- name: move_package_to_root
run: |
mv -f gh_actions/third_party/no-response/{.[!.],}* ./
rm -rf gh_actions
- name: ls
run: ls -la
- name: npm_ci
run: npm ci
- name: npm_run_build
run: npm run build
- uses: JasonEtco/build-and-tag-action@dd5e4991048c325f6d85b4155e586fc211c644da
env:
GITHUB_TOKEN: ${{ secrets.FLUTTERGITHUBBOT_TOKEN }}
34 changes: 34 additions & 0 deletions .github/workflows/no-response_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: no-response-test

# Declare default permissions as read only.
permissions: read-all

on:
pull_request:
paths:
- 'gh_actions/third_party/no-response/**'
- '.github/workflows/no-response_test.yaml'
- '.github/workflows/no-response_publish.yaml'
jobs:
unitTest:
runs-on: ubuntu-latest
if: ${{ github.repository == 'flutter/cocoon' }}
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
ref: ${{ github.event.release.tag_name }}
sparse-checkout: 'gh_actions/third_party/no-response'
sparse-checkout-cone-mode: false
- name: move_package_to_root
run: |
mv -f gh_actions/third_party/no-response/{.[!.],}* ./
rm -rf gh_actions
- name: ls
run: ls -la
- name: npm_ci
run: npm ci
- name: npm_run_ci
run: npm run ci
- name: npm_run_build
run: npm run build
3 changes: 3 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ cipd_packages/codesign/** @Xil
cipd_packages/device_doctor/** @yusuf-goog
cipd_packages/doxygen/** @gspencergoog
cipd_packages/ruby/** @godofredoc

## gh_actions
gh_actions/third_party/no-response/** @godofredoc
2 changes: 1 addition & 1 deletion app_dart/integration_test/data/cocoon_config.json
Original file line number Diff line number Diff line change
@@ -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":"Mac_arm64 device_doctor","properties":{"script":"cipd_packages/device_doctor/tool/build.sh","cipd_name":"flutter/device_doctor/mac-arm64","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","dependencies":"[\n {\"dependency\": \"cmake\", \"version\": \"build_id:8787856497187628321\"}\n]"},"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_arm64 codesign","properties":{"script":"cipd_packages/codesign/tool/build.sh","cipd_name":"flutter/codesign/mac-arm64","device_type":"none"},"runIf":["cipd_packages/codesign/**",".ci.yaml"],"recipe":"cocoon/cipd"},{"name":"Mac ruby","timeout":60,"properties":{"script":"cipd_packages/ruby/tools/build.sh","cipd_name":"flutter/ruby/mac-amd64","device_os":"iOS","contexts":"[\n \"osx_sdk_devicelab\"\n]","$flutter/osx_sdk":"{\n \"sdk_version\": \"14e300c\"\n}"},"runIf":["cipd_packages/ruby/**",".ci.yaml"],"recipe":"cocoon/cipd"},{"name":"Mac_arm64 ruby","timeout":60,"properties":{"script":"cipd_packages/ruby/tools/build.sh","cipd_name":"flutter/ruby/mac-arm64","device_os":"iOS","contexts":"[\n \"osx_sdk_devicelab\"\n]","$flutter/osx_sdk":"{\n \"sdk_version\": \"14e300c\"\n}"},"runIf":["cipd_packages/ruby/**",".ci.yaml"],"recipe":"cocoon/cipd"},{"name":"Linux ci_yaml roller","properties":{"backfill":"false"},"recipe":"infra/ci_yaml"}],"enabledBranches":["main"],"platformProperties":{"linux":{"properties":{"os":"Linux","device_type":"none"}},"mac":{"properties":{"os":"Mac-12|Mac-13","cpu":"x86"}},"mac_arm64":{"properties":{"os":"Mac-12|Mac-13","cpu":"arm64"}},"windows":{"properties":{"os":"Windows","device_type":"none"}}}}
{"targets":[{"name":"Linux Cocoon","properties":{"add_recipes_cq":"true"},"runIf":[".ci.yaml","analyze/**","app_dart/**","auto_submit/**","cipd_packages/**","cloud_build/**","dashboard/**","dev/**","licenses/**","packages/**","test_utilities/**","tooling/**"],"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":"Mac_arm64 device_doctor","properties":{"script":"cipd_packages/device_doctor/tool/build.sh","cipd_name":"flutter/device_doctor/mac-arm64","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","dependencies":"[\n {\"dependency\": \"cmake\", \"version\": \"build_id:8787856497187628321\"}\n]"},"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_arm64 codesign","properties":{"script":"cipd_packages/codesign/tool/build.sh","cipd_name":"flutter/codesign/mac-arm64","device_type":"none"},"runIf":["cipd_packages/codesign/**",".ci.yaml"],"recipe":"cocoon/cipd"},{"name":"Mac ruby","timeout":60,"properties":{"script":"cipd_packages/ruby/tools/build.sh","cipd_name":"flutter/ruby/mac-amd64","device_os":"iOS","contexts":"[\n \"osx_sdk_devicelab\"\n]","$flutter/osx_sdk":"{\n \"sdk_version\": \"14e300c\"\n}"},"runIf":["cipd_packages/ruby/**",".ci.yaml"],"recipe":"cocoon/cipd"},{"name":"Mac_arm64 ruby","timeout":60,"properties":{"script":"cipd_packages/ruby/tools/build.sh","cipd_name":"flutter/ruby/mac-arm64","device_os":"iOS","contexts":"[\n \"osx_sdk_devicelab\"\n]","$flutter/osx_sdk":"{\n \"sdk_version\": \"14e300c\"\n}"},"runIf":["cipd_packages/ruby/**",".ci.yaml"],"recipe":"cocoon/cipd"},{"name":"Linux ci_yaml roller","properties":{"backfill":"false"},"runIf":[".ci.yaml"],"recipe":"infra/ci_yaml"}],"enabledBranches":["main"],"platformProperties":{"linux":{"properties":{"os":"Linux","device_type":"none"}},"mac":{"properties":{"os":"Mac-12|Mac-13","cpu":"x86"}},"mac_arm64":{"properties":{"os":"Mac-12|Mac-13","cpu":"arm64"}},"windows":{"properties":{"os":"Windows","device_type":"none"}}}}
11 changes: 8 additions & 3 deletions app_dart/lib/src/model/appengine/task.dart
Original file line number Diff line number Diff line change
Expand Up @@ -449,10 +449,15 @@ class Task extends Model<int> {
return status = statusSucceeded;
case Result.canceled:
return status = statusCancelled;
case Result.infraFailure:
return status = statusInfraFailure;
case Result.failure:
return status = statusFailed;
// Note that `Result` does not support `infraFailure`:
// https://github.com/luci/luci-go/blob/main/common/api/buildbucket/buildbucket/v1/buildbucket-gen.go#L247-L251
// To determine an infra failure status, we need to combine `Result.failure` and `FailureReason.infraFailure`.
if (build.failureReason == FailureReason.infraFailure) {
return status = statusInfraFailure;
} else {
return status = statusFailed;
}
default:
throw BadRequestException('${build.result} is unknown');
}
Expand Down
2 changes: 0 additions & 2 deletions app_dart/lib/src/model/luci/push_message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,6 @@ enum Result {
canceled,
@JsonValue('FAILURE')
failure,
@JsonValue('INFRA_FAILURE')
infraFailure,
@JsonValue('SUCCESS')
success,
}
Expand Down
1 change: 0 additions & 1 deletion app_dart/lib/src/model/luci/push_message.g.dart

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

Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,9 @@ class GithubWebhookSubscription extends SubscriptionHandler {
// Exempt paths.
filename.startsWith('dev/devicelab/lib/versions/gallery.dart') ||
filename.startsWith('dev/integration_tests') ||
filename.startsWith('impeller/fixtures') ||
filename.startsWith('impeller/golden_tests') ||
filename.startsWith('impeller/playground') ||
filename.startsWith('shell/platform/embedder/tests') ||
filename.startsWith('shell/platform/embedder/fixtures');
}
Expand Down
11 changes: 10 additions & 1 deletion app_dart/lib/src/request_handlers/github_rate_limit_status.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import '../foundation/utils.dart';
import '../request_handling/body.dart';
import '../request_handling/request_handler.dart';
import '../service/github_service.dart';
import '../service/logging.dart';

@immutable

Expand All @@ -35,10 +36,18 @@ class GithubRateLimitStatus extends RequestHandler<Body> {
final Map<String, dynamic> quotaUsage = (await githubService.getRateLimit()).toJson();
quotaUsage['timestamp'] = DateTime.now().toIso8601String();

final int remainingQuota = quotaUsage['remaining'] as int;
final int quotaLimit = quotaUsage['limit'] as int;
const double githubQuotaUsageSLO = 0.5;
if (remainingQuota < githubQuotaUsageSLO * quotaLimit) {
log.warning(
'Remaining GitHub quota is $remainingQuota, which is less than quota usage SLO ${githubQuotaUsageSLO * quotaLimit} (${githubQuotaUsageSLO * 100}% of the limit $quotaLimit)).',
);
}

/// Insert quota usage to BigQuery
const String githubQuotaTable = 'GithubQuotaUsage';
await insertBigquery(githubQuotaTable, quotaUsage, await config.createTabledataResourceApi());

return Body.forJson(quotaUsage);
}
}
1 change: 0 additions & 1 deletion app_dart/lib/src/service/github_checks_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ class GithubChecksService {
// tasks when builds timeout.
return github.CheckRunConclusion.failure;
case push_message.Result.failure:
case push_message.Result.infraFailure:
return github.CheckRunConclusion.failure;
case push_message.Result.success:
return github.CheckRunConclusion.success;
Expand Down
4 changes: 2 additions & 2 deletions app_dart/lib/src/service/luci_build_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ class LuciBuildService {
Set<String> availableBuilderSet;
try {
availableBuilderSet = await getAvailableBuilderSet(project: 'flutter', bucket: 'prod');
} on BuildBucketException catch (error) {
} catch (error) {
log.severe('Failed to get buildbucket builder list due to $error');
return toBeScheduled;
}
Expand All @@ -506,7 +506,7 @@ class LuciBuildService {
try {
messageIds = await pubsub.publish('scheduler-requests', batchRequest);
log.info('Published $messageIds for commit ${commit.sha}');
} on DetailedApiRequestError catch (error) {
} catch (error) {
log.severe('Failed to publish message to pub/sub due to $error');
return toBeScheduled;
}
Expand Down
18 changes: 18 additions & 0 deletions app_dart/test/model/task_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,24 @@ void main() {
task.updateFromBuild(build);
expect(task.status, Task.statusCancelled);
});

test('handles infra failed build', () {
final pm.Build build = generatePushMessageBuild(
1,
status: pm.Status.completed,
result: pm.Result.failure,
failureReason: pm.FailureReason.infraFailure,
);
final Task task = generateTask(
1,
buildNumber: 1,
status: Task.statusNew,
);

expect(task.status, Task.statusNew);
task.updateFromBuild(build);
expect(task.status, Task.statusInfraFailure);
});
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,9 @@ void main() {
(_) => Stream<PullRequestFile>.fromIterable(<PullRequestFile>[
PullRequestFile()..filename = 'dev/devicelab/lib/versions/gallery.dart',
PullRequestFile()..filename = 'dev/integration_tests/some_package/android/build.gradle',
PullRequestFile()..filename = 'impeller/fixtures/dart_tests.dart',
PullRequestFile()..filename = 'impeller/golden_tests/golden_tests.cc',
PullRequestFile()..filename = 'impeller/playground/playground.cc',
PullRequestFile()..filename = 'shell/platform/embedder/tests/embedder_test_context.cc',
PullRequestFile()..filename = 'shell/platform/embedder/fixtures/main.dart',
]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@ void main() {
tester.message = createBuildbucketPushMessage(
'COMPLETED',
builderName: 'Linux A',
result: 'INFRA_FAILURE',
result: 'FAILURE',
failureReason: 'INFRA_FAILURE',
userData: '{\\"task_key\\":\\"${task.key.id}\\", \\"commit_key\\":\\"${task.key.parent?.id}\\"}',
);

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 @@ -167,6 +167,7 @@ push_message.Build generatePushMessageBuild(
DateTime? completedTimestamp,
DateTime? createdTimestamp,
DateTime? startedTimestamp,
push_message.FailureReason? failureReason,
}) {
tags ??= <String>[];
tags.add('build_address:luci.flutter.prod/$name/$buildNumber');
Expand All @@ -181,6 +182,7 @@ push_message.Build generatePushMessageBuild(
completedTimestamp: completedTimestamp,
startedTimestamp: startedTimestamp,
tags: tags,
failureReason: failureReason,
);
}

Expand Down
2 changes: 1 addition & 1 deletion cipd_packages/codesign/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dev_dependencies:
lints: 3.0.0
test: 1.24.9
dependencies:
archive: 3.4.6
archive: 3.4.9
args: 2.4.2
crypto: 3.0.3
fake_async: 1.3.1
Expand Down
4 changes: 4 additions & 0 deletions cron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ cron:
url: /api/push-build-status-to-github?repo=flutter/engine
schedule: every 2 minutes

- description: sends build status to GitHub to annotate packages PRs and commits
url: /api/push-build-status-to-github?repo=flutter/packages
schedule: every 2 minutes

- description: push github rate limit history to bigquery
url: /api/public/github-rate-limit-status
schedule: every 1 minutes
Expand Down
31 changes: 31 additions & 0 deletions dashboard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,34 @@ The tests require a linux host to be updated:
```sh
flutter test --update-goldens
```

## Deploying

### Web

Cocoon has a daily Cloud Build trigger that will publish this to
https://flutter-dashboard-appspot.com.

### Playstore

#### Set up

Download signing key from Valentine (under [email protected]). Save to
`$HOME/upload-keystore.jks`

Create `android/key.properties`

```sh
storePassword=$password
keyPassword=$password
keyAlias=upload
storeFile=$HOME/upload-keystore.jks
```

#### Publishing

`flutter build appbundle`

We ship debug mode as it makes it easy to debug issues in production.

In the Play Console for [email protected], upload the new app.aab output.
26 changes: 19 additions & 7 deletions dashboard/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
namespace "com.appspot.flutter_dashboard.dashboard"
compileSdkVersion flutter.compileSdkVersion
Expand Down Expand Up @@ -50,13 +56,19 @@ android {
versionName flutterVersionName
}

buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}

flutter {
Expand Down
Binary file modified dashboard/assets/linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dashboard/assets/windows.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 1a1a89a

Please sign in to comment.