skip staging update (#89137)

This commit is contained in:
keyonghan
2021-08-30 09:26:05 -07:00
committed by GitHub
parent 0c65de1616
commit e311e3b3ef
4 changed files with 61 additions and 28 deletions

View File

@@ -75,21 +75,22 @@ class Cocoon {
return _commitSha = result.stdout as String;
}
/// Upload the JSON results in [resultsPath] to Cocoon.
/// Update test status to Cocoon.
///
/// Flutter infrastructure's workflow is:
/// 1. Run DeviceLab test, writing results to a known path
/// 1. Run DeviceLab test
/// 2. Request service account token from luci auth (valid for at least 3 minutes)
/// 3. Upload results from (1) to Cocoon
/// 3. Update test status from (1) to Cocoon
///
/// The `resultsPath` is not available for all tests. When it doesn't show up, we
/// need to append `CommitBranch`, `CommitSha`, and `BuilderName`.
Future<void> sendResultsPath({
Future<void> sendTaskStatus({
String? resultsPath,
bool? isTestFlaky,
String? gitBranch,
String? builderName,
String? testStatus,
String? builderBucket,
}) async {
Map<String, dynamic> resultsJson = <String, dynamic>{};
if (resultsPath != null) {
@@ -102,8 +103,7 @@ class Cocoon {
resultsJson['NewStatus'] = testStatus;
}
resultsJson['TestFlaky'] = isTestFlaky ?? false;
const List<String> supportedBranches = <String>['master'];
if (supportedBranches.contains(resultsJson['CommitBranch'])) {
if (_shouldUpdateCocoon(resultsJson, builderBucket ?? 'prod')) {
await retry(
() async => _sendUpdateTaskRequest(resultsJson).timeout(Duration(seconds: requestTimeoutLimit)),
retryIf: (Exception e) => e is SocketException || e is TimeoutException || e is ClientException,
@@ -112,6 +112,12 @@ class Cocoon {
}
}
/// Only post-submit tests on `master` are allowed to update in cocoon.
bool _shouldUpdateCocoon(Map<String, dynamic> resultJson, String builderBucket) {
const List<String> supportedBranches = <String>['master'];
return supportedBranches.contains(resultJson['CommitBranch']) && builderBucket == 'prod';
}
/// Write the given parameters into an update task request and store the JSON in [resultsPath].
Future<void> writeTaskResultToFile({
String? builderName,

View File

@@ -45,6 +45,7 @@ Future<FlutterDestination> connectFlutterDestination() async {
/// ]
/// }
List<MetricPoint> parse(Map<String, dynamic> resultsJson) {
print('Results to upload to skia perf: $resultsJson');
final List<String> scoreKeys =
(resultsJson['BenchmarkScoreKeys'] as List<dynamic>?)?.cast<String>() ?? const <String>[];
final Map<String, dynamic> resultData =
@@ -95,8 +96,13 @@ Future<void> upload(
);
}
/// Upload test metrics to metrics center.
Future<void> uploadToMetricsCenter(String? resultsPath, String? commitTime, String? taskName) async {
/// Upload JSON results to skia perf.
///
/// Flutter infrastructure's workflow is:
/// 1. Run DeviceLab test, writing results to a known path
/// 2. Request service account token from luci auth (valid for at least 3 minutes)
/// 3. Upload results from (1) to skia perf.
Future<void> uploadToSkiaPerf(String? resultsPath, String? commitTime, String? taskName) async {
int commitTimeSinceEpoch;
if (resultsPath == null) {
return;