Unverified Commit b0950fd5 authored by Casey Hillers's avatar Casey Hillers Committed by GitHub

Revert "Use bucket to check staging test instead of builder name (#88908)" (#88969)

This reverts commit d36f246d.
parent 74ac7c47
......@@ -23,7 +23,6 @@ class UploadResultsCommand extends Command<void> {
argParser.addOption('luci-builder', help: '[Flutter infrastructure] Name of the LUCI builder being run on.');
argParser.addOption('test-status', help: 'Test status: Succeeded|Failed');
argParser.addOption('commit-time', help: 'Commit time in UNIX timestamp');
argParser.addOption('builder-bucket', help: '[Flutter infrastructure] Luci builder bucket the test is running in.');
}
@override
......@@ -41,7 +40,6 @@ class UploadResultsCommand extends Command<void> {
final String? builderName = argResults!['luci-builder'] as String?;
final String? testStatus = argResults!['test-status'] as String?;
final String? commitTime = argResults!['commit-time'] as String?;
final String? builderBucket = argResults!['builder-bucket'] as String?;
// Upload metrics to skia perf from test runner when `resultsPath` is specified.
if (resultsPath != null) {
......@@ -56,7 +54,6 @@ class UploadResultsCommand extends Command<void> {
gitBranch: gitBranch,
builderName: builderName,
testStatus: testStatus,
builderBucket: builderBucket,
);
}
}
......@@ -90,7 +90,6 @@ class Cocoon {
String? gitBranch,
String? builderName,
String? testStatus,
String? builderBucket,
}) async {
Map<String, dynamic> resultsJson = <String, dynamic>{};
if (resultsPath != null) {
......@@ -103,7 +102,7 @@ class Cocoon {
resultsJson['NewStatus'] = testStatus;
}
resultsJson['TestFlaky'] = isTestFlaky ?? false;
if (_shouldUpdateCocoon(resultsJson, builderBucket: builderBucket)) {
if (_shouldUpdateCocoon(resultsJson)) {
await retry(
() async => _sendUpdateTaskRequest(resultsJson).timeout(Duration(seconds: requestTimeoutLimit)),
retryIf: (Exception e) => e is SocketException || e is TimeoutException || e is ClientException,
......@@ -113,9 +112,10 @@ class Cocoon {
}
/// Only post-submit tests on `master` are allowed to update in cocoon.
bool _shouldUpdateCocoon(Map<String, dynamic> resultJson, {String? builderBucket = 'prod'}) {
bool _shouldUpdateCocoon(Map<String, dynamic> resultJson) {
const List<String> supportedBranches = <String>['master'];
return supportedBranches.contains(resultJson['CommitBranch']) && builderBucket != 'staging';
return supportedBranches.contains(resultJson['CommitBranch']) &&
!resultJson['BuilderName'].toString().toLowerCase().contains('staging');
}
/// Write the given parameters into an update task request and store the JSON in [resultsPath].
......
......@@ -353,14 +353,14 @@ void main() {
const String updateTaskJson = '{'
'"CommitBranch":"master",'
'"CommitSha":"$commitSha",'
'"BuilderName":"builderAbc",'
'"BuilderName":"Linux_staging_test",'
'"NewStatus":"Succeeded",'
'"ResultData":{"i":0.0,"j":0.0,"not_a_metric":"something"},'
'"BenchmarkScoreKeys":["i","j"]}';
fs.file(resultsPath).writeAsStringSync(updateTaskJson);
// This will fail if it decided to upload results
await cocoon.sendTaskStatus(resultsPath: resultsPath, builderBucket: 'staging');
await cocoon.sendTaskStatus(resultsPath: resultsPath);
});
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment