@@ -258,7 +258,7 @@ def buildImage(config, imageKeyToTag)
258258 // Step 2: Build the images
259259 stage (" Install packages" ) {
260260 sh " pwd && ls -alh"
261- sh " env"
261+ sh " env | sort "
262262 sh " apk add make git"
263263 sh " git config --global --add safe.directory '*'"
264264
@@ -281,23 +281,31 @@ def buildImage(config, imageKeyToTag)
281281 try {
282282 def build_jobs = BUILD_JOBS
283283 // Fix the triton image pull timeout issue
284- def TRITON_IMAGE = sh(script : " cd ${ LLM_ROOT} && grep 'ARG TRITON_IMAGE=' docker/Dockerfile.multi | grep -o '=.*' | tr -d '=\" '" , returnStdout : true ). trim()
285- def TRITON_BASE_TAG = sh(script : " cd ${ LLM_ROOT} && grep 'ARG TRITON_BASE_TAG=' docker/Dockerfile.multi | grep -o '=.*' | tr -d '=\" '" , returnStdout : true ). trim()
284+ def BASE_IMAGE = sh(script : " cd ${ LLM_ROOT} && grep '^ARG BASE_IMAGE=' docker/Dockerfile.multi | grep -o '=.*' | tr -d '=\" '" , returnStdout : true ). trim()
285+ def TRITON_IMAGE = sh(script : " cd ${ LLM_ROOT} && grep '^ARG TRITON_IMAGE=' docker/Dockerfile.multi | grep -o '=.*' | tr -d '=\" '" , returnStdout : true ). trim()
286+ def TRITON_BASE_TAG = sh(script : " cd ${ LLM_ROOT} && grep '^ARG TRITON_BASE_TAG=' docker/Dockerfile.multi | grep -o '=.*' | tr -d '=\" '" , returnStdout : true ). trim()
287+
288+ if (target == " rockylinux8" ) {
289+ BASE_IMAGE = sh(script : " cd ${ LLM_ROOT} && grep '^jenkins-rockylinux8_%: BASE_IMAGE =' docker/Makefile | grep -o '=.*' | tr -d '=\" '" , returnStdout : true ). trim()
290+ }
291+
292+ // Replace the base image and triton image with the internal mirror
293+ BASE_IMAGE = BASE_IMAGE . replace(" nvcr.io/" , " urm.nvidia.com/docker/" )
294+ TRITON_IMAGE = TRITON_IMAGE . replace(" nvcr.io/" , " urm.nvidia.com/docker/" )
286295
287296 if (dependent) {
288297 stage (" make ${ dependent.target} _${ action} (${ arch} )" ) {
289- retry(3 ) {
290- sh " docker pull ${ TRITON_IMAGE} :${ TRITON_BASE_TAG} "
291- }
292- retry(3 ) {
293- sh """
294- cd ${ LLM_ROOT} && make -C docker ${ dependent.target} _${ action} \
295- TORCH_INSTALL_TYPE=${ torchInstallType} \
296- IMAGE_WITH_TAG=${ dependentImageWithTag} \
297- STAGE=${ dependent.dockerfileStage} \
298- BUILD_WHEEL_OPTS='-j ${ build_jobs} ' ${ args}
299- """
300- }
298+ def randomSleep = (Math . random() * 300 + 300 ). toInteger()
299+ trtllm_utils. llmExecStepWithRetry(this , script : " docker pull ${ TRITON_IMAGE} :${ TRITON_BASE_TAG} " , sleepInSecs : randomSleep, shortCommondRunTimeMax : 7200 )
300+ trtllm_utils. llmExecStepWithRetry(this , script : """
301+ cd ${ LLM_ROOT} && make -C docker ${ dependent.target} _${ action} \
302+ BASE_IMAGE=${ BASE_IMAGE} \
303+ TRITON_IMAGE=${ TRITON_IMAGE} \
304+ TORCH_INSTALL_TYPE=${ torchInstallType} \
305+ IMAGE_WITH_TAG=${ dependentImageWithTag} \
306+ STAGE=${ dependent.dockerfileStage} \
307+ BUILD_WHEEL_OPTS='-j ${ build_jobs} ' ${ args}
308+ """ , sleepInSecs : randomSleep, numRetries : 3 , shortCommondRunTimeMax : 7200 )
301309 args + = " DEVEL_IMAGE=${ dependentImageWithTag} "
302310 if (target == " ngc-release" ) {
303311 imageKeyToTag[" NGC Devel Image ${ config.arch} " ] = dependentImageWithTag
@@ -315,18 +323,18 @@ def buildImage(config, imageKeyToTag)
315323 }
316324 }
317325 stage (" make ${ target} _${ action} (${ arch} )" ) {
318- retry( 3 ) {
319- sh " docker pull ${ TRITON_IMAGE } : ${ TRITON_BASE_TAG } "
320- }
321- retry( 3 ) {
322- sh """
323- cd ${ LLM_ROOT } && make -C docker ${ target } _ ${ action } \
324- TORCH_INSTALL_TYPE =${ torchInstallType } \
325- IMAGE_WITH_TAG =${ imageWithTag } \
326- STAGE =${ dockerfileStage } \
327- BUILD_WHEEL_OPTS='-j ${ build_jobs } ' ${ args }
328- """
329- }
326+ sh " env | sort "
327+ def randomSleep = ( Math . random() * 300 + 300 ) . toInteger()
328+ trtllm_utils . llmExecStepWithRetry( this , script : " docker pull ${ TRITON_IMAGE } : ${ TRITON_BASE_TAG } " , sleepInSecs : randomSleep, shortCommondRunTimeMax : 7200 )
329+ trtllm_utils . llmExecStepWithRetry( this , script : """
330+ cd ${ LLM_ROOT } && make -C docker ${ target } _ ${ action } \
331+ BASE_IMAGE= ${ BASE_IMAGE } \
332+ TRITON_IMAGE =${ TRITON_IMAGE } \
333+ TORCH_INSTALL_TYPE =${ torchInstallType } \
334+ IMAGE_WITH_TAG =${ imageWithTag } \
335+ STAGE= ${ dockerfileStage } \
336+ BUILD_WHEEL_OPTS='-j ${ build_jobs } ' ${ args }
337+ """ , sleepInSecs : randomSleep, numRetries : 3 , shortCommondRunTimeMax : 7200 )
330338 if (target == " ngc-release" ) {
331339 imageKeyToTag[" NGC Release Image ${ config.arch} " ] = imageWithTag
332340 }
@@ -336,6 +344,8 @@ def buildImage(config, imageKeyToTag)
336344 stage (" custom tag: ${ customTag} (${ arch} )" ) {
337345 sh """
338346 cd ${ LLM_ROOT} && make -C docker ${ target} _${ action} \
347+ BASE_IMAGE=${ BASE_IMAGE} \
348+ TRITON_IMAGE=${ TRITON_IMAGE} \
339349 TORCH_INSTALL_TYPE=${ torchInstallType} \
340350 IMAGE_WITH_TAG=${ customImageWithTag} \
341351 STAGE=${ dockerfileStage} \
0 commit comments