Add branch to cirrus log url (#832)
* add branch to cirrus log url
* fix test
* formatting
diff --git a/app_dart/lib/src/model/proto/internal/commit.pb.dart b/app_dart/lib/src/model/proto/internal/commit.pb.dart
index a637509..0a91731 100644
--- a/app_dart/lib/src/model/proto/internal/commit.pb.dart
+++ b/app_dart/lib/src/model/proto/internal/commit.pb.dart
@@ -21,6 +21,7 @@
..aOS(4, 'author')
..aOS(5, 'authorAvatarUrl', protoName: 'authorAvatarUrl')
..aOS(6, 'repository')
+ ..aOS(7, 'branch')
..hasRequiredFields = false;
Commit._() : super();
@@ -117,4 +118,16 @@
$core.bool hasRepository() => $_has(5);
@$pb.TagNumber(6)
void clearRepository() => clearField(6);
+
+ @$pb.TagNumber(7)
+ $core.String get branch => $_getSZ(6);
+ @$pb.TagNumber(7)
+ set branch($core.String v) {
+ $_setString(6, v);
+ }
+
+ @$pb.TagNumber(7)
+ $core.bool hasBranch() => $_has(6);
+ @$pb.TagNumber(7)
+ void clearBranch() => clearField(7);
}
diff --git a/app_dart/lib/src/model/proto/internal/commit.proto b/app_dart/lib/src/model/proto/internal/commit.proto
index b332efa..19ed350 100644
--- a/app_dart/lib/src/model/proto/internal/commit.proto
+++ b/app_dart/lib/src/model/proto/internal/commit.proto
@@ -13,4 +13,5 @@
optional string author = 4;
optional string authorAvatarUrl = 5;
optional string repository = 6;
+ optional string branch = 7;
}
diff --git a/app_flutter/lib/logic/qualified_task.dart b/app_flutter/lib/logic/qualified_task.dart
index 22e3cdb..b86eb57 100644
--- a/app_flutter/lib/logic/qualified_task.dart
+++ b/app_flutter/lib/logic/qualified_task.dart
@@ -101,7 +101,7 @@
/// Otherwise, we can redirect to the page that is closest to the logs for [Task].
String logUrl(Task task, {Commit commit}) {
if (task.stageName == StageName.cirrus && commit != null) {
- return '$_cirrusLogUrl/${commit.sha}';
+ return '$_cirrusLogUrl/${commit.sha}?branch=${commit.branch}';
} else if (QualifiedTask.fromTask(task).isExternal) {
// Currently this is just LUCI, but is a catch all if new stages are added.
return QualifiedTask.fromTask(task).sourceConfigurationUrl;
diff --git a/app_flutter/lib/service/appengine_cocoon.dart b/app_flutter/lib/service/appengine_cocoon.dart
index fc72a09..a6610a8 100644
--- a/app_flutter/lib/service/appengine_cocoon.dart
+++ b/app_flutter/lib/service/appengine_cocoon.dart
@@ -369,7 +369,8 @@
..sha = commit['Sha']
..author = author['Login']
..authorAvatarUrl = author['avatar_url']
- ..repository = checklist['FlutterRepositoryPath'];
+ ..repository = checklist['FlutterRepositoryPath']
+ ..branch = checklist['Branch'];
}
List<Stage> _stagesFromJson(List<Object> json) {
diff --git a/app_flutter/lib/service/dev_cocoon.dart b/app_flutter/lib/service/dev_cocoon.dart
index 48bb69b..fa0e8bf 100644
--- a/app_flutter/lib/service/dev_cocoon.dart
+++ b/app_flutter/lib/service/dev_cocoon.dart
@@ -123,7 +123,8 @@
..authorAvatarUrl = 'https://avatars2.githubusercontent.com/u/${2148558 + author}?v=4'
..repository = 'flutter/cocoon'
..sha = commitTimestamp.hashCode.toRadixString(16).padLeft(32, '0')
- ..timestamp = Int64(commitTimestamp);
+ ..timestamp = Int64(commitTimestamp)
+ ..branch = 'master';
}
static const List<String> _stages = <String>[
diff --git a/app_flutter/test/logic/qualified_task_test.dart b/app_flutter/test/logic/qualified_task_test.dart
index 69e7319..ab4663f 100644
--- a/app_flutter/test/logic/qualified_task_test.dart
+++ b/app_flutter/test/logic/qualified_task_test.dart
@@ -17,7 +17,12 @@
expect(logUrl(luciTask), 'https://ci.chromium.org/p/flutter/builders/luci.flutter.prod/Mac');
final Task cirrusTask = Task()..stageName = 'cirrus';
- expect(logUrl(cirrusTask, commit: Commit()..sha = 'abc123'), 'https://cirrus-ci.com/build/flutter/flutter/abc123');
+ expect(
+ logUrl(cirrusTask,
+ commit: Commit()
+ ..sha = 'abc123'
+ ..branch = 'master'),
+ 'https://cirrus-ci.com/build/flutter/flutter/abc123?branch=master');
expect(logUrl(cirrusTask), 'https://cirrus-ci.com/github/flutter/flutter/master');
});
diff --git a/app_flutter/test/service/appengine_cocoon_test.dart b/app_flutter/test/service/appengine_cocoon_test.dart
index fd8dd70..7bd870d 100644
--- a/app_flutter/test/service/appengine_cocoon_test.dart
+++ b/app_flutter/test/service/appengine_cocoon_test.dart
@@ -42,7 +42,8 @@
..sha = 'ShaShankHash'
..author = 'ShaSha'
..authorAvatarUrl = 'https://flutter.dev'
- ..repository = 'flutter/cocoon')
+ ..repository = 'flutter/cocoon'
+ ..branch = 'master')
..stages.add(Stage()
..name = 'devicelab'
..taskStatus = 'Succeeded'
@@ -146,7 +147,8 @@
..sha = 'ShaShankHash'
..author = 'ShaSha'
..authorAvatarUrl = 'https://flutter.dev'
- ..repository = 'flutter/cocoon')
+ ..repository = 'flutter/cocoon'
+ ..branch = 'master')
..stages.add(Stage()
..name = 'chromebot'
..taskStatus = 'Succeeded'
diff --git a/app_flutter/test/widgets/task_overlay_test.dart b/app_flutter/test/widgets/task_overlay_test.dart
index 87c465b..3fddd48 100644
--- a/app_flutter/test/widgets/task_overlay_test.dart
+++ b/app_flutter/test/widgets/task_overlay_test.dart
@@ -449,7 +449,7 @@
log,
<Matcher>[
isMethodCall('launch', arguments: <String, Object>{
- 'url': 'https://cirrus-ci.com/build/flutter/flutter/24e8c0a2',
+ 'url': 'https://cirrus-ci.com/build/flutter/flutter/24e8c0a2?branch=',
'useSafariVC': true,
'useWebView': false,
'enableJavaScript': false,