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.
void main(List<String> args) {
  Map<String, dynamic> map = jsonDecode(File(args[0]).readAsStringSync());
  final env = Platform.environment;
  map['commit_hash'] = env['BUILDBOT_REVISION'];
  map['commit_time'] = args[1];
  map['builder_name'] = env['SWARMING_BOT_ID'];
  map['bot_name'] = env['BUILDBOT_BUILDERNAME'];
  File(args[0]).writeAsStringSync(jsonEncode(map));
}

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));
}

Add commit hash to results upload on builders
Add commit hash to results upload on builders

Change-Id: I395ea68d7c6f7f45d665279e3dbc0b4f60d3ac1c
Reviewed-on: https://dart-review.googlesource.com/74624
Reviewed-by: Martin Kustermann <a35dd5b79fac84b2bb3b026a16b8becc55af5961@google.com>
Reviewed-by: Jonas Termansen <092ec58085ae5e368bc39d18752740ff81a2d09c@google.com>
