-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathFreeStyleProject.php
More file actions
43 lines (33 loc) · 1003 Bytes
/
FreeStyleProject.php
File metadata and controls
43 lines (33 loc) · 1003 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
36
37
38
39
40
41
42
43
<?php
namespace TryLib\JenkinsRunner;
use TryLib\JenkinsRunner;
class FreeStyleProject extends JenkinsRunner{
public function getBuildCommand() {
return 'build';
}
public function getBuildExtraArguments($show_results, $show_progress) {
$args = [];
if ($show_results || $show_progress) {
$args[] = '-s';
}
if ($show_progress) {
$args[] = '-v';
}
return $args;
}
/**
* Retrieve build number and status from the output
*/
public function pollForCompletion($show_progress) {
$out = $this->cmd_runner->getOutput();
if (preg_match('|Completed ' . $this->try_job_name . ' #(\d+) : (.*)|m', $out, $matches)) {
$this->try_status = $matches[2];
$this->try_base_url = sprintf(
'http://%s/job/%s/%s',
$this->jenkins_url,
$this->try_job_name,
$matches[1]
);
}
}
}