From 89d2383a225f655ad46dc56268835b6d7dfe5289 Mon Sep 17 00:00:00 2001 From: hanjingtian <312433810+hanjingtian@users.noreply.github.com> Date: Wed, 9 Sep 2026 16:08:25 +0800 Subject: [PATCH 1/7] [TRTLLMINF-346][fix] add Git mirror fallback for PR diffs Signed-off-by: hanjingtian <312433810+hanjingtian@users.noreply.github.com> --- jenkins/L0_MergeRequest.groovy | 72 ++++++++++++++++++++++++++++++++-- 1 file changed, 69 insertions(+), 3 deletions(-) diff --git a/jenkins/L0_MergeRequest.groovy b/jenkins/L0_MergeRequest.groovy index 1ef2aac37c97..93b0ac53af22 100644 --- a/jenkins/L0_MergeRequest.groovy +++ b/jenkins/L0_MergeRequest.groovy @@ -778,6 +778,69 @@ def getGithubMRChangedFile(pipeline, githubPrApiUrl, function, filePath="") { return result } +def getGitMirrorMRChangedFile(pipeline, globalVars, function, filePath="", filePaths=[]) { + def wrapperBuildNumber = globalVars[ACTION_INFO]?.get("parents")?.getAt(0)?.get("build_number")?.toString() + def headCommit = env.gitlabCommit?.toString() + def baseRef = "refs/heads/prjob/${wrapperBuildNumber}/base" + withCredentials([ + gitUsernamePassword( + credentialsId: 'svc_tensorrt_gitlab_api_token', + gitToolName: 'Default' + ), + ]) { + pipeline.sh "git -C ${LLM_ROOT} fetch --no-tags --depth=1 origin ${baseRef}" + } + def baseCommit = pipeline.sh( + script: "git -C ${LLM_ROOT} rev-parse FETCH_HEAD", + returnStdout: true + ).trim() + pipeline.echo("Using internal Git mirror diff: ${baseCommit}...${headCommit}") + + if (function == "getChangedFileList") { + def nameStatus = pipeline.sh( + script: "git -C ${LLM_ROOT} -c core.quotepath=false diff --name-status --find-renames ${baseCommit} ${headCommit}", + returnStdout: true + ) + return nameStatus.readLines().collectMany { line -> + line.split('\t', -1).drop(1).findAll { it } + } + } + + def getFileDiff = { changedFilePath -> + def rawDiff = "" + pipeline.withEnv(["GIT_DIFF_PATH=${changedFilePath}"]) { + rawDiff = pipeline.sh( + script: "git -C ${LLM_ROOT} diff --unified=3 --find-renames ${baseCommit} ${headCommit} -- \"\${GIT_DIFF_PATH}\"", + returnStdout: true + ) + } + def lines = rawDiff.readLines() + def firstHunk = lines.findIndexOf { it.startsWith("@@") } + return firstHunk < 0 ? "" : lines.drop(firstHunk).join("\n") + } + + if (function == "getOneFileChanges") { + return getFileDiff(filePath) + } + if (function == "getFileChanges") { + return filePaths.unique().collectEntries { changedFilePath -> + [(changedFilePath): getFileDiff(changedFilePath)] + } + } + pipeline.error("Unsupported PR diff operation: ${function}") +} + +def getGithubMRChangedFileWithFallback(pipeline, globalVars, function, filePath="", filePaths=[]) { + try { + return getGithubMRChangedFile(pipeline, globalVars[GITHUB_PR_API_URL], function, filePath) + } catch (InterruptedException e) { + throw e + } catch (Exception e) { + pipeline.echo("GitHub PR files API failed; falling back to the internal Git mirror. Error: ${e.toString()}") + return getGitMirrorMRChangedFile(pipeline, globalVars, function, filePath, filePaths) + } +} + // Gate multi-GPU stages behind 'ci: full pre-merge approved' label. // Uses trtllm_utils.validatePRLabelApproval() from the shared lib to verify // both label existence and that the labeler is an active team member. @@ -843,7 +906,8 @@ def getMergeRequestChangedFileList(pipeline, globalVars) { try { def changedFileList = [] if (githubPrApiUrl != null) { - changedFileList = getGithubMRChangedFile(pipeline, githubPrApiUrl, "getChangedFileList") + changedFileList = getGithubMRChangedFileWithFallback( + pipeline, globalVars, "getChangedFileList") } else { changedFileList = getGitlabMRChangedFile(pipeline, "getChangedFileList") } @@ -876,7 +940,8 @@ def getMergeRequestOneFileChanges(pipeline, globalVars, filePath) { def diff = "" if (githubPrApiUrl != null) { - diff = getGithubMRChangedFile(pipeline, githubPrApiUrl, "getOneFileChanges", filePath) + diff = getGithubMRChangedFileWithFallback( + pipeline, globalVars, "getOneFileChanges", filePath) } else { diff = getGitlabMRChangedFile(pipeline, "getOneFileChanges", filePath) } @@ -977,7 +1042,8 @@ def getCbtsResult(pipeline, testFilter, globalVars) if (filesNeedingDiff) { def githubPrApiUrl = globalVars[GITHUB_PR_API_URL] def fileChanges = githubPrApiUrl != null - ? getGithubMRChangedFile(pipeline, githubPrApiUrl, "getFileChanges") + ? getGithubMRChangedFileWithFallback( + pipeline, globalVars, "getFileChanges", "", filesNeedingDiff) : getGitlabMRChangedFile(pipeline, "getFileChanges") diffs = filesNeedingDiff.collectEntries { filePath -> // Null (patch omitted for binary / rename / too-large diffs) coerces to empty. From 300c3ebccb804eddd2922e1519200572758e60ef Mon Sep 17 00:00:00 2001 From: hanjingtian <312433810+hanjingtian@users.noreply.github.com> Date: Wed, 9 Sep 2026 17:21:07 +0800 Subject: [PATCH 2/7] [TRTLLMINF-346][fix] preserve PR diff parity for renames Signed-off-by: hanjingtian <312433810+hanjingtian@users.noreply.github.com> --- jenkins/L0_MergeRequest.groovy | 65 +++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 28 deletions(-) diff --git a/jenkins/L0_MergeRequest.groovy b/jenkins/L0_MergeRequest.groovy index 93b0ac53af22..7fae9a5933f1 100644 --- a/jenkins/L0_MergeRequest.groovy +++ b/jenkins/L0_MergeRequest.groovy @@ -782,50 +782,62 @@ def getGitMirrorMRChangedFile(pipeline, globalVars, function, filePath="", fileP def wrapperBuildNumber = globalVars[ACTION_INFO]?.get("parents")?.getAt(0)?.get("build_number")?.toString() def headCommit = env.gitlabCommit?.toString() def baseRef = "refs/heads/prjob/${wrapperBuildNumber}/base" - withCredentials([ - gitUsernamePassword( - credentialsId: 'svc_tensorrt_gitlab_api_token', - gitToolName: 'Default' - ), - ]) { + withCredentials([gitUsernamePassword(credentialsId: 'svc_tensorrt_gitlab_api_token', gitToolName: 'Default'),]) { pipeline.sh "git -C ${LLM_ROOT} fetch --no-tags --depth=1 origin ${baseRef}" } - def baseCommit = pipeline.sh( - script: "git -C ${LLM_ROOT} rev-parse FETCH_HEAD", - returnStdout: true - ).trim() + def baseCommit = pipeline.sh(script: "git -C ${LLM_ROOT} rev-parse FETCH_HEAD", returnStdout: true).trim() pipeline.echo("Using internal Git mirror diff: ${baseCommit}...${headCommit}") + def nameStatus = pipeline.sh( + script: "git -C ${LLM_ROOT} -c core.quotepath=false diff --name-status --find-renames ${baseCommit} ${headCommit}", + returnStdout: true + ) + def changedFiles = nameStatus.readLines().collect { line -> + def fields = line.split('\t', -1) + [status: fields[0], paths: fields.drop(1).findAll { it }] + } if (function == "getChangedFileList") { - def nameStatus = pipeline.sh( - script: "git -C ${LLM_ROOT} -c core.quotepath=false diff --name-status --find-renames ${baseCommit} ${headCommit}", - returnStdout: true - ) - return nameStatus.readLines().collectMany { line -> - line.split('\t', -1).drop(1).findAll { it } + return changedFiles.collectMany { changedFile -> + changedFile.status.startsWith("R") || changedFile.status.startsWith("C") + ? changedFile.paths.reverse() + : changedFile.paths } } + def renamePaths = [:] + changedFiles.findAll { changedFile -> + changedFile.status.startsWith("R") || changedFile.status.startsWith("C") + }.each { changedFile -> + changedFile.paths.each { changedFilePath -> renamePaths[changedFilePath] = changedFile.paths } + } + def cachedDiffs = [:] def getFileDiff = { changedFilePath -> + if (cachedDiffs.containsKey(changedFilePath)) { + return cachedDiffs[changedFilePath] + } + def diffPaths = renamePaths.get(changedFilePath, [changedFilePath]) def rawDiff = "" - pipeline.withEnv(["GIT_DIFF_PATH=${changedFilePath}"]) { + pipeline.withEnv([ + "GIT_DIFF_PATH=${diffPaths[0]}", + "GIT_DIFF_RENAME_PATH=${diffPaths.size() > 1 ? diffPaths[1] : diffPaths[0]}", + ]) { rawDiff = pipeline.sh( - script: "git -C ${LLM_ROOT} diff --unified=3 --find-renames ${baseCommit} ${headCommit} -- \"\${GIT_DIFF_PATH}\"", + script: "git -C ${LLM_ROOT} diff --unified=3 --inter-hunk-context=1 --find-renames ${baseCommit} ${headCommit} -- \"\${GIT_DIFF_PATH}\" \"\${GIT_DIFF_RENAME_PATH}\"", returnStdout: true ) } def lines = rawDiff.readLines() def firstHunk = lines.findIndexOf { it.startsWith("@@") } - return firstHunk < 0 ? "" : lines.drop(firstHunk).join("\n") + def diff = firstHunk < 0 ? "" : lines.drop(firstHunk).join("\n") + diffPaths.each { diffPath -> cachedDiffs[diffPath] = diff } + return diff } if (function == "getOneFileChanges") { return getFileDiff(filePath) } if (function == "getFileChanges") { - return filePaths.unique().collectEntries { changedFilePath -> - [(changedFilePath): getFileDiff(changedFilePath)] - } + return filePaths.unique().collectEntries { changedFilePath -> [(changedFilePath): getFileDiff(changedFilePath)] } } pipeline.error("Unsupported PR diff operation: ${function}") } @@ -906,8 +918,7 @@ def getMergeRequestChangedFileList(pipeline, globalVars) { try { def changedFileList = [] if (githubPrApiUrl != null) { - changedFileList = getGithubMRChangedFileWithFallback( - pipeline, globalVars, "getChangedFileList") + changedFileList = getGithubMRChangedFileWithFallback(pipeline, globalVars, "getChangedFileList") } else { changedFileList = getGitlabMRChangedFile(pipeline, "getChangedFileList") } @@ -940,8 +951,7 @@ def getMergeRequestOneFileChanges(pipeline, globalVars, filePath) { def diff = "" if (githubPrApiUrl != null) { - diff = getGithubMRChangedFileWithFallback( - pipeline, globalVars, "getOneFileChanges", filePath) + diff = getGithubMRChangedFileWithFallback(pipeline, globalVars, "getOneFileChanges", filePath) } else { diff = getGitlabMRChangedFile(pipeline, "getOneFileChanges", filePath) } @@ -1042,8 +1052,7 @@ def getCbtsResult(pipeline, testFilter, globalVars) if (filesNeedingDiff) { def githubPrApiUrl = globalVars[GITHUB_PR_API_URL] def fileChanges = githubPrApiUrl != null - ? getGithubMRChangedFileWithFallback( - pipeline, globalVars, "getFileChanges", "", filesNeedingDiff) + ? getGithubMRChangedFileWithFallback(pipeline, globalVars, "getFileChanges", "", filesNeedingDiff) : getGitlabMRChangedFile(pipeline, "getFileChanges") diffs = filesNeedingDiff.collectEntries { filePath -> // Null (patch omitted for binary / rename / too-large diffs) coerces to empty. From f76df647743814cc546f20d095be50901fef66a4 Mon Sep 17 00:00:00 2001 From: hanjingtian <312433810+hanjingtian@users.noreply.github.com> Date: Wed, 9 Sep 2026 17:34:29 +0800 Subject: [PATCH 3/7] [TRTLLMINF-346][fix] treat changed file paths literally Signed-off-by: hanjingtian <312433810+hanjingtian@users.noreply.github.com> --- jenkins/L0_MergeRequest.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins/L0_MergeRequest.groovy b/jenkins/L0_MergeRequest.groovy index 7fae9a5933f1..3ff530c4e733 100644 --- a/jenkins/L0_MergeRequest.groovy +++ b/jenkins/L0_MergeRequest.groovy @@ -822,7 +822,7 @@ def getGitMirrorMRChangedFile(pipeline, globalVars, function, filePath="", fileP "GIT_DIFF_RENAME_PATH=${diffPaths.size() > 1 ? diffPaths[1] : diffPaths[0]}", ]) { rawDiff = pipeline.sh( - script: "git -C ${LLM_ROOT} diff --unified=3 --inter-hunk-context=1 --find-renames ${baseCommit} ${headCommit} -- \"\${GIT_DIFF_PATH}\" \"\${GIT_DIFF_RENAME_PATH}\"", + script: "git -C ${LLM_ROOT} diff --unified=3 --inter-hunk-context=1 --find-renames ${baseCommit} ${headCommit} -- \":(literal)\${GIT_DIFF_PATH}\" \":(literal)\${GIT_DIFF_RENAME_PATH}\"", returnStdout: true ) } From b13384054c2c09a689719f60cf51bd527dcde3e2 Mon Sep 17 00:00:00 2001 From: hanjingtian <312433810+hanjingtian@users.noreply.github.com> Date: Wed, 9 Sep 2026 18:01:13 +0800 Subject: [PATCH 4/7] [TRTLLMINF-346][fix] harden PR diff fallback Signed-off-by: hanjingtian <312433810+hanjingtian@users.noreply.github.com> --- jenkins/L0_MergeRequest.groovy | 68 +++++++++++++++++++++++++--------- 1 file changed, 50 insertions(+), 18 deletions(-) diff --git a/jenkins/L0_MergeRequest.groovy b/jenkins/L0_MergeRequest.groovy index 3ff530c4e733..88eebd25ad00 100644 --- a/jenkins/L0_MergeRequest.groovy +++ b/jenkins/L0_MergeRequest.groovy @@ -749,7 +749,7 @@ def getGithubMRChangedFile(pipeline, githubPrApiUrl, function, filePath="") { } rawDataList.find { rawData -> if (rawData.get("filename") == filePath || rawData.get("previous_filename") == filePath) { - result = rawData.get("patch") + result = rawData.get("patch") ?: "" return true } return false @@ -769,7 +769,7 @@ def getGithubMRChangedFile(pipeline, githubPrApiUrl, function, filePath="") { rawDataList.each { rawData -> [rawData.get("filename"), rawData.get("previous_filename")] .findAll { it } - .each { changedFilePath -> result[changedFilePath] = rawData.get("patch") } + .each { changedFilePath -> result[changedFilePath] = rawData.get("patch") ?: "" } } } if (!rawDataList) { break } @@ -781,20 +781,42 @@ def getGithubMRChangedFile(pipeline, githubPrApiUrl, function, filePath="") { def getGitMirrorMRChangedFile(pipeline, globalVars, function, filePath="", filePaths=[]) { def wrapperBuildNumber = globalVars[ACTION_INFO]?.get("parents")?.getAt(0)?.get("build_number")?.toString() def headCommit = env.gitlabCommit?.toString() + if (!(wrapperBuildNumber ==~ /\d+/)) { + pipeline.error("Cannot use internal Git mirror fallback: missing or invalid wrapper build number.") + } + if (!(headCommit ==~ /[0-9a-fA-F]{40}/)) { + pipeline.error("Cannot use internal Git mirror fallback: missing or invalid PR head commit.") + } def baseRef = "refs/heads/prjob/${wrapperBuildNumber}/base" - withCredentials([gitUsernamePassword(credentialsId: 'svc_tensorrt_gitlab_api_token', gitToolName: 'Default'),]) { - pipeline.sh "git -C ${LLM_ROOT} fetch --no-tags --depth=1 origin ${baseRef}" + pipeline.withEnv(["GIT_DIFF_BASE_REF=${baseRef}"]) { + withCredentials([gitUsernamePassword(credentialsId: 'svc_tensorrt_gitlab_api_token', gitToolName: 'Default'),]) { + pipeline.sh "git -C ${LLM_ROOT} fetch --no-tags --depth=1 origin \"\${GIT_DIFF_BASE_REF}\"" + } } def baseCommit = pipeline.sh(script: "git -C ${LLM_ROOT} rev-parse FETCH_HEAD", returnStdout: true).trim() pipeline.echo("Using internal Git mirror diff: ${baseCommit}...${headCommit}") - def nameStatus = pipeline.sh( - script: "git -C ${LLM_ROOT} -c core.quotepath=false diff --name-status --find-renames ${baseCommit} ${headCommit}", + def encodedNameStatus = pipeline.sh( + script: """ + name_status_file=\$(mktemp) + trap 'rm -f "\${name_status_file}"' EXIT + git -C ${LLM_ROOT} diff --name-status --find-renames -z ${baseCommit} ${headCommit} > "\${name_status_file}" + base64 < "\${name_status_file}" + """, returnStdout: true - ) - def changedFiles = nameStatus.readLines().collect { line -> - def fields = line.split('\t', -1) - [status: fields[0], paths: fields.drop(1).findAll { it }] + ).readLines().join() + def fields = new String(encodedNameStatus.decodeBase64(), "UTF-8") + .tokenize(Character.toString((char) 0)) + def changedFiles = [] + def fieldIndex = 0 + while (fieldIndex < fields.size()) { + def status = fields[fieldIndex++] + def pathCount = status.startsWith("R") || status.startsWith("C") ? 2 : 1 + if (fieldIndex + pathCount > fields.size()) { + pipeline.error("Malformed internal Git mirror name-status record.") + } + changedFiles << [status: status, paths: fields.subList(fieldIndex, fieldIndex + pathCount).toList()] + fieldIndex += pathCount } if (function == "getChangedFileList") { return changedFiles.collectMany { changedFile -> @@ -848,8 +870,11 @@ def getGithubMRChangedFileWithFallback(pipeline, globalVars, function, filePath= } catch (InterruptedException e) { throw e } catch (Exception e) { - pipeline.echo("GitHub PR files API failed; falling back to the internal Git mirror. Error: ${e.toString()}") - return getGitMirrorMRChangedFile(pipeline, globalVars, function, filePath, filePaths) + pipeline.echo("WARNING: [PR_DIFF_FALLBACK] GitHub PR files API failed for ${function}; " + + "trying the internal Git mirror. Error: ${e.toString()}") + def result = getGitMirrorMRChangedFile(pipeline, globalVars, function, filePath, filePaths) + pipeline.echo("WARNING: [PR_DIFF_FALLBACK] Internal Git mirror fallback succeeded for ${function}.") + return result } } @@ -915,24 +940,31 @@ def getMergeRequestChangedFileList(pipeline, globalVars) { if (globalVars[CACHED_CHANGED_FILE_LIST] != null) { return globalVars[CACHED_CHANGED_FILE_LIST] } + def changedFileList = [] try { - def changedFileList = [] if (githubPrApiUrl != null) { changedFileList = getGithubMRChangedFileWithFallback(pipeline, globalVars, "getChangedFileList") } else { changedFileList = getGitlabMRChangedFile(pipeline, "getChangedFileList") } - def changedFileListStr = changedFileList.join(",\n") - pipeline.echo("The changeset of this MR is: ${changedFileListStr}.") - globalVars[CACHED_CHANGED_FILE_LIST] = changedFileList - return globalVars[CACHED_CHANGED_FILE_LIST] } catch (InterruptedException e) { throw e } catch (Exception e) { - pipeline.echo("Get merge request changed file list failed. Error: ${e.toString()}") + if (githubPrApiUrl != null) { + catchError(buildResult: 'SUCCESS', stageResult: 'UNSTABLE') { + error "Failed to get the changed-file list from both the GitHub API and internal Git mirror. " + + "Continuing with an empty list. Error: ${e.toString()}" + } + } else { + pipeline.echo("Get merge request changed file list failed. Error: ${e.toString()}") + } globalVars[CACHED_CHANGED_FILE_LIST] = [] return globalVars[CACHED_CHANGED_FILE_LIST] } + def changedFileListStr = changedFileList.join(",\n") + pipeline.echo("The changeset of this MR is: ${changedFileListStr}.") + globalVars[CACHED_CHANGED_FILE_LIST] = changedFileList + return globalVars[CACHED_CHANGED_FILE_LIST] } def getMergeRequestOneFileChanges(pipeline, globalVars, filePath) { From 376c5333dd0ec7a15cb7f947338e393c4c553cd3 Mon Sep 17 00:00:00 2001 From: hanjingtian <312433810+hanjingtian@users.noreply.github.com> Date: Thu, 10 Sep 2026 10:35:37 +0800 Subject: [PATCH 5/7] [TRTLLMINF-346][refactor] simplify Git mirror diff fallback Signed-off-by: hanjingtian <312433810+hanjingtian@users.noreply.github.com> --- jenkins/L0_MergeRequest.groovy | 36 +++++++--------------------------- 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/jenkins/L0_MergeRequest.groovy b/jenkins/L0_MergeRequest.groovy index 88eebd25ad00..4e093e6bceda 100644 --- a/jenkins/L0_MergeRequest.groovy +++ b/jenkins/L0_MergeRequest.groovy @@ -781,12 +781,6 @@ def getGithubMRChangedFile(pipeline, githubPrApiUrl, function, filePath="") { def getGitMirrorMRChangedFile(pipeline, globalVars, function, filePath="", filePaths=[]) { def wrapperBuildNumber = globalVars[ACTION_INFO]?.get("parents")?.getAt(0)?.get("build_number")?.toString() def headCommit = env.gitlabCommit?.toString() - if (!(wrapperBuildNumber ==~ /\d+/)) { - pipeline.error("Cannot use internal Git mirror fallback: missing or invalid wrapper build number.") - } - if (!(headCommit ==~ /[0-9a-fA-F]{40}/)) { - pipeline.error("Cannot use internal Git mirror fallback: missing or invalid PR head commit.") - } def baseRef = "refs/heads/prjob/${wrapperBuildNumber}/base" pipeline.withEnv(["GIT_DIFF_BASE_REF=${baseRef}"]) { withCredentials([gitUsernamePassword(credentialsId: 'svc_tensorrt_gitlab_api_token', gitToolName: 'Default'),]) { @@ -796,33 +790,17 @@ def getGitMirrorMRChangedFile(pipeline, globalVars, function, filePath="", fileP def baseCommit = pipeline.sh(script: "git -C ${LLM_ROOT} rev-parse FETCH_HEAD", returnStdout: true).trim() pipeline.echo("Using internal Git mirror diff: ${baseCommit}...${headCommit}") - def encodedNameStatus = pipeline.sh( - script: """ - name_status_file=\$(mktemp) - trap 'rm -f "\${name_status_file}"' EXIT - git -C ${LLM_ROOT} diff --name-status --find-renames -z ${baseCommit} ${headCommit} > "\${name_status_file}" - base64 < "\${name_status_file}" - """, + def nameStatus = pipeline.sh( + script: "git -C ${LLM_ROOT} -c core.quotepath=false diff --name-status --find-renames ${baseCommit} ${headCommit}", returnStdout: true - ).readLines().join() - def fields = new String(encodedNameStatus.decodeBase64(), "UTF-8") - .tokenize(Character.toString((char) 0)) - def changedFiles = [] - def fieldIndex = 0 - while (fieldIndex < fields.size()) { - def status = fields[fieldIndex++] - def pathCount = status.startsWith("R") || status.startsWith("C") ? 2 : 1 - if (fieldIndex + pathCount > fields.size()) { - pipeline.error("Malformed internal Git mirror name-status record.") - } - changedFiles << [status: status, paths: fields.subList(fieldIndex, fieldIndex + pathCount).toList()] - fieldIndex += pathCount + ) + def changedFiles = nameStatus.readLines().collect { line -> + def fields = line.split('\t', -1) + [status: fields[0], paths: fields.drop(1).findAll { it }] } if (function == "getChangedFileList") { return changedFiles.collectMany { changedFile -> - changedFile.status.startsWith("R") || changedFile.status.startsWith("C") - ? changedFile.paths.reverse() - : changedFile.paths + changedFile.status.startsWith("R") || changedFile.status.startsWith("C")? changedFile.paths.reverse(): changedFile.paths } } From 915c533781e2b6fbf32bc7344e703820bcd4afa5 Mon Sep 17 00:00:00 2001 From: hanjingtian <312433810+hanjingtian@users.noreply.github.com> Date: Thu, 10 Sep 2026 10:47:31 +0800 Subject: [PATCH 6/7] [TRTLLMINF-346][refactor] preserve changed-file failure behavior Signed-off-by: hanjingtian <312433810+hanjingtian@users.noreply.github.com> --- jenkins/L0_MergeRequest.groovy | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/jenkins/L0_MergeRequest.groovy b/jenkins/L0_MergeRequest.groovy index 4e093e6bceda..88b9b85ecf4c 100644 --- a/jenkins/L0_MergeRequest.groovy +++ b/jenkins/L0_MergeRequest.groovy @@ -918,31 +918,24 @@ def getMergeRequestChangedFileList(pipeline, globalVars) { if (globalVars[CACHED_CHANGED_FILE_LIST] != null) { return globalVars[CACHED_CHANGED_FILE_LIST] } - def changedFileList = [] try { + def changedFileList = [] if (githubPrApiUrl != null) { changedFileList = getGithubMRChangedFileWithFallback(pipeline, globalVars, "getChangedFileList") } else { changedFileList = getGitlabMRChangedFile(pipeline, "getChangedFileList") } + def changedFileListStr = changedFileList.join(",\n") + pipeline.echo("The changeset of this MR is: ${changedFileListStr}.") + globalVars[CACHED_CHANGED_FILE_LIST] = changedFileList + return globalVars[CACHED_CHANGED_FILE_LIST] } catch (InterruptedException e) { throw e } catch (Exception e) { - if (githubPrApiUrl != null) { - catchError(buildResult: 'SUCCESS', stageResult: 'UNSTABLE') { - error "Failed to get the changed-file list from both the GitHub API and internal Git mirror. " + - "Continuing with an empty list. Error: ${e.toString()}" - } - } else { - pipeline.echo("Get merge request changed file list failed. Error: ${e.toString()}") - } + pipeline.echo("Get merge request changed file list failed. Error: ${e.toString()}") globalVars[CACHED_CHANGED_FILE_LIST] = [] return globalVars[CACHED_CHANGED_FILE_LIST] } - def changedFileListStr = changedFileList.join(",\n") - pipeline.echo("The changeset of this MR is: ${changedFileListStr}.") - globalVars[CACHED_CHANGED_FILE_LIST] = changedFileList - return globalVars[CACHED_CHANGED_FILE_LIST] } def getMergeRequestOneFileChanges(pipeline, globalVars, filePath) { From 8c44750bb6f6696420198e6ef0150cd9cc1f6541 Mon Sep 17 00:00:00 2001 From: hanjingtian <312433810+hanjingtian@users.noreply.github.com> Date: Thu, 10 Sep 2026 12:02:40 +0800 Subject: [PATCH 7/7] [TRTLLMINF-346][fix] avoid sandboxed array helper in mirror diff Signed-off-by: hanjingtian <312433810+hanjingtian@users.noreply.github.com> --- jenkins/L0_MergeRequest.groovy | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/jenkins/L0_MergeRequest.groovy b/jenkins/L0_MergeRequest.groovy index 88b9b85ecf4c..6329397a58f3 100644 --- a/jenkins/L0_MergeRequest.groovy +++ b/jenkins/L0_MergeRequest.groovy @@ -796,7 +796,13 @@ def getGitMirrorMRChangedFile(pipeline, globalVars, function, filePath="", fileP ) def changedFiles = nameStatus.readLines().collect { line -> def fields = line.split('\t', -1) - [status: fields[0], paths: fields.drop(1).findAll { it }] + def paths = [] + for (int index = 1; index < fields.length; index++) { + if (fields[index]) { + paths.add(fields[index]) + } + } + [status: fields[0], paths: paths] } if (function == "getChangedFileList") { return changedFiles.collectMany { changedFile ->