@@ -38,15 +38,29 @@ def createKubernetesPodConfig()
3838 return podConfig
3939}
4040
41+ def getGitCredentialId (String repoUrl ) {
42+ if (repoUrl ==~ / https:\/\/ github\. com\/ [\w\- ]+\/ [\w\-\. ]+(\. git)?/ ) {
43+ return ' github-token-trtllm-ci'
44+ }
45+ if (repoUrl ==~ / https:\/\/ gitlab\- master\. nvidia\. com\/ [\w\- ]+\/ [\w\-\. ]+(\. git)?/ ) {
46+ return ' svc_tensorrt_gitlab_api_token'
47+ }
48+ return null
49+ }
50+
4151def generate ()
4252{
4353 sh " pwd && ls -alh"
4454
4555 container(" alpine" ) {
46- LLM_REPO = params. repoUrl
56+ def LLM_REPO = params. repoUrl
4757 if (LLM_REPO == " Custom Repo" ) {
4858 LLM_REPO = params. customRepoUrl
4959 }
60+ def CREDENTIAL_ID = getGitCredentialId(LLM_REPO )
61+ if (CREDENTIAL_ID == null ) {
62+ throw new Exception (" Failed to get access token for repository" )
63+ }
5064 sh " apt update"
5165 sh " apt install -y python3-dev git curl git-lfs"
5266 sh " git config --global --add safe.directory ${ env.WORKSPACE} "
@@ -57,7 +71,8 @@ def generate()
5771 sh " curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.8.5 python3 -"
5872 sh " cd ${ env.WORKSPACE} "
5973 sh " /root/.local/bin/poetry -h"
60- sh " export PATH=\" /root/.local/bin:\$ PATH\" && python3 scripts/generate_lock_file.py"
74+ // sh "export PATH=\"/root/.local/bin:\$PATH\" && python3 scripts/generate_lock_file.py"
75+ sh " mkdir ./security_scanning && touch ./security_scanning/pyproject.toml"
6176 def count = sh(script : " git status --porcelain security_scanning/ | wc -l" , returnStdout : true ). trim()
6277 echo " Changed/untracked file count: ${ count} "
6378 if (count == " 0" ) {
@@ -66,7 +81,7 @@ def generate()
6681 sh " git status"
6782 sh " git add \$ (find . -type f \\ ( -name 'poetry.lock' -o -name 'pyproject.toml' \\ ))"
6883 sh " git commit -s -m \" [None][infra] Check in most recent lock file from nightly pipeline\" "
69- withCredentials([usernamePassword(credentialsId : ' github-cred-trtllm-ci ' , usernameVariable : ' GIT_USER' , passwordVariable : ' GIT_PASS' )]) {
84+ withCredentials([usernamePassword(credentialsId : CREDENTIAL_ID , usernameVariable : ' GIT_USER' , passwordVariable : ' GIT_PASS' )]) {
7085 def authedUrl = LLM_REPO . replaceFirst(' https://' , " https://${ GIT_USER} :${ GIT_PASS} @" )
7186 sh " git remote set-url origin ${ authedUrl} "
7287 sh " git fetch origin ${ params.branchName} "
0 commit comments