changes for original repo and ci models combination

This commit is contained in:
aaronchen2k
2020-01-31 18:31:08 +08:00
parent 3b0625087b
commit b6d68f10b7
15 changed files with 143 additions and 140 deletions
+2 -2
View File
@@ -169,9 +169,9 @@ define('TABLE_LOG', '`' . $config->db->prefix . 'log`');
define('TABLE_SCORE', '`' . $config->db->prefix . 'score`');
define('TABLE_NOTIFY', '`' . $config->db->prefix . 'notify`');
define('TABLE_OAUTH', '`' . $config->db->prefix . 'oauth`');
define('TABLE_CREDENTIALS', '`' . $config->db->prefix . 'credentials`');
define('TABLE_CREDENTIALS', '`' . $config->db->prefix . 'credentials`');
define('TABLE_JENKINS', '`' . $config->db->prefix . 'jenkins`');
define('TABLE_CI_TASK', '`' . $config->db->prefix . 'citask`');
define('TABLE_CI_JOB', '`' . $config->db->prefix . 'cijob`');
define('TABLE_CI_BUILD', '`' . $config->db->prefix . 'cibuild`');
define('TABLE_REPO', '`' . $config->db->prefix . 'repo`');
+1 -2
View File
@@ -16,7 +16,6 @@ CREATE TABLE `zt_jenkins` (
`deleted` enum('0','1') NOT NULL DEFAULT '0',
`password` varchar(30) NOT NULL,
`encrypt` varchar(30) NOT NULL DEFAULT 'plain',
`acl` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=utf8;
@@ -25,7 +24,7 @@ CREATE TABLE `zt_cijob` (
`name` varchar(50) NOT NULL,
`repo` mediumint(8) unsigned NOT NULL,
`jenkins` mediumint(8) unsigned NOT NULL,
`jenkinsTask` varchar(500) NOT NULL,
`jenkinsJob` varchar(500) NOT NULL,
`buildType` varchar(255) NOT NULL,
`triggerType` varchar(255) NOT NULL,
`scheduleType` varchar(255) NOT NULL,
+2 -2
View File
@@ -1,3 +1,3 @@
<?php
$config->job->create->requiredFields = 'name,repo,buildType,jenkins,jenkinsTask,triggerType';
$config->job->edit->requiredFields = 'name,repo,buildType,jenkins,jenkinsTask,triggerType';
$config->job->create->requiredFields = 'name,repo,buildType,jenkins,jenkinsJob,triggerType';
$config->job->edit->requiredFields = 'name,repo,buildType,jenkins,jenkinsJob,triggerType';
+19 -19
View File
@@ -46,7 +46,7 @@ class ci extends control
}
/**
* Browse ci task.
* Browse ci job.
*
* @param string $orderBy
* @param int $recTotal
@@ -62,9 +62,9 @@ class ci extends control
$this->view->jobList = $this->ci->listJob($orderBy, $pager);
$this->view->title = $this->lang->ci->task . $this->lang->colon . $this->lang->job->browse;
$this->view->title = $this->lang->ci->job . $this->lang->colon . $this->lang->job->browse;
$this->view->position[] = $this->lang->ci->common;
$this->view->position[] = $this->lang->ci->task;
$this->view->position[] = $this->lang->ci->job;
$this->view->position[] = $this->lang->ci->browse;
$this->view->orderBy = $orderBy;
@@ -74,7 +74,7 @@ class ci extends control
}
/**
* Create a ci task.
* Create a ci job.
*
* @access public
* @return void
@@ -90,7 +90,7 @@ class ci extends control
$this->app->loadLang('action');
$this->view->title = $this->lang->ci->task . $this->lang->colon . $this->lang->ci->create;
$this->view->title = $this->lang->ci->job . $this->lang->colon . $this->lang->ci->create;
$this->view->position[] = $this->lang->ci->common;
$this->view->position[] = html::a(inlink('browse'), $this->lang->ci->common);
$this->view->position[] = $this->lang->ci->create;
@@ -103,7 +103,7 @@ class ci extends control
}
/**
* Edit a ci task.
* Edit a ci job.
*
* @param int $id
* @access public
@@ -127,16 +127,16 @@ class ci extends control
$this->view->jenkinsList = $this->loadModel('cijenkins')->listForSelection("true");
$this->view->module = 'ci';
$this->view->title = $this->lang->ci->task . $this->lang->colon . $this->lang->ci->edit;
$this->view->title = $this->lang->ci->job . $this->lang->colon . $this->lang->ci->edit;
$this->view->position[] = $this->lang->ci->common;
$this->view->position[] = html::a(inlink('browse'), $this->lang->ci->task);
$this->view->position[] = html::a(inlink('browse'), $this->lang->ci->job);
$this->view->position[] = $this->lang->ci->edit;
$this->display();
}
/**
* Delete a ci task.
* Delete a ci job.
*
* @param int $id
* @access public
@@ -144,7 +144,7 @@ class ci extends control
*/
public function deleteJob($id)
{
$this->ci->delete(TABLE_CI_TASK, $id);
$this->ci->delete(TABLE_CI_JOB, $id);
$command = 'moduleName=ci&methodName=exe&parm=' . $id;
$this->dao->delete()->from(TABLE_CRON)->where('command')->eq($command)->exec();
@@ -155,7 +155,7 @@ class ci extends control
}
/**
* Exec a ci task.
* Exec a ci job.
*
* @param int $id
* @access public
@@ -181,17 +181,17 @@ class ci extends control
* @access public
* @return void
*/
public function browseBuild($taskID = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
public function browseBuild($jobID = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
$this->app->loadClass('pager', $static = true);
$pager = new pager($recTotal, $recPerPage, $pageID);
$this->view->buildList = $this->ci->listBuild($taskID, $orderBy, $pager);
$this->view->job = $this->ci->getJobByID($taskID);
$this->view->buildList = $this->ci->listBuild($jobID, $orderBy, $pager);
$this->view->job = $this->ci->getJobByID($jobID);
$this->view->title = $this->lang->ci->task . $this->lang->colon . $this->lang->job->browseBuild;
$this->view->title = $this->lang->ci->job . $this->lang->colon . $this->lang->job->browseBuild;
$this->view->position[] = $this->lang->ci->common;
$this->view->position[] = html::a(inlink('browse'), $this->lang->ci->task);
$this->view->position[] = html::a(inlink('browse'), $this->lang->ci->job);
$this->view->position[] = $this->lang->job->browseBuild;
$this->view->orderBy = $orderBy;
@@ -213,10 +213,10 @@ class ci extends control
$this->view->logs = str_replace("\r\n","<br />", $build->logs);
$this->view->build = $build;
$this->view->title = $this->lang->ci->task . $this->lang->colon . $this->lang->job->viewLogs;
$this->view->title = $this->lang->ci->job . $this->lang->colon . $this->lang->job->viewLogs;
$this->view->position[] = $this->lang->ci->common;
$this->view->position[] = html::a(inlink('browse'), $this->lang->ci->task);
$this->view->position[] = html::a(inlink('browseBuild', "taskID=" . $build->job), $this->lang->job->browseBuild);
$this->view->position[] = html::a(inlink('browse'), $this->lang->ci->job);
$this->view->position[] = html::a(inlink('browseBuild', "jobID=" . $build->job), $this->lang->job->browseBuild);
$this->view->position[] = $this->lang->job->viewLogs;
$this->view->module = 'ci';
+3 -3
View File
@@ -3,8 +3,8 @@ $(function()
triggerTypeChanged(triggerType);
});
function exeCitask(id) {
var link = createLink('citask', 'exe', 'id=' + id);
function exeCijob(id) {
var link = createLink('cijob', 'exe', 'id=' + id);
console.log(link);
$.ajax({
type:"POST",
@@ -12,7 +12,7 @@ function exeCitask(id) {
data: {},
datatype: "json",
success:function(str){
$('.exe-citask-button').tooltip('show', '发送执行请求成功!');
$('.exe-cijob-button').tooltip('show', '发送执行请求成功!');
}
});
}
+25 -25
View File
@@ -23,37 +23,37 @@ $lang->job->confirmDelete = '确认删除该构建任务吗?';
$lang->job->buildStatus = '构建状态';
$lang->job->buildTime = '构建时间';
$lang->job->id = 'ID';
$lang->job->name = '名称';
$lang->job->repo = '代码库';
$lang->job->jenkins = 'Jenkins服务';
$lang->job->jenkinsTask = 'Jenkins任务名';
$lang->job->buildType = '构建类型';
$lang->job->triggerType = '触发方式';
$lang->job->scheduleType = '时间计划';
$lang->job->id = 'ID';
$lang->job->name = '名称';
$lang->job->repo = '代码库';
$lang->job->jenkins = 'Jenkins服务';
$lang->job->jenkinsJob = 'Jenkins任务名';
$lang->job->buildType = '构建类型';
$lang->job->triggerType = '触发方式';
$lang->job->scheduleType = '时间计划';
$lang->job->cornExpression = 'Corn表达式';
$lang->job->custom = '自定义';
$lang->job->custom = '自定义';
$lang->job->tagKeywords = '标签关键字';
$lang->job->tagKeywords = '标签关键字';
$lang->job->commentKeywords = '注释关键字';
$lang->job->extTask = '执行任务';
$lang->job->extJob = '执行任务';
$lang->job->at = '在';
$lang->job->time = '时间';
$lang->job->exe = '执行';
$lang->job->at = '在';
$lang->job->time = '时间';
$lang->job->exe = '执行';
$lang->job->scheduleInterval = '每隔';
$lang->job->scheduleDay = '天数';
$lang->job->day = '天';
$lang->job->lastExe = '最后执行';
$lang->job->scheduleTime = '时间';
$lang->job->scheduleDay = '天数';
$lang->job->day = '天';
$lang->job->lastExe = '最后执行';
$lang->job->scheduleTime = '时间';
$lang->job->example = '举例';
$lang->job->tagEx = 'build_#15,其中15为Jenkins任务编号';
$lang->job->commitEx = 'start build #15,其中15为Jenkins任务编号';
$lang->job->example = '举例';
$lang->job->tagEx = 'build_#15,其中15为Jenkins任务编号';
$lang->job->commitEx = 'start build #15,其中15为Jenkins任务编号';
$lang->job->cronSample = '如 0 0 2 * * 2-6/1 表示每个工作日凌晨2点';
$lang->job->buildStatusList = array('success' => '成功', 'fail' => '失败', 'created' => '新建', 'building' => '构建中');
$lang->job->dayTypeList = array('workDay' => '工作日', 'everyDay' => '每天');
$lang->job->buildTypeList = array('build' => '仅构建', 'buildAndDeploy' => '构建部署', 'buildAndTest' => '构建测试');
$lang->job->triggerTypeList = array('tag' => '打标签', 'commit' => '代码提交注释', 'schedule' => '定时计划');
$lang->job->buildStatusList = array('success' => '成功', 'fail' => '失败', 'created' => '新建', 'building' => '构建中');
$lang->job->dayTypeList = array('workDay' => '工作日', 'everyDay' => '每天');
$lang->job->buildTypeList = array('build' => '仅构建', 'buildAndDeploy' => '构建部署', 'buildAndTest' => '构建测试');
$lang->job->triggerTypeList = array('tag' => '打标签', 'commit' => '代码提交注释', 'schedule' => '定时计划');
$lang->job->scheduleTypeList = array('cron' => 'Cron表达式', 'custom' => '自定义');
+64 -68
View File
@@ -14,7 +14,7 @@ class ciModel extends model
{
/**
* Get ci task list.
* Get ci job list.
*
* @param string $orderBy
* @param object $pager
@@ -25,7 +25,7 @@ class ciModel extends model
public function listJob($orderBy = 'id_desc', $pager = null, $decode = true)
{
$list = $this->dao->
select('t1.*, t2.name repoName, t3.name as jenkinsName')->from(TABLE_CI_TASK)->alias('t1')
select('t1.*, t2.name repoName, t3.name as jenkinsName')->from(TABLE_CI_JOB)->alias('t1')
->leftJoin(TABLE_REPO)->alias('t2')->on('t1.repo=t2.id')
->leftJoin(TABLE_JENKINS)->alias('t3')->on('t1.jenkins=t3.id')
->where('t1.deleted')->eq('0')
@@ -36,7 +36,7 @@ class ciModel extends model
}
/**
* Get a ci task by id.
* Get a ci job by id.
*
* @param int $id
* @access public
@@ -44,57 +44,57 @@ class ciModel extends model
*/
public function getJobByID($id)
{
$jenkins = $this->dao->select('*')->from(TABLE_CI_TASK)->where('id')->eq($id)->fetch();
$jenkins = $this->dao->select('*')->from(TABLE_CI_JOB)->where('id')->eq($id)->fetch();
return $jenkins;
}
/**
* Create a ci task.
* Create a ci job.
*
* @access public
* @return bool
*/
public function createJob()
{
$task = fixer::input('post')
$job = fixer::input('post')
->add('createdBy', $this->app->user->account)
->add('createdDate', helper::now())
->get();
$this->dao->insert(TABLE_CI_TASK)->data($task)
->batchCheck($this->config->citask->requiredFields, 'notempty')
$this->dao->insert(TABLE_CI_JOB)->data($job)
->batchCheck($this->config->cijob->requiredFields, 'notempty')
->batchCheckIF($task->triggerType === 'schedule' && $task->scheduleType == 'cron', "cronExpression", 'notempty')
->batchCheckIF($task->triggerType === 'schedule' && $task->scheduleType == 'custom', "scheduleDay,scheduleTime,scheduleInterval", 'notempty')
->batchCheckIF($job->triggerType === 'schedule' && $job->scheduleType == 'cron', "cronExpression", 'notempty')
->batchCheckIF($job->triggerType === 'schedule' && $job->scheduleType == 'custom', "scheduleDay,scheduleTime,scheduleInterval", 'notempty')
->autoCheck()
->exec();
if ($task->triggerType === 'schedule') {
$taskId = $this->dao->lastInsertID();
if ($job->triggerType === 'schedule') {
$jobId = $this->dao->lastInsertID();
if ($task->scheduleType == 'custom') {
$arr = explode(":", $task->scheduleTime);
if ($job->scheduleType == 'custom') {
$arr = explode(":", $job->scheduleTime);
$hour = $arr[0];
$min = $arr[1];
if ($task->scheduleDay == 'everyDay') {
if ($job->scheduleDay == 'everyDay') {
$days = '1-7';
} else if ($task->scheduleDay == 'workDay') {
} else if ($job->scheduleDay == 'workDay') {
$days = '1-5';
}
$cron = (object)array('m' => $min, 'h' => $hour, 'dom' => '*', 'mon' => '*',
'dow' => $days . '/' . $task->scheduleInterval, 'command' => 'moduleName=citask&methodName=exe&parm=' . $taskId,
'remark' => ($this->lang->citask->extTask . $taskId), 'type' => 'zentao',
'dow' => $days . '/' . $job->scheduleInterval, 'command' => 'moduleName=ci&methodName=exeCijob&parm=' . $jobId,
'remark' => ($this->lang->ci->extJob . $jobId), 'type' => 'zentao',
'buildin' => '-1', 'status' => 'normal', 'lastTime' => '0000-00-00 00:00:00');
$this->dao->insert(TABLE_CRON)->data($cron)->exec();
} else if ($task->scheduleType == 'cron') {
$arr = explode(' ', $task->cronExpression);
} else if ($job->scheduleType == 'cron') {
$arr = explode(' ', $job->cronExpression);
if (count($arr) >= 6) {
$cron = (object)array('m' => $arr[1], 'h' => $arr[2], 'dom' => $arr[3], 'mon' => $arr[4],
'dow' => $arr[5], 'command' => 'moduleName=citask&methodName=exe&parm=' . $taskId,
'remark' => ($this->lang->citask->extTask . $taskId), 'type' => 'zentao',
'dow' => $arr[5], 'command' => 'moduleName=ci&methodName=exeCijob&parm=' . $jobId,
'remark' => ($this->lang->ci->extJob . $jobId), 'type' => 'zentao',
'buildin' => '-1', 'status' => 'normal', 'lastTime' => '0000-00-00 00:00:00');
$this->dao->insert(TABLE_CRON)->data($cron)->exec();
}
@@ -105,7 +105,7 @@ class ciModel extends model
}
/**
* Update a ci task.
* Update a ci job.
*
* @param int $id
* @access public
@@ -113,33 +113,33 @@ class ciModel extends model
*/
public function updateJob($id)
{
$task = fixer::input('post')
$job = fixer::input('post')
->add('editedBy', $this->app->user->account)
->add('editedDate', helper::now())
->get();
$this->dao->update(TABLE_CI_TASK)->data($task)
->batchCheck($this->config->citask->requiredFields, 'notempty')
$this->dao->update(TABLE_CI_JOB)->data($job)
->batchCheck($this->config->cijob->requiredFields, 'notempty')
->batchCheckIF($task->triggerType === 'schedule' && $task->scheduleType == 'cron', "cronExpression", 'notempty')
->batchCheckIF($task->triggerType === 'schedule' && $task->scheduleType == 'custom', "scheduleDay,scheduleTime,scheduleInterval", 'notempty')
->batchCheckIF($job->triggerType === 'schedule' && $job->scheduleType == 'cron', "cronExpression", 'notempty')
->batchCheckIF($job->triggerType === 'schedule' && $job->scheduleType == 'custom', "scheduleDay,scheduleTime,scheduleInterval", 'notempty')
->autoCheck()
->where('id')->eq($id)
->exec();
if ($task->triggerType === 'schedule') {
$command = 'moduleName=citask&methodName=exe&parm=' . $id;
if ($job->triggerType === 'schedule') {
$command = 'moduleName=ci&methodName=exeCijob&parm=' . $id;
if ($task->scheduleType == 'custom') {
$arr = explode(":", $task->scheduleTime);
if ($job->scheduleType == 'custom') {
$arr = explode(":", $job->scheduleTime);
$hour = $arr[0];
$min = $arr[1];
$taskId = $this->dao->lastInsertID();
if ($task->scheduleDay == 'everyDay') {
$jobId = $this->dao->lastInsertID();
if ($job->scheduleDay == 'everyDay') {
$days = '1-7';
} else if ($task->scheduleDay == 'workDay') {
} else if ($job->scheduleDay == 'workDay') {
$days = '2-6';
}
@@ -148,11 +148,11 @@ class ciModel extends model
->set('h')->eq($hour)
->set('dom')->eq('*')
->set('mon')->eq('*')
->set('dow')->eq($days . '/' . $task->scheduleInterval)
->set('dow')->eq($days . '/' . $job->scheduleInterval)
->set('lastTime')->eq('0000-00-00 00:00:00')
->where('command')->eq($command)->exec();
} else if ($task->scheduleType == 'cron') {
$arr = explode(' ', $task->cronExpression);
} else if ($job->scheduleType == 'cron') {
$arr = explode(' ', $job->cronExpression);
if (count($arr) >= 6) {
$this->dao->update(TABLE_CRON)
->set('m')->eq($arr[1])
@@ -170,32 +170,27 @@ class ciModel extends model
}
/**
* Execute ci task.
* Execute ci job.
*
* @param int $id
* @access public
* @return bool
*/
public function exeJob($taskID)
public function exeJob($jobID)
{
$po = $this->dao->select('task.id taskId, task.name taskName, task.repo, task.jenkinsTask, jenkins.name jenkinsName,jenkins.serviceUrl,jenkins.credentials')
->from(TABLE_CI_TASK)->alias('task')
->leftJoin(TABLE_JENKINS)->alias('jenkins')->on('task.jenkins=jenkins.id')
->where('task.id')->eq($taskID)
$po = $this->dao->select('job.id jobId, job.name jobName, job.repo, job.jenkinsJob, jenkins.name jenkinsName,jenkins.serviceUrl,jenkins.account,jenkins.token,jenkins.password')
->from(TABLE_CI_JOB)->alias('job')
->leftJoin(TABLE_JENKINS)->alias('jenkins')->on('job.jenkins=jenkins.id')
->where('job.id')->eq($jobID)
->fetch();
$credentials = $this->loadModel('cicredentials')->getByID($po->credentials); // jenkins must use a token or account credentials
if ($credentials->type === 'token') {
$jenkinsTokenOrPassword = $credentials->token;
} else if ($credentials->type === 'account') {
$jenkinsTokenOrPassword = $credentials->password;
}
$jenkinsUser = $credentials->username;
$jenkinsServer = $po->serviceUrl;
$jenkinsUser = $po->account;
$jenkinsTokenOrPassword = $po->token ? $po->token : $po->password;
$r = '://' . $jenkinsUser . ':' . $jenkinsTokenOrPassword . '@';
$jenkinsServer = str_replace('://', $r, $jenkinsServer);
$buildUrl = sprintf('%s/job/%s/build/api/json', $jenkinsServer, $po->jenkinsTask);
$buildUrl = sprintf('%s/job/%s/build/api/json', $jenkinsServer, $po->jenkinsJob);
$po->queueItem = $this->sendBuildRequest($buildUrl);
$this->saveCibuild($po);
@@ -206,19 +201,19 @@ class ciModel extends model
/**
* Get jenkins build list.
*
* @param int $taskID
* @param int $jobID
* @param string $orderBy
* @param object $pager
* @param bool $decode
* @access public
* @return array
*/
public function listBuild($taskID, $orderBy = 'id_desc', $pager = null, $decode = true)
public function listBuild($jobID, $orderBy = 'id_desc', $pager = null, $decode = true)
{
$list = $this->dao->
select('id, name, status, createdDate')->from(TABLE_CI_BUILD)
->where('deleted')->eq('0')
->andWhere('citask')->eq($taskID)
->andWhere('cijob')->eq($jobID)
->orderBy($orderBy)
->page($pager)
->fetchAll('id');
@@ -241,16 +236,16 @@ class ciModel extends model
/**
* Save build to db.
*
* @param object $task
* @param object $job
* @access public
* @return bool
*/
public function saveBuild($task)
public function saveBuild($job)
{
$build = new stdClass();
$build->citask = $task->taskId;
$build->name = $task->taskName;
$build->queueItem = $task->queueItem;
$build->cijob = $job->jobId;
$build->name = $job->jobName;
$build->queueItem = $job->queueItem;
$build->status = 'created';
$build->createdBy = $this->app->user->account;
$build->createdDate = helper::now();
@@ -261,7 +256,8 @@ class ciModel extends model
/**
* Update ci build status.
*
* @param object $task
* @param object $build
* @param string $status
* @access public
* @return bool
*/
@@ -269,10 +265,10 @@ class ciModel extends model
{
$this->dao->update(TABLE_CI_BUILD)->set('status')->eq($status)->where('id')->eq($build->id)->exec();
$this->dao->update(TABLE_CI_TASK)
$this->dao->update(TABLE_CI_JOB)
->set('lastExec')->eq(helper::now())
->set('lastStatus')->eq($status)
->where('id')->eq($build->citask)->exec();
->where('id')->eq($build->cijob)->exec();
}
/**
@@ -283,10 +279,10 @@ class ciModel extends model
*/
public function checkBuildStatus()
{
$pos = $this->dao->select('build.*, task.jenkinsTask, jenkins.name jenkinsName,jenkins.serviceUrl,jenkins.credentials')
$pos = $this->dao->select('build.*, job.jenkinsJob, jenkins.name jenkinsName,jenkins.serviceUrl,jenkins.credentials')
->from(TABLE_CI_BUILD)->alias('build')
->leftJoin(TABLE_CI_TASK)->alias('task')->on('build.citask=task.id')
->leftJoin(TABLE_JENKINS)->alias('jenkins')->on('task.jenkins=jenkins.id')
->leftJoin(TABLE_CI_JOB)->alias('job')->on('build.cijob=job.id')
->leftJoin(TABLE_JENKINS)->alias('jenkins')->on('job.jenkins=jenkins.id')
->where('build.status')->ne('success')
->andWhere('build.status')->ne('fail')
->fetchAll();
@@ -307,13 +303,13 @@ class ciModel extends model
$response = common::http($queueUrl);
if (strripos($response,"404") > -1) { // queue已过期
$infoUrl = sprintf('%s/job/%s/%s/api/json', $jenkinsServer, $po->jenkinsTask, $po->queueItem);
$infoUrl = sprintf('%s/job/%s/%s/api/json', $jenkinsServer, $po->jenkinsJob, $po->queueItem);
$response = common::http($infoUrl);
$buildInfo = json_decode($response);
$result = strtolower($buildInfo->result);
$this->updateCibuildStatus($po, $result);
$logUrl = sprintf('%s/job/%s/%s/consoleText', $jenkinsServer, $po->jenkinsTask, $po->queueItem);
$logUrl = sprintf('%s/job/%s/%s/consoleText', $jenkinsServer, $po->jenkinsJob, $po->queueItem);
$response = common::http($logUrl);
$logs = json_decode($response);
+1 -1
View File
@@ -5,7 +5,7 @@
* @copyright Copyright 2009-2017 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chenqi <chenqi@cnezsoft.com>
* @package citask
* @package ci
* @version $Id$
* @link http://www.zentao.net
*/
+4 -4
View File
@@ -1,11 +1,11 @@
<?php
/**
* The browse view file of ci task module of ZenTaoPMS.
* The browse view file of ci job module of ZenTaoPMS.
*
* @copyright Copyright 2009-2017 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chenqi <chenqi@cnezsoft.com>
* @package citask
* @package ci
* @version $Id$
* @link http://www.zentao.net
*/
@@ -28,7 +28,7 @@
<?php common::printOrderLink('repo', $orderBy, $vars, $lang->job->repo); ?></th>
<th class='w-100px text-left'>
<?php common::printOrderLink('jenkins', $orderBy, $vars, $lang->job->jenkins); ?></th>
<th class='w-100px text-left'><?php echo $lang->job->jenkinsTask; ?></th>
<th class='w-100px text-left'><?php echo $lang->job->jenkinsJob; ?></th>
<th class='w-100px text-left'><?php echo $lang->job->buildType; ?></th>
<th class='w-100px text-left'><?php echo $lang->job->triggerType; ?></th>
<th class='w-200px text-left'><?php echo $lang->job->lastExe; ?></th>
@@ -43,7 +43,7 @@
<td class='text' title='<?php echo $job->name; ?>'><?php echo $job->name; ?></td>
<td class='text' title='<?php echo $job->repoName; ?>'><?php echo $job->repoName; ?></td>
<td class='text' title='<?php echo $job->jenkinsName; ?>'><?php echo $job->jenkinsName; ?></td>
<td class='text' title='<?php echo $job->jenkinsTask; ?>'><?php echo $job->jenkinsTask; ?></td>
<td class='text' title='<?php echo $job->jenkinsJob; ?>'><?php echo $job->jenkinsJob; ?></td>
<td class='text' title='<?php echo $lang->job->buildTypeList[$job->buildType]; ?>'>
<?php echo $lang->job->buildTypeList[$job->buildType]; ?></td>
<td class='text' title='<?php echo $lang->job->triggerTypeList[$job->triggerType]; ?>'>
+3 -3
View File
@@ -1,6 +1,6 @@
<?php
/**
* The create view file of ci task module of ZenTaoPMS.
* The create view file of ci job module of ZenTaoPMS.
*
* @copyright Copyright 2009-2017 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
@@ -35,8 +35,8 @@
<th><?php echo $lang->job->jenkins; ?></th>
<td><?php echo html::select('jenkins', $jenkinsList, '', "class='form-control chosen'"); ?></td>
<th><?php echo $lang->job->jenkinsTask; ?></th>
<td><?php echo html::input('jenkinsTask', '', "class='form-control'"); ?></td>
<th><?php echo $lang->job->jenkinsJob; ?></th>
<td><?php echo html::input('jenkinsJob', '', "class='form-control'"); ?></td>
</tr>
<tr>
<th><?php echo $lang->job->triggerType; ?></th>
+4 -4
View File
@@ -1,6 +1,6 @@
<?php
/**
* The edit view file of ci task module of ZenTaoPMS.
* The edit view file of ci job module of ZenTaoPMS.
*
* @copyright Copyright 2009-2017 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
@@ -37,8 +37,8 @@
<th><?php echo $lang->job->jenkins; ?></th>
<td><?php echo html::select('jenkins', $jenkinsList, $job->jenkins, "class='form-control chosen'"); ?></td>
<th><?php echo $lang->job->jenkinsTask; ?></th>
<td><?php echo html::input('jenkinsTask', $job->jenkinsTask, "class='form-control'"); ?></td>
<th><?php echo $lang->job->jenkinsJob; ?></th>
<td><?php echo html::input('jenkinsJob', $job->jenkinsJob, "class='form-control'"); ?></td>
</tr>
<tr>
<th><?php echo $lang->job->triggerType; ?></th>
@@ -104,7 +104,7 @@
<?php echo html::submitButton(); ?>
<?php echo html::backButton(); ?>
&nbsp;
<?php echo html::commonButton($lang->job->exeNow, "onclick=exeCitask($job->id) data-tip-class='tooltip-success'", "btn btn-info exe-job-button"); ?>
<?php echo html::commonButton($lang->job->exeNow, "onclick=exeCijob($job->id) data-tip-class='tooltip-success'", "btn btn-info exe-job-button"); ?>
</td>
</tr>
</table>
+2 -2
View File
@@ -5,7 +5,7 @@
* @copyright Copyright 2009-2017 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chenqi <chenqi@cnezsoft.com>
* @package citask
* @package ci
* @version $Id$
* @link http://www.zentao.net
*/
@@ -21,7 +21,7 @@
</div>
</div>
<div class="btn-toolbar pull-right">
<?php echo html::a(helper::createLink('ci', "browseBuild", "taskId=$build->citask"), "<i class='icon icon-back icon-sm'></i> ". $lang->goback, '', "class='btn btn-secondary'");?>
<?php echo html::a(helper::createLink('ci', "browseBuild", "jobId=$build->cijob"), "<i class='icon icon-back icon-sm'></i> ". $lang->goback, '', "class='btn btn-secondary'");?>
</div>
</div>
+2 -2
View File
@@ -11,8 +11,8 @@ $lang->jenkins->token = 'Token';
$lang->jenkins->account = '用户名';
$lang->jenkins->password = '密码';
$lang->jenkins->encoding = '编码';
$lang->repo->encryptList['plain'] = '不加密';
$lang->repo->encryptList['base64'] = 'BASE64';
$lang->jenkins->encryptList['plain'] = '不加密';
$lang->jenkins->encryptList['base64'] = 'BASE64';
$lang->jenkins->desc = '描述';
$lang->jenkins->tips = '选择用户名密码类型凭证时,请在Jenkins全局安全设置中禁用"防止跨站点请求伪造"选项。';
+5 -1
View File
@@ -34,13 +34,17 @@
<th><?php echo $lang->jenkins->account;?></th>
<td><?php echo html::input('account', '', "class='form-control'");?></td>
</tr>
<tr>
<th><?php echo $lang->jenkins->token;?></th>
<td><?php echo html::input('token', '', "class='form-control'");?></td>
</tr>
<tr>
<th><?php echo $lang->jenkins->password;?></th>
<td>
<div class='input-group'>
<?php echo html::password('password', '', "class='form-control'");?>
<span class='input-group-addon fix-border fix-padding'></span>
<?php echo html::select('encrypt', $lang->repo->encryptList, 'base64', "class='form-control'");?>
<?php echo html::select('encrypt', $lang->jenkins->encryptList, 'base64', "class='form-control'");?>
</div>
</td>
</tr>
+6 -2
View File
@@ -32,13 +32,17 @@
</tr>
<tr>
<th><?php echo $lang->jenkins->account;?></th>
<td><?php echo html::input('account', '', "class='form-control'");?></td>
<td><?php echo html::input('account', $jenkins->account, "class='form-control'");?></td>
</tr>
<tr>
<th><?php echo $lang->jenkins->token;?></th>
<td><?php echo html::input('token', $jenkins->token, "class='form-control'");?></td>
</tr>
<tr>
<th><?php echo $lang->jenkins->password;?></th>
<td>
<div class='input-group'>
<?php echo html::password('password', '', "class='form-control'");?>
<?php echo html::password('password', $jenkins->password, "class='form-control'");?>
<span class='input-group-addon fix-border fix-padding'></span>
<?php echo html::select('encrypt', $lang->jenkins->encryptList, 'base64', "class='form-control'");?>
</div>