Files
sdk/tools/bots/add_fields.dart
T
William Hesse 9b7b0d4631 Add commit hash to results upload on builders
Change-Id: I395ea68d7c6f7f45d665279e3dbc0b4f60d3ac1c
Reviewed-on: https://dart-review.googlesource.com/74624
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2018-09-12 17:15:39 +00:00

17 lines
673 B
Dart

import 'dart:io';
import 'dart:convert';
/// This script reads the JSON object from the file at args[0] and
/// adds data to it from the environment. Args[1] should be the timestamp
/// (as epoch seconds) of the current Git commit being tested.
/// Args[2] should be the hash of the current Git commit under test.
void main(List<String> args) {
Map<String, dynamic> map = jsonDecode(File(args[0]).readAsStringSync());
final env = Platform.environment;
map['commit_time'] = args[1];
map['commit_hash'] = args[2];
map['builder_name'] = env['SWARMING_BOT_ID'];
map['bot_name'] = env['BUILDBOT_BUILDERNAME'];
File(args[0]).writeAsStringSync(jsonEncode(map));
}