This is an automated email from the ASF dual-hosted git repository.
lynwee pushed a commit to branch release-v1.0
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/release-v1.0 by this push:
new 44663407a fix(gitlab): avoid adding clause when table not present
(#7868)
44663407a is described below
commit 44663407a98cb1b41b2ec698c80eb8b404985509
Author: Lynwee <[email protected]>
AuthorDate: Fri Aug 9 09:44:46 2024 +0800
fix(gitlab): avoid adding clause when table not present (#7868)
---
backend/plugins/gitlab/tasks/trigger_job_collector.go | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/backend/plugins/gitlab/tasks/trigger_job_collector.go
b/backend/plugins/gitlab/tasks/trigger_job_collector.go
index 37ceba215..e1b4652b9 100644
--- a/backend/plugins/gitlab/tasks/trigger_job_collector.go
+++ b/backend/plugins/gitlab/tasks/trigger_job_collector.go
@@ -81,14 +81,18 @@ func GetAllPipelinesIterator(taskCtx plugin.SubTaskContext,
apiCollector *helper
dal.Select("gp.gitlab_id, gp.gitlab_id as iid"),
dal.From("_tool_gitlab_pipelines gp"),
dal.Where(
- `gp.project_id = ? and gp.connection_id = ? and
gp.gitlab_id not in (select json_extract(tj.input, '$.GitlabId') as gitlab_id
from _raw_gitlab_api_trigger_job tj)`,
+ `gp.project_id = ? and gp.connection_id = ? `,
data.Options.ProjectId, data.Options.ConnectionId,
),
}
+
+ if db.HasTable("_raw_gitlab_api_trigger_job") {
+ clauses = append(clauses, dal.Where("gp.gitlab_id not in
(select json_extract(tj.input, '$.GitlabId') as gitlab_id from
_raw_gitlab_api_trigger_job tj)"))
+ }
if apiCollector.IsIncremental() && apiCollector.GetSince() != nil {
clauses = append(clauses, dal.Where("gitlab_updated_at > ?",
apiCollector.GetSince()))
}
- // construct the input iterator
+
cursor, err := db.Cursor(clauses...)
if err != nil {
return nil, err