From 168fd620f23a3af4957d29cf633e72bb0ae1bf95 Mon Sep 17 00:00:00 2001 From: Yuanjing Xue <197832395+yuanjingx87@users.noreply.github.com> Date: Thu, 23 Oct 2025 18:30:10 -0700 Subject: [PATCH 1/4] Allow set repo url for generatelockfile pipeline Signed-off-by: Yuanjing Xue <197832395+yuanjingx87@users.noreply.github.com> --- jenkins/GenerateLock.groovy | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/jenkins/GenerateLock.groovy b/jenkins/GenerateLock.groovy index cc0d6f835f6..aea9e3d2091 100644 --- a/jenkins/GenerateLock.groovy +++ b/jenkins/GenerateLock.groovy @@ -43,7 +43,10 @@ def generate() sh "pwd && ls -alh" container("alpine") { - LLM_REPO = "https://github.com/NVIDIA/TensorRT-LLM.git" + LLM_REPO = params.repoUrl + if (LLM_REPO == "Custom Repo") { + LLM_REPO = params.customRepoUrl + } sh "apt update" sh "apt install -y python3-dev git curl git-lfs" sh "git config --global --add safe.directory ${env.WORKSPACE}" @@ -66,10 +69,10 @@ def generate() withCredentials([usernamePassword(credentialsId: 'github-cred-trtllm-ci', usernameVariable: 'GIT_USER', passwordVariable: 'GIT_PASS')]) { def authedUrl = LLM_REPO.replaceFirst('https://', "https://${GIT_USER}:${GIT_PASS}@") sh "git remote set-url origin ${authedUrl}" - sh "git fetch origin ${params.llmBranch}" + sh "git fetch origin ${params.branchName}" sh "git status" - sh "git rebase origin/${params.llmBranch}" - sh "git push origin HEAD:${params.llmBranch}" + sh "git rebase origin/${params.branchName}" + sh "git push origin HEAD:${params.branchName}" } } } @@ -81,7 +84,9 @@ pipeline { kubernetes createKubernetesPodConfig() } parameters { - string(name: 'llmBranch', defaultValue: 'main', description: 'the branch to generate the lock files') + string(name: 'branchName', defaultValue: 'main', description: 'the branch to generate the lock files') + choice(name: 'repoUrl', choices: ['https://github.com/NVIDIA/TensorRT-LLM.git','https://gitlab-master.nvidia.com/ftp/tekit.git', 'Custom Repo'], description: "The repo url to process, choose \"Custom repo\" if you want to set your own repo") + string(name: 'customRepoUrl', defaultValue: '', description: 'Your custom repo to get processed, need to select \"Custom repo\" for repoUrl, otherwise it will be ignored') } options { skipDefaultCheckout() From 78cb1f9cdaf7890739ef644efbc00ba0a1ed0ff4 Mon Sep 17 00:00:00 2001 From: Yuanjing Xue <197832395+yuanjingx87@users.noreply.github.com> Date: Tue, 28 Oct 2025 12:45:10 -0700 Subject: [PATCH 2/4] Skip codespell check for lockfile and pyproject.toml Signed-off-by: Yuanjing Xue <197832395+yuanjingx87@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 336df6e1b0d..908fc6bb8f6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -66,7 +66,7 @@ repos: additional_dependencies: - tomli # add ignore words list - args: ["-L", "Mor,ans,thirdparty", "--skip", "ATTRIBUTIONS-*.md"] + args: ["-L", "Mor,ans,thirdparty", "--skip", "ATTRIBUTIONS-*.md", "--skip", "security_scanning/*"] - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.9.4 hooks: From dd4c42766c55df85e7a4564d98ef5af74aed10d2 Mon Sep 17 00:00:00 2001 From: Yuanjing Xue <197832395+yuanjingx87@users.noreply.github.com> Date: Tue, 28 Oct 2025 12:45:51 -0700 Subject: [PATCH 3/4] minor fix Signed-off-by: Yuanjing Xue <197832395+yuanjingx87@users.noreply.github.com> --- jenkins/GenerateLock.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins/GenerateLock.groovy b/jenkins/GenerateLock.groovy index aea9e3d2091..704357f33e4 100644 --- a/jenkins/GenerateLock.groovy +++ b/jenkins/GenerateLock.groovy @@ -52,7 +52,7 @@ def generate() sh "git config --global --add safe.directory ${env.WORKSPACE}" sh "git config --global user.email \"90828364+tensorrt-cicd@users.noreply.github.com\"" sh "git config --global user.name \"TensorRT LLM\"" - trtllm_utils.checkoutSource(LLM_REPO, params.llmBranch, env.WORKSPACE, false, true) + trtllm_utils.checkoutSource(LLM_REPO, params.branchName, env.WORKSPACE, false, true) sh "python3 --version" sh "curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.8.5 python3 -" sh "cd ${env.WORKSPACE}" From 83167796ed233dfdc40776d12fb35b44b89c7fde Mon Sep 17 00:00:00 2001 From: Yuanjing Xue <197832395+yuanjingx87@users.noreply.github.com> Date: Tue, 28 Oct 2025 15:59:55 -0700 Subject: [PATCH 4/4] add logic to get the correct credential id Signed-off-by: Yuanjing Xue <197832395+yuanjingx87@users.noreply.github.com> --- jenkins/GenerateLock.groovy | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/jenkins/GenerateLock.groovy b/jenkins/GenerateLock.groovy index 704357f33e4..30c179e96a6 100644 --- a/jenkins/GenerateLock.groovy +++ b/jenkins/GenerateLock.groovy @@ -38,15 +38,29 @@ def createKubernetesPodConfig() return podConfig } +def getGitCredentialId (String repoUrl) { + if (repoUrl ==~ /https:\/\/github\.com\/[\w\-]+\/[\w\-\.]+(\.git)?/) { + return 'github-token-trtllm-ci' + } + if (repoUrl ==~ /https:\/\/gitlab\-master\.nvidia\.com\/[\w\-]+\/[\w\-\.]+(\.git)?/) { + return 'svc_tensorrt_gitlab_api_token' + } + return null +} + def generate() { sh "pwd && ls -alh" container("alpine") { - LLM_REPO = params.repoUrl + def LLM_REPO = params.repoUrl if (LLM_REPO == "Custom Repo") { LLM_REPO = params.customRepoUrl } + def CREDENTIAL_ID = getGitCredentialId(LLM_REPO) + if (CREDENTIAL_ID == null) { + throw new Exception("Failed to get access token for repository") + } sh "apt update" sh "apt install -y python3-dev git curl git-lfs" sh "git config --global --add safe.directory ${env.WORKSPACE}" @@ -66,7 +80,7 @@ def generate() sh "git status" sh "git add \$(find . -type f \\( -name 'poetry.lock' -o -name 'pyproject.toml' \\))" sh "git commit -s -m \"[None][infra] Check in most recent lock file from nightly pipeline\"" - withCredentials([usernamePassword(credentialsId: 'github-cred-trtllm-ci', usernameVariable: 'GIT_USER', passwordVariable: 'GIT_PASS')]) { + withCredentials([usernamePassword(credentialsId: CREDENTIAL_ID, usernameVariable: 'GIT_USER', passwordVariable: 'GIT_PASS')]) { def authedUrl = LLM_REPO.replaceFirst('https://', "https://${GIT_USER}:${GIT_PASS}@") sh "git remote set-url origin ${authedUrl}" sh "git fetch origin ${params.branchName}"