* Dealing with the default branch problem of Gitlab pipeline.

This commit is contained in:
caoyanyi
2023-11-07 17:02:49 +08:00
parent 3ef5acf8a5
commit 707c5422af
+9 -1
View File
@@ -576,7 +576,15 @@ class jobModel extends model
$pipeline = json_decode($job->pipeline);
$pipelineParams = new stdclass;
$pipelineParams->ref = $pipeline->reference ? $pipeline->reference : 'master';
$pipelineParams->ref = zget($pipeline, 'reference', '');
if(!$pipelineParams->ref)
{
$project = $this->loadModel('gitlab')->apiGetSingleProject($job->server, $pipeline->project, false);
$pipelineParams->ref = zget($project, 'default_branch', 'master');
$pipeline->reference = $pipelineParams->ref;
$this->dao->update(TABLE_JOB)->set('pipeline')->eq(json_encode($pipeline))->where('id')->eq($job->id)->exec();
}
$customParams = json_decode($job->customParam);
$variables = array();