From 310a5f9ae0e0d2fe818602e1f8077e0c20e5e5bc Mon Sep 17 00:00:00 2001 From: warren Date: Sun, 15 Mar 2026 13:06:17 +0800 Subject: [PATCH] fix(jenkins): scope multi-branch build collector query by job full_name When multiple multi-branch pipelines exist, collectMultiBranchJobApiBuilds() queries child jobs without filtering by the parent pipeline's full_name. This causes records in _raw_jenkins_api_builds to have mismatched params (belonging to one pipeline) and URLs (pointing to jobs from other pipelines). Add `full_name LIKE ?` filter to the WHERE clause, matching the pattern already used in stage_collector.go line 145. This scopes the query to only return child jobs under the current multi-branch pipeline. --- backend/plugins/jenkins/tasks/build_collector.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/plugins/jenkins/tasks/build_collector.go b/backend/plugins/jenkins/tasks/build_collector.go index 0d792c61454..7d00ae159c8 100644 --- a/backend/plugins/jenkins/tasks/build_collector.go +++ b/backend/plugins/jenkins/tasks/build_collector.go @@ -150,8 +150,8 @@ func collectMultiBranchJobApiBuilds(taskCtx plugin.SubTaskContext) errors.Error clauses := []dal.Clause{ dal.Select("j.full_name,j.name,j.path,j.class,j.url"), dal.From("_tool_jenkins_jobs as j"), - dal.Where(`j.connection_id = ? and j.class = ? and j._raw_data_table = ?`, - data.Options.ConnectionId, WORKFLOW_JOB, fmt.Sprintf("_raw_%s", RAW_JOB_TABLE)), + dal.Where(`j.connection_id = ? and j.class = ? and j._raw_data_table = ? and j.full_name like ?`, + data.Options.ConnectionId, WORKFLOW_JOB, fmt.Sprintf("_raw_%s", RAW_JOB_TABLE), fmt.Sprintf("%s%%", data.Options.JobFullName)), } cursor, err := db.Cursor(clauses...) if err != nil {