Skip to content

Commit

Permalink
Remove obtaining custom name from build properties (#2923)
Browse files Browse the repository at this point in the history
Remove the logic for getting the custom build name from build properties. This can instead be done by publishing the custom name in the message.
  • Loading branch information
drewroengoogle authored Jul 13, 2023
1 parent aa4f7d4 commit ad18905
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 deletions.
14 changes: 2 additions & 12 deletions app_dart/lib/src/request_handlers/dart_internal_subscription.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,25 +57,15 @@ class DartInternalSubscription extends SubscriptionHandler {
log.info("Creating build request object");
final GetBuildRequest request = GetBuildRequest(
id: buildbucketId.toString(),
fields:
"id,builder,number,createdBy,createTime,startTime,endTime,updateTime,status,input.properties,input.gitilesCommit",
);

log.info(
"Calling buildbucket api to get build data for build $buildbucketId",
);
final Build build = await _getBuildFromBuildbucket(request);

// This is for handling subbuilds, based on the engine_v2 strategy of running
// builds under the same builder ({Platform} Engine Drone).
String? name;
if (build.input?.properties != null && build.input?.properties?["build"] != null) {
final Map<String, Object> buildProperties = build.input?.properties?["build"] as Map<String, Object>;
name = buildProperties["name"] as String;
}

log.info("Checking for existing task in datastore");
final Task? existingTask = await datastore.getTaskFromBuildbucketBuild(build, customName: name);
final Task? existingTask = await datastore.getTaskFromBuildbucketBuild(build);

late Task taskToInsert;
if (existingTask != null) {
Expand All @@ -84,7 +74,7 @@ class DartInternalSubscription extends SubscriptionHandler {
taskToInsert = existingTask;
} else {
log.info("Creating Task from Buildbucket result");
taskToInsert = await Task.fromBuildbucketBuild(build, datastore, customName: name);
taskToInsert = await Task.fromBuildbucketBuild(build, datastore);
}

log.info("Inserting Task into the datastore: ${taskToInsert.toString()}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ void main() {
const String project = "dart-internal";
const String bucket = "flutter";
const String builder = "Mac amazing_builder_tests";
const String propertiesBuildName = "Mac Unit_Test";
const int buildId = 123456;
const String fakeHash = "HASH12345";
const String fakeBranch = "test-branch";
Expand Down Expand Up @@ -77,9 +76,6 @@ void main() {
hash: fakeHash,
ref: "refs/heads/$fakeBranch",
),
properties: <String, Object>{
'build': <String, String>{'name': propertiesBuildName},
},
),
);
when(
Expand Down Expand Up @@ -136,7 +132,7 @@ void main() {
createTimestamp: startTime.millisecondsSinceEpoch,
endTimestamp: endTime.millisecondsSinceEpoch,
luciBucket: bucket,
name: propertiesBuildName,
name: builder,
stageName: "dart-internal",
startTimestamp: startTime.millisecondsSinceEpoch,
status: "Succeeded",
Expand Down Expand Up @@ -164,7 +160,7 @@ void main() {
createTimestamp: startTime.millisecondsSinceEpoch,
endTimestamp: endTime.millisecondsSinceEpoch,
luciBucket: bucket,
name: propertiesBuildName,
name: builder,
stageName: "dart-internal",
startTimestamp: startTime.millisecondsSinceEpoch,
status: "Succeeded",
Expand Down Expand Up @@ -220,7 +216,7 @@ void main() {
createTimestamp: startTime.millisecondsSinceEpoch,
endTimestamp: endTime.millisecondsSinceEpoch,
luciBucket: bucket,
name: propertiesBuildName,
name: builder,
stageName: "dart-internal",
startTimestamp: startTime.millisecondsSinceEpoch,
status: "Succeeded",
Expand Down

0 comments on commit ad18905

Please sign in to comment.