Skip to content

Commit 0a4c591

Browse files
authored
[None][infra] Fixing credential loading in lockfile generation pipeline (#10020)
Signed-off-by: Yuanjing Xue <197832395+yuanjingx87@users.noreply.github.com>
1 parent 28b02b4 commit 0a4c591

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

jenkins/GenerateLock.groovy

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,6 @@ def createKubernetesPodConfig()
3838
return podConfig
3939
}
4040

41-
def getGitCredentialId (String repoUrlKey) {
42-
if (repoUrlKey == "tensorrt_llm_internal") {
43-
return 'svc_tensorrt_gitlab_api_token_no_username_as_string'
44-
} else {
45-
return 'github-cred-trtllm-ci'
46-
}
47-
}
48-
4941
def generate()
5042
{
5143
sh "pwd && ls -alh"
@@ -63,7 +55,6 @@ def generate()
6355
}
6456
LLM_REPO = params.customRepoUrl
6557
}
66-
def CREDENTIAL_ID = getGitCredentialId(params.repoUrlKey)
6758
sh "apt update"
6859
sh "apt install -y python3-dev git curl git-lfs"
6960
sh "git config --global --add safe.directory ${env.WORKSPACE}"
@@ -83,8 +74,20 @@ def generate()
8374
sh "git status"
8475
sh "git add \$(find . -type f \\( -name 'poetry.lock' -o -name 'pyproject.toml' -o -name 'metadata.json' \\))"
8576
sh "git commit -s -m \"[None][infra] Check in most recent lock file from nightly pipeline\""
86-
withCredentials([string(credentialsId: CREDENTIAL_ID, variable: 'API_TOKEN')]) {
87-
def authedUrl = LLM_REPO.replaceFirst('https://', "https://svc_tensorrt:${API_TOKEN}@")
77+
withCredentials([
78+
string(credentialsId: 'svc_tensorrt_gitlab_api_token_no_username_as_string', variable: 'GITLAB_API_TOKEN'),
79+
usernamePassword(
80+
credentialsId: 'github-cred-trtllm-ci',
81+
usernameVariable: 'NOT_IN_USE',
82+
passwordVariable: 'GITHUB_API_TOKEN'
83+
)
84+
]) {
85+
def authedUrl
86+
if (params.repoUrlKey == "tensorrt_llm_internal") {
87+
authedUrl = LLM_REPO.replaceFirst('https://', "https://svc_tensorrt:${GITLAB_API_TOKEN}@")
88+
} else {
89+
authedUrl = LLM_REPO.replaceFirst('https://', "https://svc_tensorrt:${GITHUB_API_TOKEN}@")
90+
}
8891
sh "git remote set-url origin ${authedUrl}"
8992
sh "git fetch origin ${params.branchName}"
9093
sh "git status"

0 commit comments

Comments
 (0)