[None][infra] Add sonarqube scanning in lockfile generation pipeline (#10700)

Signed-off-by: Yuanjing Xue <197832395+yuanjingx87@users.noreply.github.com>
This commit is contained in:
yuanjingx87 2026-01-18 01:11:28 -08:00 committed by GitHub
parent a11f0dbd61
commit e1cc8d2337
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -38,31 +38,42 @@ def createKubernetesPodConfig()
return podConfig
}
def getLLMRepo () {
def LLM_REPO = "https://github.com/NVIDIA/TensorRT-LLM.git"
if (params.repoUrlKey == "tensorrt_llm_internal") {
withCredentials([string(credentialsId: 'default-llm-repo', variable: 'DEFAULT_LLM_REPO')]) {
LLM_REPO = DEFAULT_LLM_REPO
}
}
if (params.repoUrlKey == "custom_repo") {
if (params.customRepoUrl == "") {
throw new Exception("Invalid custom repo url provided")
}
LLM_REPO = params.customRepoUrl
}
return LLM_REPO
}
def checkoutSource ()
{
def LLM_REPO = getLLMRepo()
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.branchName, env.WORKSPACE, false, true)
}
def generate()
{
sh "pwd && ls -alh"
container("alpine") {
def LLM_REPO = "https://github.com/NVIDIA/TensorRT-LLM.git"
if (params.repoUrlKey == "tensorrt_llm_internal") {
withCredentials([string(credentialsId: 'default-llm-repo', variable: 'DEFAULT_LLM_REPO')]) {
LLM_REPO = DEFAULT_LLM_REPO
}
}
if (params.repoUrlKey == "custom_repo") {
if (params.customRepoUrl == "") {
throw new Exception("Invalid custom repo url provided")
}
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}"
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.branchName, env.WORKSPACE, false, true)
def LLM_REPO = getLLMRepo()
checkoutSource()
sh "python3 --version"
sh "curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.8.5 python3 -"
sh "curl -sSL https://install.python-poetry.org | python3 -"
sh "cd ${env.WORKSPACE}"
sh "/root/.local/bin/poetry -h"
sh "export PATH=\"/root/.local/bin:\$PATH\" && python3 scripts/generate_lock_file.py"
@ -72,6 +83,7 @@ def generate()
echo "No update that needs to be checked in"
} else {
sh "git status"
sh "git add -u security_scanning/"
sh "git add \$(find . -type f \\( -name 'poetry.lock' -o -name 'pyproject.toml' -o -name 'metadata.json' \\))"
sh "git commit -s -m \"[None][infra] Check in most recent lock file from nightly pipeline\""
withCredentials([
@ -98,6 +110,19 @@ def generate()
}
}
def sonar_scan()
{
container("alpine") {
def scannerHome = tool 'sonarScanner'
sh "apt update"
sh "apt install -y git git-lfs openjdk-17-jdk"
checkoutSource()
sh "cd ${env.WORKSPACE}"
withSonarQubeEnv() {
sh "${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=GPUSW_TensorRT-LLM-Team_TensorRT-LLM_tensorrt-llm -Dsonar.sources=. -Dsonar.branch.name=${params.branchName}"
}
}
}
pipeline {
agent {
@ -121,13 +146,26 @@ pipeline {
}
stages {
stage("Generating Poetry Locks"){
agent {
kubernetes createKubernetesPodConfig()
}
steps
{
generate()
stage('TRT-LLM PLC Jobs') {
parallel {
stage("Generating Poetry Locks"){
agent {
kubernetes createKubernetesPodConfig()
}
steps
{
generate()
}
}
stage("SonarQube Code Analysis"){
agent {
kubernetes createKubernetesPodConfig()
}
steps
{
sonar_scan()
}
}
}
}
} // stages