* Merge 18 code.
This commit is contained in:
@@ -22,7 +22,7 @@ class compile extends control
|
||||
public function __construct($moduleName = '', $methodName = '')
|
||||
{
|
||||
parent::__construct($moduleName, $methodName);
|
||||
if($this->app->rawMethod != 'browse') $this->loadModel('ci')->setMenu();
|
||||
if(!in_array($this->app->rawMethod, array('browse', 'logs'))) $this->loadModel('ci')->setMenu();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -51,7 +51,14 @@ class compile extends control
|
||||
if($repoID || $jobID) $this->compile->syncCompile($repoID, $jobID);
|
||||
|
||||
$this->app->loadLang('job');
|
||||
if($repoID) $this->ci->setMenu($repoID);
|
||||
if($repoID)
|
||||
{
|
||||
$this->ci->setMenu($repoID);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->session->set('repoID', 0);
|
||||
}
|
||||
|
||||
$this->app->loadClass('pager', true);
|
||||
$pager = new pager($recTotal, $recPerPage, $pageID);
|
||||
@@ -78,6 +85,12 @@ class compile extends control
|
||||
*/
|
||||
public function logs($buildID)
|
||||
{
|
||||
if($this->session->repoID)
|
||||
{
|
||||
$this->loadModel('ci')->setMenu();
|
||||
$this->view->repoID = $this->session->repoID;
|
||||
}
|
||||
|
||||
$build = $this->compile->getByID($buildID);
|
||||
$job = $this->loadModel('job')->getByID($build->job);
|
||||
|
||||
|
||||
@@ -166,7 +166,10 @@ class compileModel extends model
|
||||
$userPWD = "$jenkinsUser:$jenkinsPassword";
|
||||
|
||||
$infoUrl = sprintf('%s/job/%s/api/xml?tree=builds[id,number,queueId]&xpath=//build[queueId=%s]', $jenkins->url, $job->pipeline, $compile->queue);
|
||||
$response = common::http($infoUrl, '', array(CURLOPT_USERPWD => $userPWD));
|
||||
$result = common::http($infoUrl, '', array(CURLOPT_USERPWD => $userPWD), array(), 'data', 'POST', 30, true);
|
||||
$response = $result['body'];
|
||||
$httpCode = $result[1];
|
||||
if($httpCode == 404) return '';
|
||||
if($response)
|
||||
{
|
||||
$buildInfo = simplexml_load_string($response);
|
||||
@@ -188,7 +191,9 @@ class compileModel extends model
|
||||
$this->loadModel('ci');
|
||||
foreach($jobs as $gitlabJob)
|
||||
{
|
||||
if(empty($gitlabJob->duration) or $gitlabJob->duration == '') $gitlabJob->duration = '-';
|
||||
if(!is_object($gitlabJob)) continue;
|
||||
|
||||
if(empty($gitlabJob->duration)) $gitlabJob->duration = '-';
|
||||
$logs .= "<font style='font-weight:bold'>>>> Job: $gitlabJob->name, Stage: $gitlabJob->stage, Status: $gitlabJob->status, Duration: $gitlabJob->duration Sec\r\n </font>";
|
||||
$logs .= "Job URL: <a href=\"$gitlabJob->web_url\" target='_blank'>$gitlabJob->web_url</a> \r\n";
|
||||
$logs .= $this->ci->transformAnsiToHtml($this->gitlab->apiGetJobLog($job->server, $projectID, $gitlabJob->id));
|
||||
|
||||
Reference in New Issue
Block a user