-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathgetBuilds.php
More file actions
35 lines (30 loc) · 783 Bytes
/
getBuilds.php
File metadata and controls
35 lines (30 loc) · 783 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
require_once ('lib/MockCI.php');
require_once ('lib/JenkinsCI.php');
require_once ('lib/Exceptions.php');
$result = '';
if (isset($_GET['view'])) {
$ci = new JenkinsCI($_GET['view']);
} else {
$ci = new JenkinsCI();
}
try {
$jobs = $ci->getAllJobs();
} catch (BuildiatorCIServerCommunicationException $e) {
$result = array('status' => 'error',
'content' => $e->getMessage());
}
if (!is_array($result)) {
$html = '';
foreach ($jobs as $job) {
$blame = null;
if ($job['status'][0] == 'failed') {
$blame = "<br /><span class='blame'>{$job['blame']}</span>" ;
}
$html .="<li class = 'job " . implode(" ",$job['status'] ) . "'>{$job['name']}{$blame}</li>";
}
$result = array('status' => 'ok',
'content' => $html);
}
echo json_encode($result);
?>