Skip to content

Commit ddc2fcf

Browse files
Merge pull request #1094 from Kitware/misc_fixes
Various minor fixes to issues we discovered while updating our production instances
2 parents 5e7e08b + ea91d8e commit ddc2fcf

3 files changed

Lines changed: 15 additions & 2 deletions

File tree

app/cdash/app/Lib/Repository/GitHub.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,12 @@ public function authenticate($required = true)
147147

148148
$this->apiClient->authenticate($jwt, null, GitHubClient::AUTH_JWT);
149149

150-
$token = $this->apiClient->api('apps')->createInstallationToken($this->installationId);
150+
try {
151+
$token = $this->apiClient->api('apps')->createInstallationToken($this->installationId);
152+
} catch (\Exception $e) {
153+
\Log::error($e->getMessage());
154+
return false;
155+
}
151156
if ($token) {
152157
$this->apiClient->authenticate($token['token'], null, GitHubClient::AUTH_HTTP_TOKEN);
153158
}

app/cdash/include/repository.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,9 @@ function generate_bugtracker_new_issue_link($build, $project)
871871
return false;
872872
}
873873
$msg_parts = generate_broken_build_message($emailtext, $build, $project);
874+
if (!is_array($msg_parts)) {
875+
return false;
876+
}
874877
$title = $msg_parts['title'];
875878
$body = $msg_parts['body'];
876879

app/cdash/xml_handlers/BazelJSON_handler.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,12 @@ public function ParseLine($line)
545545
}
546546

547547
$test_name = $json_array['id']['testResult']['label'];
548-
$test_time = $json_array['testResult']['testAttemptDurationMillis'] / 1000.0;
548+
$test_time = 0;
549+
if (array_key_exists('testAttemptDurationMillis', $json_array['testResult'])) {
550+
$test_time = $json_array['testResult']['testAttemptDurationMillis'] / 1000.0;
551+
} elseif (array_key_exists('testAttemptDurationMillis', $json_array['id']['testResult'])) {
552+
$test_time = $json_array['id']['testResult']['testAttemptDurationMillis'] / 1000.0;
553+
}
549554

550555
if (array_key_exists('shard', $json_array['id']['testResult'])) {
551556
// This test uses shards, so a Test with this name

0 commit comments

Comments
 (0)