* Modify job result message.
This commit is contained in:
+8
-4
@@ -61,10 +61,15 @@ class ciModel extends model
|
||||
*/
|
||||
public function syncCompileStatus($compile, $notCompileMR)
|
||||
{
|
||||
$MRID = array_search($compile->job, $notCompileMR);
|
||||
|
||||
/* Max retry times is: 3. */
|
||||
if($compile->times >= 3)
|
||||
{
|
||||
$this->updateBuildStatus($compile, 'failure');
|
||||
|
||||
/* Added merge request result push to xuanxuan. */
|
||||
if($MRID) $this->loadModel('message')->send('mr', $MRID, 'compilefail', 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -76,6 +81,7 @@ class ciModel extends model
|
||||
$queueUrl = sprintf('%s/queue/item/%s/api/json', $jenkinsServer, $compile->queue);
|
||||
|
||||
$response = common::http($queueUrl, '', array(CURLOPT_USERPWD => $userPWD));
|
||||
$result = '';
|
||||
|
||||
if($compile->engine != 'gitlab') $this->dao->update(TABLE_COMPILE)->set('times = times + 1')->where('id')->eq($compile->id)->exec();
|
||||
if(strripos($response, "404") > -1)
|
||||
@@ -123,11 +129,9 @@ class ciModel extends model
|
||||
}
|
||||
}
|
||||
|
||||
/* Added merge request result push to xuanxuan. */
|
||||
$MRID = array_search($compile->job, $notCompileMR);
|
||||
if($MRID)
|
||||
if($MRID && in_array($result, array('success', 'failure')))
|
||||
{
|
||||
$actionType = $compile->status == 'success' ? 'compilepass' : 'compilefail';
|
||||
$actionType = $result == 'success' ? 'compilepass' : 'compilefail';
|
||||
$this->loadModel('message')->send('mr', $MRID, $actionType, 0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user