jenkins: cleaned the artifact directory instead of tmp-out dir

cleaning the tmp-out dir if desired, which is needed when building
the dev image where the bootloader is archived first

Signed-off-by: Marc Mattmueller <marc.mattmueller@netmodule.com>
This commit is contained in:
Marc Mattmueller 2021-07-29 15:26:25 +02:00
parent daca933bfd
commit f08b93c154
2 changed files with 17 additions and 5 deletions

View File

@ -119,7 +119,7 @@ def archiveImages(imgageDir, imgType) {
dir ('tmp/artifacts') {
zip archive: true, dir: "${WORKSPACE}/${imgageDir}", glob: "*", zipFile: "${env.PACKAGE_NAME}-${env.BUILD_VERSION}-${params.MACHINE}-${imgType}.zip"
}
sh "rm -rf ${WORKSPACE}/tmp"
sh "rm -rf ${WORKSPACE}/tmp/artifacts"
}

View File

@ -81,17 +81,18 @@ pipeline {
// archive a bootloader package:
// the bootloader is also built with the dev image, hence we combine it
if((params.IMAGE_TYPE == 'bootloader') || (params.IMAGE_TYPE == 'dev')) {
def isBootLoaderOnly = (params.IMAGE_TYPE == 'bootloader').toBoolean()
if(isBootLoaderOnly || (params.IMAGE_TYPE == 'dev')) {
createBslPackage(env.IMG_OUTPUT_DIR)
yoctocommon.archiveImages(env.IMG_OUTPUT_DIR, 'bootloader')
archivePackage(yoctocommon, env.IMG_OUTPUT_DIR, 'bootloader', !isBootLoaderOnly)
}
// archive an image package:
// skip for bootloader only builds
if(params.IMAGE_TYPE != 'bootloader') {
if(!isBootLoaderOnly) {
createImagePackage(params.IMAGE_TYPE, env.IMG_OUTPUT_DIR)
archiveOSTreeArtifact(env.IMG_OUTPUT_DIR)
yoctocommon.archiveImages(env.IMG_OUTPUT_DIR, params.IMAGE_TYPE)
archivePackage(yoctocommon, env.IMG_OUTPUT_DIR, params.IMAGE_TYPE, false)
}
}
}
@ -144,6 +145,7 @@ def build(imgType) {
//-----------------------------------------------------------------------------
def createBslPackage(outputDir) {
dir(outputDir) {
println "get bootloader artifacts for package..."
sh "cp ${env.YOCTO_DEPLOYS}/*u-boot-${params.MACHINE}*.img . || true"
sh "cp ${env.YOCTO_DEPLOYS}/*u-boot-${params.MACHINE}*.xmodem.bin . || true"
sh "cp ${env.YOCTO_DEPLOYS}/imx-boot . || true"
@ -154,6 +156,7 @@ def createBslPackage(outputDir) {
//-----------------------------------------------------------------------------
def createImagePackage(imgType, outputDir) {
dir (outputDir) {
println "get image artifacts for package..."
def imgTypePostfix = "${imgType}" == "" ? "" : "-${imgType}"
def image_basename = "netmodule-linux-image${imgTypePostfix}-${params.MACHINE}"
def basename_built = "${env.YOCTO_DEPLOYS}/${image_basename}"
@ -179,6 +182,15 @@ def createImagePackage(imgType, outputDir) {
}
}
//-----------------------------------------------------------------------------
def archivePackage(yoctocommon, pkgDir, imgType, doCleanPkgDir) {
yoctocommon.archiveImages(pkgDir, imgType)
if(doCleanPkgDir) {
println "cleaning pkgDir..."
sh "rm -rf ./${pkgDir}/*"
}
}
//-----------------------------------------------------------------------------
def archiveOSTreeArtifact(outputDir) {
archiveArtifacts artifacts: "${outputDir}/ostree_repo*.tar.gz", onlyIfSuccessful: true