From 85c7c095f5514d281255243aacefd356b561d6d6 Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Wed, 13 Dec 2023 14:26:42 +0800 Subject: [PATCH] * Adjust cron error for compile. --- module/compile/model.php | 9 +++++---- module/gitlab/model.php | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/module/compile/model.php b/module/compile/model.php index cf67296825..78875f34e8 100644 --- a/module/compile/model.php +++ b/module/compile/model.php @@ -372,12 +372,13 @@ class compileModel extends model } $this->loadModel('job'); - if($job->engine == 'gitlab') $compile = $this->job->execGitlabPipeline($job, $compileID); - if($job->engine == 'jenkins') $compile = $this->job->execJenkinsPipeline($job, $repo, $compileID); + $result = new stdclass(); + if($job->engine == 'gitlab') $result = $this->job->execGitlabPipeline($job, $compileID); + if($job->engine == 'jenkins') $result = $this->job->execJenkinsPipeline($job, $repo, $compileID); - $this->dao->update(TABLE_COMPILE)->data($compile)->where('id')->eq($compileID)->exec(); + $this->dao->update(TABLE_COMPILE)->data($result)->where('id')->eq($compileID)->exec(); $this->dao->update(TABLE_JOB) - ->set('lastStatus')->eq($compile->status) + ->set('lastStatus')->eq($result->status) ->set('lastExec')->eq($compile->updateDate) ->where('id')->eq($job->id) ->exec(); diff --git a/module/gitlab/model.php b/module/gitlab/model.php index 19bfcaa1ec..2c52fed718 100644 --- a/module/gitlab/model.php +++ b/module/gitlab/model.php @@ -565,6 +565,8 @@ class gitlabModel extends model /* Also use `per_page=20` to fetch users in API. Fetch active users only. */ $url = sprintf($apiRoot, "/users") . "&order_by={$order}&sort={$sort}&page={$page}&per_page={$perPage}&active=true"; $httpData = commonModel::http($url, null, array(), array(), 'data', 'GET', 30, true, false); + if(empty($httpData['body'])) break; + $result = json_decode($httpData['body']); if(!empty($result) && is_array($result)) {