Merge branch 'jihu'

This commit is contained in:
Guan Xiying
2021-07-14 09:48:58 +08:00
84 changed files with 3798 additions and 225 deletions
+26
View File
@@ -5082,4 +5082,30 @@ class upgradeModel extends model
$this->dao->delete()->from(TABLE_GROUP)->where('id')->in(array_keys($projectAdmins))->exec();
return true;
}
public function processGitlabRepo()
{
$repoList = $this->dao->select('*')->from(TABLE_REPO)->where('SCM')->eq('Gitlab')->fetchAll();
foreach($repoList as $repo)
{
/* Create gitlab from repo. */
$gitlab = new stdclass;
$gitlab->type = 'gitlab';
$gitlab->name = $repo->client;
$gitlab->token = base64_decode($repo->password);
$gitlab->private = md5(uniqid());
$this->dao->insert(TABLE_PIPELINE)->data($gitlab)->exec();
$gitlabID = $this->dao->lastInsertID();
preg_match('/projects\/(\d+)\/repository/', $repo->path, $matches);
$gitlabProject = $matches[1];
$products = explode(',', $repo->product);
$this->loadModel('gitlab')->saveProjectRelation($products, $gitlabID, $gitlabProject);
$this->dao->update(TABLE_REPO)->set('client')->eq($gitlabID)->set('path')->eq($gitlabProject)->where('id')->eq($repo->id)->exec();
$this->loadModel("gitlab")->initWebhooks($products, $gitlabID, $gitlabProject);
}
}
}