From f38fb14b54a5a9753de8cccb1ca4fdb75ae5405c Mon Sep 17 00:00:00 2001 From: Scott Fryer Date: Mon, 8 Apr 2024 09:39:32 +0100 Subject: [PATCH] Rationalise riscv upload function --- linux/Jenkinsfile | 70 ++++++++++++++++++----------------------------- 1 file changed, 26 insertions(+), 44 deletions(-) diff --git a/linux/Jenkinsfile b/linux/Jenkinsfile index 0c31c8e4a..60d5943a2 100644 --- a/linux/Jenkinsfile +++ b/linux/Jenkinsfile @@ -180,40 +180,18 @@ def CheckAndUpload(String Target, String Distro, String BuildArch, String Versio jf 'rt u **/build/ospackage/temurin-*${BUILDARCH}.deb deb/pool/main/t/temurin-${VERSION}/ --target-props=${DISTROLIST}deb.component=main;deb.architecture=${BUILDARCH} --flat=true' } if (BuildArch == "riscv64") { - // RISC Use RT upload - node("dockerBuild&&linux&&x64") { - tool name: 'jfrog-cli', type: 'jfrog' - def copiedFiles = copyArtifacts(filter: '**/build/ospackage/*,**/build/reports/**,**/packageTest/dependencies/deb/*', projectName: env.JOB_NAME, selector: specific(env.BUILD_NUMBER)) - jf 'rt u **/build/ospackage/temurin-*${BUILDARCH}.deb deb/pool/main/t/temurin-${VERSION}/ --target-props=${DISTROLIST}deb.component=main;deb.architecture=${BUILDARCH} --flat=true' - // Remove copied artifacts - for (copiedFile in copiedFiles) { - fileToDelete = copiedFile.filePath - echo "Deleting file: ${fileToDelete}" - deleteDir(path: fileToDelete) - } - } - } - break + handleRISCUpload() + } + break case "Alpine": jf 'rt u **/build/ospackage/${FILENAME} apk/alpine/main/${BUILDARCH}/ --flat=true' break case "RPMS": - if (BuildArch != "riscv64") { - jf 'rt u **/build/ospackage/*.${VALUE}.rpm ${PACKAGEDIR}/${KEY}/Packages/ --flat=true' - } - if (BuildArch == "riscv64") { - // RISC Use RT upload - node("dockerBuild&&linux&&x64") { - tool name: 'jfrog-cli', type: 'jfrog' - def copiedFiles = copyArtifacts(filter: '**/build/ospackage/*,**/build/reports/**,**/packageTest/dependencies/deb/*', projectName: env.JOB_NAME, selector: specific(env.BUILD_NUMBER)) - jf 'rt u **/build/ospackage/*.${VALUE}.rpm ${PACKAGEDIR}/${KEY}/Packages/ --flat=true' - // Remove copied artifacts - for (copiedFile in copiedFiles) { - fileToDelete = copiedFile.filePath - echo "Deleting file: ${fileToDelete}" - deleteDir(path: fileToDelete) - } - } + if (BuildArch != "riscv64") { + jf 'rt u **/build/ospackage/*.${VALUE}.rpm ${PACKAGEDIR}/${KEY}/Packages/ --flat=true' + } + if (BuildArch == "riscv64") { + handleRISCUpload() } break default: @@ -222,20 +200,9 @@ def CheckAndUpload(String Target, String Distro, String BuildArch, String Versio jf 'rt u **/build/ospackage/*.${VALUE}.rpm ${PACKAGEDIR}/${KEY}/Packages/ --flat=true' } if (BuildArch == "riscv64") { - // RISC Use RT upload - node("dockerBuild&&linux&&x64") { - tool name: 'jfrog-cli', type: 'jfrog' - def copiedFiles = copyArtifacts(filter: '**/build/ospackage/*,**/build/reports/**,**/packageTest/dependencies/deb/*', projectName: env.JOB_NAME, selector: specific(env.BUILD_NUMBER)) - jf 'rt u **/build/ospackage/*.${VALUE}.rpm ${PACKAGEDIR}/${KEY}/Packages/ --flat=true' - // Remove copied artifacts - for (copiedFile in copiedFiles) { - fileToDelete = copiedFile.filePath - echo "Deleting file: ${fileToDelete}" - deleteDir(path: fileToDelete) - } - } - } - break + handleRISCUpload() + } + break } } } catch (Exception e) { @@ -243,6 +210,21 @@ def CheckAndUpload(String Target, String Distro, String BuildArch, String Versio } } +// Riscv Upload Function +def handleRISCUpload() { + node("dockerBuild&&linux&&x64") { + tool name: 'jfrog-cli', type: 'jfrog' + def copiedFiles = copyArtifacts(filter: '**/build/ospackage/*,**/build/reports/**,**/packageTest/dependencies/deb/*', projectName: env.JOB_NAME, selector: specific(env.BUILD_NUMBER)) + jf 'rt u **/build/ospackage/*.${VALUE}.rpm ${PACKAGEDIR}/${KEY}/Packages/ --flat=true' + // Remove copied artifacts + for (copiedFile in copiedFiles) { + fileToDelete = copiedFile.filePath + echo "Deleting file: ${fileToDelete}" + deleteDir(path: fileToDelete) + } + } +} + // function only handle debian as DISTRO def jenkinsStepDeb() { def temurinVersion = "${TYPE.toLowerCase()} ${VERSION} - ${ARCH}"