Merge branch 'sprint/169' into 'sprint/169'

* Adjust and correct codes for gitlab module.

See merge request easycorp/zentaopms!222
This commit is contained in:
朱金勇
2021-11-01 02:11:15 +00:00
6 changed files with 14 additions and 15 deletions
+1 -1
View File
@@ -134,7 +134,7 @@ class compileModel extends model
if($job->triggerType == 'tag')
{
$lastTag = $this->getLastTagByRepo($repo);
$lastTag = $this->loadModel('job')->getLastTagByRepo($repo);
if($lastTag)
{
$job->lastTag = $lastTag;
+1 -1
View File
@@ -13,7 +13,7 @@ $lang->gitlab->delete = 'Delete GitLab';
$lang->gitlab->confirmDelete = 'Do you want to delete this GitLab server?';
$lang->gitlab->gitlabAccount = 'GitLab Account';
$lang->gitlab->zentaoAccount = 'Zentao Account';
$lang->gitlab->serverFail = 'Conntect to GitLab server failed, please check the GitLab server.';
$lang->gitlab->serverFail = 'Connect to GitLab server failed, please check the GitLab server.';
$lang->gitlab->browseAction = 'GitLab List';
$lang->gitlab->deleteAction = 'Delete GitLab';
+7 -8
View File
@@ -386,7 +386,7 @@ class gitlabModel extends model
if(is_numeric($host)) $host = $this->getApiRoot($host);
if(strpos($host, 'http://') !== 0 and strpos($host, 'https://') !== 0) return false;
$url = sprintf($apiRoot, $api);
$url = sprintf($host, $api);
return json_decode(commonModel::http($url, $data, $options));
}
@@ -456,7 +456,7 @@ class gitlabModel extends model
*
* @param int $gitlabID
* @access public
* @return void
* @return array
*/
public function apiGetProjects($gitlabID)
{
@@ -673,6 +673,7 @@ class gitlabModel extends model
public function apiUpdateHook($gitlabID, $projectID, $hookID)
{
$apiRoot = $this->getApiRoot($gitlabID);
$url = sprintf($apiRoot, "/projects/{$projectID}/hooks/{$hookID}");
$postData = new stdclass;
$postData->enable_ssl_verification = "false";
@@ -681,8 +682,6 @@ class gitlabModel extends model
$postData->push_events = "true";
$postData->tag_push_events = "true";
$postData->note_events = "true";
$postData->url = $url;
$postData->token = $token;
$url = sprintf($apiRoot, "/projects/{$projectID}/hooks/{$hookID}");
return commonModel::http($url, $postData, $options = array(CURLOPT_CUSTOMREQUEST => 'PUT'));
@@ -1231,9 +1230,9 @@ class gitlabModel extends model
/**
* Create webhook for zentao.
*
* @param int $products
* @param int $gitlabID
* @param int $projectID
* @param array $products
* @param int $gitlabID
* @param int $projectID
* @access public
* @return bool
*/
@@ -1346,7 +1345,7 @@ class gitlabModel extends model
if($value) $issue->$field = $value;
}
if($isset($issue->assignee_id) and $issue->assignee_id == 'closed') unset($issue->assignee_id);
if(isset($issue->assignee_id) and $issue->assignee_id == 'closed') unset($issue->assignee_id);
/* issue->state is null when creating it, we should put status_event when updating it. */
if(isset($issue->state) and $issue->state == 'closed') $issue->state_event = 'close';
-1
View File
@@ -27,4 +27,3 @@
</div>
<?php include '../../common/view/footer.html.php';?>
+1 -1
View File
@@ -352,7 +352,7 @@ class job extends control
if($productLeft == $productRight) $matchedProducts[$productName] = $productRight;
}
}
die(json_encode($matchedProduct));
die(json_encode($matchedProducts));
}
$productName = $this->loadModel('product')->getByID($repo->product)->name;
+4 -3
View File
@@ -364,7 +364,7 @@ class jobModel extends model
if($job->triggerType == 'tag')
{
$lastTag = $this->getLastTagByRepo($repo);
$lastTag = $this->getLastTagByRepo($repo, $job);
if($lastTag)
{
$build->tag = $lastTag;
@@ -430,7 +430,7 @@ class jobModel extends model
/**
* Exec gitlab pipeline.
*
* @param int $job
* @param object $job
* @access public
* @return void
*/
@@ -473,10 +473,11 @@ class jobModel extends model
* Get last tag of one repo.
*
* @param object $repo
* @param object $job
* @access public
* @return void
*/
public function getLastTagByRepo($repo)
public function getLastTagByRepo($repo, $job)
{
if($repo->SCM == 'Subversion')
{