diff --git a/db/update12.0.1.sql b/db/update12.0.1.sql
index a4a24335ae..c45645a1f5 100644
--- a/db/update12.0.1.sql
+++ b/db/update12.0.1.sql
@@ -59,3 +59,14 @@ INSERT INTO `zt_cron` (`m`, `h`, `dom`, `mon`, `dow`, `command`, `remark`, `type
('1', '1', '*', '*', '*', 'moduleName=ci&methodName=buildTodayJob', '创建周期性任务', 'zentao', 1, 'normal', '0000-00-00 00:00:00'),
('*/5', '*', '*', '*', '*', 'moduleName=ci&methodName=checkBuildStatus', '同步Jenkins任务状态', 'zentao', 1, 'normal', '0000-00-00 00:00:00'),
('*/5', '*', '*', '*', '*', 'moduleName=ci&methodName=exec', '执行Jenkins任务', 'zentao', 1, 'normal', '0000-00-00 00:00:00');
+
+ALTER TABLE `zt_integration`
+CHANGE `jenkins` `jkHost` mediumint(8) unsigned NOT NULL AFTER `repo`,
+CHANGE `jenkinsJob` `jkJob` varchar(500) COLLATE 'utf8_general_ci' NOT NULL AFTER `jkHost`,
+CHANGE `svnFolder` `svnDir` varchar(255) COLLATE 'utf8_general_ci' NOT NULL AFTER `triggerType`,
+CHANGE `scheduleDay` `atDay` varchar(20) COLLATE 'utf8_general_ci' NULL AFTER `svnDir`,
+ADD `atTime` varchar(10) COLLATE 'utf8_general_ci' NULL AFTER `atDay`,
+DROP `tagKeywords`,
+DROP `commentKeywords`,
+ADD `comment` varchar(255) COLLATE 'utf8_general_ci' NULL AFTER `atTime`,
+ADD `lastTag` varchar(255) COLLATE 'utf8_general_ci' NULL;
diff --git a/lib/base/filter/filter.class.php b/lib/base/filter/filter.class.php
index 079235fb3c..62413638b6 100644
--- a/lib/base/filter/filter.class.php
+++ b/lib/base/filter/filter.class.php
@@ -1085,6 +1085,20 @@ class baseFixer
return $data;
}
+ /**
+ * 去除字符串左右空格
+ * Remove the left and right Spaces of the string.
+ *
+ * @param string $fieldName
+ * @access public
+ * @return object fixer object
+ */
+ public function trim($fieldName)
+ {
+ if(isset($this->data->$fieldName)) $this->data->$fieldName = trim($this->data->$fieldName);
+ return $this;
+ }
+
/**
* 忽略处理给定的字段。
* Skip special chars check.
@@ -1296,19 +1310,4 @@ class baseFixer
foreach($fields as $key => $fieldName) if(!isset($this->data->$fieldName)) unset($fields[$key]);
return $fields;
}
-
- /**
- * 去除字符串左右空格
- * Remove the left and right Spaces of the string.
- *
- * @param string $fieldName
- * @access public
- * @return object fixer object
- */
- public function trim($fieldName)
- {
- if(isset($this->data->$fieldName)) $this->data->$fieldName = trim($this->data->$fieldName);
- return $this;
- }
-
}
diff --git a/lib/scm/parsegit.class.php b/lib/scm/gitrepo.class.php
similarity index 99%
rename from lib/scm/parsegit.class.php
rename to lib/scm/gitrepo.class.php
index c0468db89a..2478569f16 100644
--- a/lib/scm/parsegit.class.php
+++ b/lib/scm/gitrepo.class.php
@@ -1,5 +1,5 @@
SCM;
- if($className == 'Git') $className = 'ParseGit';
+ if($className == 'Git') $className = 'GitRepo';
if(!class_exists($className)) require(strtolower($className) . '.class.php');
$this->engine = new $className($repo->client, $repo->path, $repo->account, $repo->password, $repo->encoding);
}
diff --git a/lib/scm/subversion.class.php b/lib/scm/subversion.class.php
index 6c52fbf48b..aaa34a4f49 100644
--- a/lib/scm/subversion.class.php
+++ b/lib/scm/subversion.class.php
@@ -100,7 +100,8 @@ class Subversion
foreach($infos as $info)
{
if($onlyDir and $info->kind != 'dir') continue;
- $tags[$info->name] = $info->name;
+ $dirPath = $path . '/' . $info->name;
+ $tags[$dirPath] = $info->name;
}
return $tags;
diff --git a/module/ci/control.php b/module/ci/control.php
index d5a9f9b119..f3e0230c24 100644
--- a/module/ci/control.php
+++ b/module/ci/control.php
@@ -36,7 +36,7 @@ class ci extends control
$this->loadModel('compile');
foreach($scheduleJobs as $job)
{
- if(strpos($job->scheduleDay, $week) !== false) $this->compile->createByIntegration($job->id);
+ if(strpos($job->atDay, $week) !== false) $this->compile->createByIntegration($job->id);
}
echo 'success';
}
@@ -67,7 +67,7 @@ class ci extends control
$scm = $repo->SCM == 'Git' ? 'git' : 'svn';
$savedTag = $this->loadModel($scm)->getSavedTag($repo->id);
- $tags = $this->$scm->getRepoTags($repo, $scm == 'svn' ? $integration->svnFolder : '');
+ $tags = $this->$scm->getRepoTags($repo, $scm == 'svn' ? $integration->svnDir : '');
if(!empty($tags))
{
$arriveLastTag = false;
@@ -86,7 +86,7 @@ class ci extends control
elseif($scm == 'svn')
{
if(isset($savedTag[$tag])) continue;
- $tag = rtrim($repo->path , '/') . '/' . trim($integration->svnFolder, '/') . '/' . $tag;
+ $tag = rtrim($repo->path , '/') . '/' . trim($integration->svnDir, '/') . '/' . $tag;
}
$tagData = new stdclass();
diff --git a/module/ci/model.php b/module/ci/model.php
index 127d685dd5..d6c0623e10 100644
--- a/module/ci/model.php
+++ b/module/ci/model.php
@@ -31,10 +31,10 @@ class ciModel extends model
*/
public function checkBuildStatus()
{
- $compiles = $this->dao->select('t1.*, t2.jenkinsJob, t3.name jenkinsName,t3.serviceUrl,t3.account,t3.token,t3.password')
+ $compiles = $this->dao->select('t1.*, t2.jkJob, t3.name jenkinsName,t3.serviceUrl,t3.account,t3.token,t3.password')
->from(TABLE_COMPILE)->alias('t1')
->leftJoin(TABLE_INTEGRATION)->alias('t2')->on('t1.cijob=t2.id')
- ->leftJoin(TABLE_JENKINS)->alias('t3')->on('t2.jenkins=t3.id')
+ ->leftJoin(TABLE_JENKINS)->alias('t3')->on('t2.jkHost=t3.id')
->where('t1.status')->ne('success')
->andWhere('t1.status')->ne('fail')
->andWhere('t1.status')->ne('timeout')
@@ -55,13 +55,13 @@ class ciModel extends model
if(strripos($response, "404") > -1)
{
/* Queue expired, use another api. */
- $infoUrl = sprintf('%s/job/%s/%s/api/json', $jenkinsServer, $compile->jenkinsJob, $compile->queueItem);
+ $infoUrl = sprintf('%s/job/%s/%s/api/json', $jenkinsServer, $compile->jkJob, $compile->queueItem);
$response = common::http($infoUrl);
$buildInfo = json_decode($response);
$result = strtolower($buildInfo->result);
$this->updateBuildStatus($compile, $result);
- $logUrl = sprintf('%s/job/%s/%s/consoleText', $jenkinsServer, $compile->jenkinsJob, $compile->queueItem);
+ $logUrl = sprintf('%s/job/%s/%s/consoleText', $jenkinsServer, $compile->jkJob, $compile->queueItem);
$response = common::http($logUrl);
$logs = json_decode($response);
diff --git a/module/common/lang/menuOrder.php b/module/common/lang/menuOrder.php
index a92c4942b0..0f4795e6a6 100644
--- a/module/common/lang/menuOrder.php
+++ b/module/common/lang/menuOrder.php
@@ -79,8 +79,8 @@ $lang->testreport->menuOrder = $lang->testcase->menuOrder;
$lang->ci->menuOrder[5] = 'browse';
$lang->ci->menuOrder[10] = 'job';
-$lang->ci->menuOrder[15] = 'maintain';
$lang->ci->menuOrder[20] = 'jenkins';
+$lang->ci->menuOrder[15] = 'maintain';
$lang->ci->menuOrder[25] = 'match';
$lang->repo->menuOrder = $lang->ci->menuOrder;
diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php
index 71e2229138..2595345871 100644
--- a/module/common/lang/zh-cn.php
+++ b/module/common/lang/zh-cn.php
@@ -336,8 +336,8 @@ $lang->ci = new stdclass();
$lang->ci->menu = new stdclass();
$lang->ci->menu->browse = array('link' =>'代码|repo|browse|repoID=%s', 'alias' => 'diff,view,revision,log,blame,showsynccomment');
$lang->ci->menu->job = array('link' =>'构建|integration|browse', 'subModule' => 'compile,integration');
-$lang->ci->menu->maintain = array('link' =>'版本库|repo|maintain', 'alias' => 'create,edit');
$lang->ci->menu->jenkins = array('link' =>'Jenkins|jenkins|browse', 'alias' => 'create,edit');
+$lang->ci->menu->maintain = array('link' =>'版本库|repo|maintain', 'alias' => 'create,edit');
$lang->ci->menu->match = array('link' =>'匹配设置|repo|setmatchcomment');
$lang->repo = new stdclass();
diff --git a/module/compile/model.php b/module/compile/model.php
index adb7a1fca5..5d80cd9006 100644
--- a/module/compile/model.php
+++ b/module/compile/model.php
@@ -25,7 +25,7 @@ class compileModel extends model
return $this->dao->select('t1.id, t1.name, t1.status, t1.createdDate, t2.triggerType, t3.name as repoName, t4.name as jenkinsName')->from(TABLE_COMPILE)->alias('t1')
->leftJoin(TABLE_INTEGRATION)->alias('t2')->on('t1.cijob=t2.id')
->leftJoin(TABLE_REPO)->alias('t3')->on('t2.repo=t3.id')
- ->leftJoin(TABLE_JENKINS)->alias('t4')->on('t2.jenkins=t4.id')
+ ->leftJoin(TABLE_JENKINS)->alias('t4')->on('t2.jkHost=t4.id')
->where('t1.deleted')->eq('0')
->andWhere('t1.cijob')->eq($jobID)
->orderBy($orderBy)
@@ -85,9 +85,9 @@ class compileModel extends model
*/
public function execByCompile($compile, $data = null)
{
- $integration = $this->dao->select('t1.id as jobId,t1.name as jobName,t1.repo,t1.jenkinsJob,t2.name as jenkinsName,t2.serviceUrl,t2.account,t2.token,t2.password')
+ $integration = $this->dao->select('t1.id as jobId,t1.name as jobName,t1.repo,t1.jkJob,t2.name as jenkinsName,t2.serviceUrl,t2.account,t2.token,t2.password')
->from(TABLE_INTEGRATION)->alias('t1')
- ->leftJoin(TABLE_JENKINS)->alias('t2')->on('t1.jenkins=t2.id')
+ ->leftJoin(TABLE_JENKINS)->alias('t2')->on('t1.jkHost=t2.id')
->where('t1.id')->eq($compile->cijob)
->fetch();
@@ -111,9 +111,9 @@ class compileModel extends model
*/
public function execByIntegration($integrationID, $data = null)
{
- $integration = $this->dao->select('t1.id as jobId,t1.name as jobName,t1.repo,t1.jenkinsJob,t2.name as jenkinsName,t2.serviceUrl,t2.account,t2.token,t2.password')
+ $integration = $this->dao->select('t1.id as jobId,t1.name as jobName,t1.repo,t1.jkJob,t2.name as jenkinsName,t2.serviceUrl,t2.account,t2.token,t2.password')
->from(TABLE_INTEGRATION)->alias('t1')
- ->leftJoin(TABLE_JENKINS)->alias('t2')->on('t1.jenkins=t2.id')
+ ->leftJoin(TABLE_JENKINS)->alias('t2')->on('t1.jkHost=t2.id')
->where('t1.id')->eq($integrationID)
->fetch();
@@ -147,7 +147,7 @@ class compileModel extends model
$jenkinsAuth = '://' . $jenkinsUser . ':' . $jenkinsPassword . '@';
$jenkinsServer = str_replace('://', $jenkinsAuth, $jenkinsServer);
- $buildUrl = sprintf('%s/job/%s/buildWithParameters/api/json', $jenkinsServer, $jenkins->jenkinsJob);
+ $buildUrl = sprintf('%s/job/%s/buildWithParameters/api/json', $jenkinsServer, $jenkins->jkJob);
return $buildUrl;
}
}
diff --git a/module/compile/view/browse.html.php b/module/compile/view/browse.html.php
index d4e8477276..dcb0b3dcf0 100644
--- a/module/compile/view/browse.html.php
+++ b/module/compile/view/browse.html.php
@@ -29,7 +29,7 @@
compile->id);?> |
compile->name);?> |
integration->repo;?> |
- integration->jenkins;?> |
+ integration->jkHost;?> |
integration->triggerType;?> |
compile->status);?> |
compile->time);?> |
diff --git a/module/integration/config.php b/module/integration/config.php
index dd9ddf2640..1f185e342a 100644
--- a/module/integration/config.php
+++ b/module/integration/config.php
@@ -2,5 +2,5 @@
$config->integration = new stdclass();
$config->integration->create = new stdclass();
$config->integration->edit = new stdclass();
-$config->integration->create->requiredFields = 'name,repo,jenkins,jenkinsJob,triggerType';
-$config->integration->edit->requiredFields = 'name,repo,jenkins,jenkinsJob,triggerType';
+$config->integration->create->requiredFields = 'name,repo,jkHost,jkJob,triggerType';
+$config->integration->edit->requiredFields = 'name,repo,jkHost,jkJob,triggerType';
diff --git a/module/integration/control.php b/module/integration/control.php
index 6eb3ca7c43..9db7b0dda7 100644
--- a/module/integration/control.php
+++ b/module/integration/control.php
@@ -81,9 +81,9 @@ class integration extends control
$repoPairs[$repo->id] = $repo->name;
$repoTypes[$repo->id] = $repo->SCM;
}
- $this->view->repoPairs = $repoPairs;
- $this->view->repoTypes = $repoTypes;
- $this->view->jenkinsList = $this->loadModel('jenkins')->getPairs();
+ $this->view->repoPairs = $repoPairs;
+ $this->view->repoTypes = $repoTypes;
+ $this->view->jkHostList = $this->loadModel('jenkins')->getPairs();
$this->display();
}
@@ -121,11 +121,11 @@ class integration extends control
$repoTypes[$repo->id] = $repo->SCM;
}
- $this->view->repoPairs = $repoPairs;
- $this->view->repoTypes = $repoTypes;
- $this->view->job = $job;
- $this->view->jenkinsList = $this->loadModel('jenkins')->getPairs();
- $this->view->jenkinsJobs = $this->jenkins->getTasks($job->jenkins);
+ $this->view->repoPairs = $repoPairs;
+ $this->view->repoTypes = $repoTypes;
+ $this->view->job = $job;
+ $this->view->jkHostList = $this->loadModel('jenkins')->getPairs();
+ $this->view->jkJobs = $this->jenkins->getTasks($job->jkHost);
$this->display();
}
diff --git a/module/integration/css/create.css b/module/integration/css/create.css
index f286553966..7c6b27bae7 100644
--- a/module/integration/css/create.css
+++ b/module/integration/css/create.css
@@ -2,3 +2,6 @@
.only-pick-time thead th, .only-pick-time tfoot th {color: transparent !important;}
.checkbox-primary.checkbox-inline{display:inline-block !important;}
.checkbox-primary.checkbox-inline label{padding-left:5px !important;}
+#jkHost_chosen .chosen-single{border-right:0px;}
+#jkJobBox{width:392px;}
+#svnDirBox{width:392px;}
diff --git a/module/integration/css/edit.css b/module/integration/css/edit.css
index 5f526c2e30..52c6386abf 100644
--- a/module/integration/css/edit.css
+++ b/module/integration/css/edit.css
@@ -2,3 +2,6 @@
.only-pick-time thead th, .only-pick-time tfoot th {color: transparent !important;}
.checkbox-primary.checkbox-inline{display:inline-block !important;}
.checkbox-primary.checkbox-inline label{padding-left:5px !important;}
+#jkHost_chosen .chosen-single{border-right:0px;}
+#jkJobBox{width:392px;}
+#svnDirBox{width:392px;}
diff --git a/module/integration/js/create.js b/module/integration/js/create.js
index 06b63e32f5..6c06bc430c 100644
--- a/module/integration/js/create.js
+++ b/module/integration/js/create.js
@@ -5,97 +5,79 @@ $('#repo').change(function()
if(typeof(repoTypes[repoID]) != 'undefined') type = repoTypes[repoID];
$('.svn-fields').toggleClass('hidden', type != 'Subversion');
$('#repoType').val(type);
+ $('#triggerType option[value=tag]').html(type == 'Subversion' ? dirChange : buildTag).trigger('chosen:updated');
+ $('#repo_chosen .chosen-single').attr('style', type == 'Subversion' ? 'border-right:0px' : '');
if(type == 'Subversion')
{
- $('#svnFolderBox').html("");
- $.getJSON(createLink('repo', 'ajaxGetSVNTags', 'repoID=' + repoID), function(svnTags)
+ $('#svnDirBox #svnDir').remove();
+ $('#svnDirBox #svnDir_chosen').remove();
+ $('#svnDirBox .input-group').append("");
+ $.getJSON(createLink('repo', 'ajaxGetSVNDirs', 'repoID=' + repoID), function(tags)
{
- var tags = svnTags['tags'];
- var parents = svnTags['parent'];
-
- html = "