From 1eaef1287f79fceb5eb09d00f20487470b8c80fc Mon Sep 17 00:00:00 2001 From: Bharath Ramaswamy Date: Thu, 29 Aug 2024 02:20:46 -0700 Subject: [PATCH] Fixed incorrect workspace variable usage in Jenkinsfile parallel stages (missing thresholds file error) Signed-off-by: Bharath Ramaswamy --- Jenkins/Jenkinsfile | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/Jenkins/Jenkinsfile b/Jenkins/Jenkinsfile index a7bfd64f73a..03b1567f4b8 100755 --- a/Jenkins/Jenkinsfile +++ b/Jenkins/Jenkinsfile @@ -20,13 +20,11 @@ pipeline { PROJECT_ROOT = "${workspace}/${REPO_NAME}" PROJECT_NAME = "${params.PROJECT_NAME}" PROJECT_BRANCH = "${params.PROJECT_BRANCH}" - WORKSPACE_ROOT = "${workspace}" - XUNIT_XSL_FILE = "${PROJECT_ROOT}/Jenkins/to-junit.xsl" } stages { stage('Setup') { steps { - echo "*** Running SETUP stage on ${env.NODE_NAME} in workspace ${env.WORKSPACE_ROOT} ***" + echo "*** Running SETUP stage on ${env.NODE_NAME} in workspace ${env.WORKSPACE} ***" sh 'bash -l -c "rm -rf ${PROJECT_ROOT} | true"' sh 'bash -l -c "mkdir ${PROJECT_ROOT}"' // moving all files and folders except current and parent into ${REPO_NAME} folder @@ -57,7 +55,7 @@ pipeline { script{ env.AIMET_VARIANT_TF_GPU = "tf-gpu" } - echo "*** Running SETUP stage for ${env.AIMET_VARIANT_TF_GPU} variant on ${env.NODE_NAME} in workspace ${env.WORKSPACE_ROOT} ***" + echo "*** Running SETUP stage for ${env.AIMET_VARIANT_TF_GPU} variant on ${env.NODE_NAME} in workspace ${env.WORKSPACE} ***" } } @@ -148,7 +146,7 @@ pipeline { failureThreshold: THRESHOLD_OBJ.unittests_thresholds.failed_thresholds.total_tests, unstableNewThreshold: THRESHOLD_OBJ.unittests_thresholds.skipped_thresholds.new_tests, unstableThreshold: THRESHOLD_OBJ.unittests_thresholds.skipped_thresholds.total_tests)], - tools: [Custom(customXSL: "${XUNIT_XSL_FILE}", + tools: [Custom(customXSL: "${env.WORKSPACE}/${params.PROJECT_ROOT}/Jenkins/to-junit.xsl", deleteOutputFiles: false, excludesPattern: '', pattern: "**/unit_test_results/**/*.xml", @@ -185,7 +183,7 @@ pipeline { script{ env.AIMET_VARIANT_TORCH_GPU = "torch-gpu" } - echo "*** Running SETUP stage for ${env.AIMET_VARIANT_TORCH_GPU} variant on ${env.NODE_NAME} in workspace ${env.WORKSPACE_ROOT} ***" + echo "*** Running SETUP stage for ${env.AIMET_VARIANT_TORCH_GPU} variant on ${env.NODE_NAME} in workspace ${env.WORKSPACE} ***" } } @@ -250,7 +248,7 @@ pipeline { failureThreshold: THRESHOLD_OBJ.unittests_thresholds.failed_thresholds.total_tests, unstableNewThreshold: THRESHOLD_OBJ.unittests_thresholds.skipped_thresholds.new_tests, unstableThreshold: THRESHOLD_OBJ.unittests_thresholds.skipped_thresholds.total_tests)], - tools: [Custom(customXSL: "${XUNIT_XSL_FILE}", + tools: [Custom(customXSL: "${env.WORKSPACE}/${params.PROJECT_ROOT}/Jenkins/to-junit.xsl", deleteOutputFiles: false, excludesPattern: '', pattern: "**/unit_test_results/**/*.xml", @@ -286,7 +284,7 @@ pipeline { script{ env.AIMET_VARIANT_ONNX_GPU = "onnx-gpu" } - echo "*** Running SETUP stage for ${env.AIMET_VARIANT_ONNX_GPU} variant on ${env.NODE_NAME} in workspace ${env.WORKSPACE_ROOT} ***" + echo "*** Running SETUP stage for ${env.AIMET_VARIANT_ONNX_GPU} variant on ${env.NODE_NAME} in workspace ${env.WORKSPACE} ***" } } @@ -351,7 +349,7 @@ pipeline { failureThreshold: THRESHOLD_OBJ.unittests_thresholds.failed_thresholds.total_tests, unstableNewThreshold: THRESHOLD_OBJ.unittests_thresholds.skipped_thresholds.new_tests, unstableThreshold: THRESHOLD_OBJ.unittests_thresholds.skipped_thresholds.total_tests)], - tools: [Custom(customXSL: "${XUNIT_XSL_FILE}", + tools: [Custom(customXSL: "${env.WORKSPACE}/${params.PROJECT_ROOT}/Jenkins/to-junit.xsl", deleteOutputFiles: false, excludesPattern: '', pattern: "**/unit_test_results/**/*.xml", @@ -387,7 +385,7 @@ pipeline { script { env.AIMET_VARIANT_ONNX_CPU = "onnx-cpu" } - echo "*** Running SETUP stage for ${env.AIMET_VARIANT_ONNX_CPU} variant on ${env.NODE_NAME} in workspace ${env.WORKSPACE_ROOT} ***" + echo "*** Running SETUP stage for ${env.AIMET_VARIANT_ONNX_CPU} variant on ${env.NODE_NAME} in workspace ${env.WORKSPACE} ***" } } @@ -452,7 +450,7 @@ pipeline { failureThreshold: THRESHOLD_OBJ.unittests_thresholds.failed_thresholds.total_tests, unstableNewThreshold: THRESHOLD_OBJ.unittests_thresholds.skipped_thresholds.new_tests, unstableThreshold: THRESHOLD_OBJ.unittests_thresholds.skipped_thresholds.total_tests)], - tools: [Custom(customXSL: "${XUNIT_XSL_FILE}", + tools: [Custom(customXSL: "${env.WORKSPACE}/${params.PROJECT_ROOT}/Jenkins/to-junit.xsl", deleteOutputFiles: false, excludesPattern: '', pattern: "**/unit_test_results/**/*.xml", @@ -488,7 +486,7 @@ pipeline { script { env.AIMET_VARIANT_TF_CPU = "tf-cpu" } - echo "*** Running SETUP stage for ${env.AIMET_VARIANT_TF_CPU} variant on ${env.NODE_NAME} in workspace ${env.WORKSPACE_ROOT} ***" + echo "*** Running SETUP stage for ${env.AIMET_VARIANT_TF_CPU} variant on ${env.NODE_NAME} in workspace ${env.WORKSPACE} ***" } } @@ -553,7 +551,7 @@ pipeline { failureThreshold: THRESHOLD_OBJ.unittests_thresholds.failed_thresholds.total_tests, unstableNewThreshold: THRESHOLD_OBJ.unittests_thresholds.skipped_thresholds.new_tests, unstableThreshold: THRESHOLD_OBJ.unittests_thresholds.skipped_thresholds.total_tests)], - tools: [Custom(customXSL: "${XUNIT_XSL_FILE}", + tools: [Custom(customXSL: "${env.WORKSPACE}/${params.PROJECT_ROOT}/Jenkins/to-junit.xsl", deleteOutputFiles: false, excludesPattern: '', pattern: "**/unit_test_results/**/*.xml", @@ -590,7 +588,7 @@ pipeline { script { env.AIMET_VARIANT_TORCH_CPU = "torch-cpu" } - echo "*** Running SETUP stage for ${env.AIMET_VARIANT_TORCH_CPU} variant on ${env.NODE_NAME} in workspace ${env.WORKSPACE_ROOT} ***" + echo "*** Running SETUP stage for ${env.AIMET_VARIANT_TORCH_CPU} variant on ${env.NODE_NAME} in workspace ${env.WORKSPACE} ***" } } @@ -654,7 +652,7 @@ pipeline { failureThreshold: THRESHOLD_OBJ.unittests_thresholds.failed_thresholds.total_tests, unstableNewThreshold: THRESHOLD_OBJ.unittests_thresholds.skipped_thresholds.new_tests, unstableThreshold: THRESHOLD_OBJ.unittests_thresholds.skipped_thresholds.total_tests)], - tools: [Custom(customXSL: "${XUNIT_XSL_FILE}", + tools: [Custom(customXSL: "${env.WORKSPACE}/${params.PROJECT_ROOT}/Jenkins/to-junit.xsl", deleteOutputFiles: false, excludesPattern: '', pattern: "**/unit_test_results/**/*.xml", @@ -732,7 +730,7 @@ pipeline { stages { stage('Get Docker Image') { steps { - echo "*** Running Docker stage for ${AIMET_VARIANT} variant on ${env.NODE_NAME} in workspace ${env.WORKSPACE_ROOT} ***" + echo "*** Running Docker stage for ${AIMET_VARIANT} variant on ${env.NODE_NAME} in workspace ${env.WORKSPACE} ***" script { if (env.AIMET_PREBUILT_DOCKER_IMAGE_URL && ! pullRequest.files.any { f -> f.getFilename().contains('Dockerfile') }) { DOCKER_IMAGE_FULL_URL = "${env.AIMET_PREBUILT_DOCKER_IMAGE_URL}/${env.DOCKER_IMAGE}" @@ -752,7 +750,7 @@ pipeline { stage('Test onnxruntime') { when { expression { AIMET_VARIANT =~ 'torch' } } steps { - echo "*** Running onnxruntime test stage for ${AIMET_VARIANT} variant on ${env.NODE_NAME} in workspace ${env.WORKSPACE_ROOT} ***" + echo "*** Running onnxruntime test stage for ${AIMET_VARIANT} variant on ${env.NODE_NAME} in workspace ${env.WORKSPACE} ***" script { def onnxruntime_version = sh(returnStdout: true, script: "${env.DOCKER_CMD} find /opt /usr -path '*onnxruntime*' -name VERSION_NUMBER -exec cat {} \\;").trim() def onnxruntime_headers_version = sh(returnStdout: true, script: "${env.DOCKER_CMD} python3 -c 'import onnxruntime; print(onnxruntime.__version__)'").trim() @@ -764,7 +762,7 @@ pipeline { //TODO Skip this stage for now until we fix some sporadic failures with "Install AIMET" stage when { equals expected: true, actual: 'Install AIMET' } steps { - echo "*** Running AIMET Editable Mode Install stage for ${AIMET_VARIANT} variant on ${env.NODE_NAME} in workspace ${env.WORKSPACE_ROOT} ***" + echo "*** Running AIMET Editable Mode Install stage for ${AIMET_VARIANT} variant on ${env.NODE_NAME} in workspace ${env.WORKSPACE} ***" script { def docker_script = 'python3 -m venv --system-site-packages --clear $PWD/venv ' + '&& source $PWD/venv/bin/activate ' + @@ -782,7 +780,7 @@ pipeline { //TODO Skip this stage for now until we fix some sporadic failures with "Install AIMET" stage when { equals expected: true, actual: 'Check Installation' } steps { - echo "*** Running AIMET Editable Mode Installation Check stage for ${AIMET_VARIANT} variant on ${env.NODE_NAME} in workspace ${env.WORKSPACE_ROOT} ***" + echo "*** Running AIMET Editable Mode Installation Check stage for ${AIMET_VARIANT} variant on ${env.NODE_NAME} in workspace ${env.WORKSPACE} ***" script { def docker_script = 'source $PWD/venv/bin/activate ' + '&& (python3 -m pip show AimetCommon) ' + @@ -796,7 +794,7 @@ pipeline { //TODO Skip this stage for now until we fix some sporadic failures with "Install AIMET" stage when { equals expected: true, actual: 'Unit Tests' } steps { - echo "*** Running AIMET Editable Mode Unit Test stage for ${AIMET_VARIANT} variant on ${env.NODE_NAME} in workspace ${env.WORKSPACE_ROOT} ***" + echo "*** Running AIMET Editable Mode Unit Test stage for ${AIMET_VARIANT} variant on ${env.NODE_NAME} in workspace ${env.WORKSPACE} ***" script { def docker_script = 'TORCH_HOME=build-$AIMET_VARIANT/torch_cache cmake --build ./build-$AIMET_VARIANT --target test' echo 'WARNING: Skipping unit test stage in Editable mode temporarily' @@ -843,7 +841,7 @@ def didDockerFileChange(aimet_variant) { def runStage(aimet_variant, options) { - echo "*** Running stage ${options} for ${aimet_variant} variant on ${env.NODE_NAME} in workspace ${env.WORKSPACE_ROOT} ***" + echo "*** Running stage ${options} for ${aimet_variant} variant on ${env.NODE_NAME} in workspace ${env.WORKSPACE} ***" using_linaro=env.USE_LINARO if (aimet_variant == "default") { sh """