updte cron log format when output is empty or big
This commit is contained in:
@@ -15,4 +15,4 @@ $config->repo->binary = '|pdf|';
|
||||
|
||||
$config->repo->requiredFields = 'name,repo,buildType,jenkins,jenkinsTask,triggerType';
|
||||
|
||||
$config->repo->commitCommands = array( entity => '/\s*([a-z]+)\s+((?:story)|(?:task)|(?:bug))\s+#((\d|,)+)\s*/i' );
|
||||
$config->repo->commitCommands = array( entity => '/\s*([a-z]+)\s+((?:build)|(?:story)|(?:task)|(?:bug))\s+#((\d|,)+)\s*/i' );
|
||||
@@ -293,8 +293,8 @@ class ci extends control
|
||||
*/
|
||||
public function editCitask($id)
|
||||
{
|
||||
$pattern = '/\s*([a-z]+)\s+((?:story)|(?:task)|(?:bug))\s+#((?\d|,)+)\s*/i';
|
||||
preg_match($pattern, ' update README. fix bug #123,456',$matches);
|
||||
$pattern = '/\s*([a-z]+)\s+((?:story)|(?:task)|(?:bug))\s+#((\d|,)+)\s*/i';
|
||||
preg_match($pattern, 'update fix bug #567,666 README.',$matches);
|
||||
|
||||
$citask = $this->ci->getCitaskByID($id);
|
||||
if($_POST)
|
||||
|
||||
@@ -87,10 +87,10 @@ $lang->citask->day = '天';
|
||||
$lang->citask->lastExe = '最后执行';
|
||||
$lang->citask->scheduleTime = '时间';
|
||||
|
||||
$lang->citask->dayTypeList = array(workDay=>'工作日', everyDay=>'每天');
|
||||
$lang->citask->buildTypeList = array(build=>'仅构建', buildAndDeploy=>'构建部署', buildAndTest=>'构建测试');
|
||||
$lang->citask->triggerTypeList = array(tag=>'打标签', commit=>'代码提交注释', schedule=>'定时计划');
|
||||
$lang->citask->scheduleTypeList = array(corn=>'Corn表达式', custom=>'自定义');
|
||||
$lang->citask->dayTypeList = array('workDay'=>'工作日', 'everyDay'=>'每天');
|
||||
$lang->citask->buildTypeList = array('build'=>'仅构建', 'buildAndDeploy'=>'构建部署', 'buildAndTest'=>'构建测试');
|
||||
$lang->citask->triggerTypeList = array('tag'=>'打标签', 'commit'=>'代码提交注释', 'schedule'=>'定时计划');
|
||||
$lang->citask->scheduleTypeList = array('corn'=>'Corn表达式', 'custom'=>'自定义');
|
||||
|
||||
// repo
|
||||
$lang->repo->common = '代码库';
|
||||
|
||||
@@ -221,6 +221,12 @@ class cron extends control
|
||||
/* Save log. */
|
||||
$log = '';
|
||||
$time = $now->format('G:i:s');
|
||||
if (empty($output)) {
|
||||
$output = '\n';
|
||||
}
|
||||
if (count($output) > 100) { // return if output a lot of info
|
||||
$output = "\n" . $output;
|
||||
}
|
||||
$log = "$time task " . $id . " executed,\ncommand: $cron[command].\nreturn : $return.\noutput : $output\n";
|
||||
$this->cron->logCron($log);
|
||||
unset($log);
|
||||
|
||||
+5
-15
@@ -113,25 +113,15 @@ class gitModel extends model
|
||||
|
||||
$this->printLog("comment is\n----------\n" . trim($log->msg) . "\n----------");
|
||||
$objects = $this->parseComment($log->msg);
|
||||
if($objects)
|
||||
{
|
||||
$this->printLog('extract' .
|
||||
' story:' . join(' ', $objects['stories']) .
|
||||
' task:' . join(' ', $objects['tasks']) .
|
||||
' bug:' . join(',', $objects['bugs']));
|
||||
|
||||
$this->saveAction2PMS($objects, $log);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->printLog('no objects found' . "\n");
|
||||
if($objects) {
|
||||
$this->printLog('extract ' . json_encode($objects));
|
||||
}
|
||||
}
|
||||
|
||||
$this->saveLastRevision($latestRevision);
|
||||
$this->printLog("save revision $latestRevision");
|
||||
$this->deleteRestartFile();
|
||||
$this->printLog("\n\nrepo $name finished");
|
||||
$this->printLog("\n\nrepo ' . $repo->id . ': ' . $repo->path . ' finished");
|
||||
|
||||
// check ci commands in logs
|
||||
$pattern = $this->config->repo->commitCommands['entity'];
|
||||
@@ -213,7 +203,7 @@ class gitModel extends model
|
||||
foreach($repoObjs as $repoInDb)
|
||||
{
|
||||
if(strtolower($repoInDb->SCM) === 'git' && !in_array($repoInDb->path, $gitRepos)) {
|
||||
$gitRepos[] = (object)array(id=>$repoInDb->id, path => $repoInDb->path, encoding => 'utf-8');
|
||||
$gitRepos[] = (object)array('id'=>$repoInDb->id, 'path' => $repoInDb->path, 'encoding' => 'utf-8');
|
||||
$paths[] = $repoInDb->path;
|
||||
}
|
||||
}
|
||||
@@ -415,7 +405,7 @@ class gitModel extends model
|
||||
$entityType = $matches[2];
|
||||
$entityIds = $matches[3];
|
||||
|
||||
$ret[$entityType] = array(action=>$action, entities=> explode(",", $entityIds));
|
||||
$ret[$entityType] = array('action'=>$action, 'entities'=> explode(",", $entityIds));
|
||||
}
|
||||
|
||||
return $ret;
|
||||
|
||||
Reference in New Issue
Block a user