jenkins: harmonized parameter references renamed MACHINE_TYPE to MACHINE

Signed-off-by: Marc Mattmueller <marc.mattmueller@netmodule.com>
This commit is contained in:
Marc Mattmueller 2021-04-29 08:53:24 +02:00
parent bf0c96713a
commit 669ba32c6a
1 changed files with 20 additions and 23 deletions

43
Jenkinsfile vendored
View File

@ -7,7 +7,7 @@ pipeline {
}
parameters {
choice(name: 'MACHINE_TYPE', choices: ['select...', 'am335x-nrhw20', 'am335x-nmhw21', 'imx8-nmhw23', 'am335x-nmhw24', 'am335x-hw25', 'am335x-hw26'], description: 'choose target platform')
choice(name: 'MACHINE', choices: ['select...', 'am335x-nrhw20', 'am335x-nmhw21', 'imx8-nmhw23', 'am335x-nmhw24', 'am335x-hw25', 'am335x-hw26'], description: 'choose target platform')
choice(name: 'IMAGE_TYPE', choices: ['bootloader', 'release', 'dev', 'vcu', 'lava', 'fct', 'minimal', 'sdk'], description: 'choose target platform')
string(name: 'RLS_VERSION', defaultValue: '', description: 'Set the version to build and use committed submodules')
booleanParam(name: 'COLLECT_REV', defaultValue: false, description: 'collect the used revisions')
@ -17,10 +17,8 @@ pipeline {
environment {
PACKAGE_NAME = 'nm-os'
MACHINE = "${MACHINE_TYPE}"
SHARED_BUILD = "${WORKSPACE}/build"
build_deploy = "${SHARED_BUILD}/tmp/deploy/images/${MACHINE}"
build_deploy = "${SHARED_BUILD}/tmp/deploy/images/${params.MACHINE}"
build_licenses = "${SHARED_BUILD}/tmp/deploy/licenses"
buildhistory = "${SHARED_BUILD}/buildhistory"
@ -46,28 +44,27 @@ pipeline {
stage('prepare') {
steps {
script {
if("${params.MACHINE_TYPE}" == "select...") {
error("Missing machine type --> select parameter MACHINE_TYPE for a proper build")
if("${params.MACHINE}" == "select...") {
error("Missing machine type --> select parameter MACHINE for a proper build")
}
handleSubmodules("${params.RLS_VERSION}")
version = buildVersion("${params.RLS_VERSION}")
env.BUILD_VERSION = "${version}"
currentBuild.displayName = "${version}-${params.MACHINE}-${params.IMAGE_TYPE}" //replace Bitbake timestamp after building
println "----------------------------------\n\
Job Parameters:\n\
----------------------------------\n\
MACHINE_TYPE = ${params.MACHINE_TYPE}\n\
MACHINE = ${params.MACHINE}\n\
IMAGE_TYPE = ${params.IMAGE_TYPE}\n\
CLEAN_BUILD = ${params.CLEAN_BUILD}\n\
COLLECT_REV = ${params.COLLECT_REV}\n\
RLS_VERSION = ${params.RLS_VERSION}\n\
--> version = ${version}\n\
----------------------------------\n"
env.BUILD_VERSION = "${version}"
currentBuild.displayName = "${version}-${MACHINE}-${IMAGE_TYPE}" //replace Bitbake timestamp after building
changeDistroVersion("${version}")
}
writeFile file: 'VERSION', text: "${PACKAGE_NAME}: ${BUILD_VERSION}"
writeFile file: 'VERSION', text: "${env.PACKAGE_NAME}: ${env.BUILD_VERSION}"
}
}
@ -100,7 +97,7 @@ pipeline {
buildAndArchive()
}
dir ('tmp/artifacts') {
zip archive: true, dir: "${WORKSPACE}/tmp/build-output", glob: "*", zipFile: "${PACKAGE_NAME}-${BUILD_VERSION}-${machine}-${IMAGE_TYPE}.zip"
zip archive: true, dir: "${WORKSPACE}/tmp/build-output", glob: "*", zipFile: "${env.PACKAGE_NAME}-${env.BUILD_VERSION}-${params.MACHINE}-${params.IMAGE_TYPE}.zip"
}
sh "rm -rf ${WORKSPACE}/tmp"
}
@ -169,13 +166,13 @@ def cleanupDistroVersion() {
def buildAndArchive() {
if (params.IMAGE_TYPE == 'sdk') {
sh "bash -c '. ./env.image-ostree && bitbake -k netmodule-linux-image -c populate_sdk'"
zip archive: true, dir: "${HOME}/yocto-share/build/tmp/deploy/sdk", glob: '*.sh', zipFile: "${PACKAGE_NAME}-${BUILD_VERSION}-${MACHINE}-sdk.zip"
zip archive: true, dir: "${HOME}/yocto-share/build/tmp/deploy/sdk", glob: '*.sh', zipFile: "${env.PACKAGE_NAME}-${env.BUILD_VERSION}-${params.MACHINE}-sdk.zip"
}
else if (params.IMAGE_TYPE == 'bootloader') {
sh "bash -c '. ./env.common && bitbake virtual/bootloader'"
dir ('tmp/build-output') {
sh 'cp ${build_deploy}/*u-boot-${MACHINE_TYPE}*.img . || true'
sh 'cp ${build_deploy}/*u-boot-${MACHINE_TYPE}*.xmodem.bin . || true'
sh 'cp ${build_deploy}/*u-boot-${params.MACHINE}*.img . || true'
sh 'cp ${build_deploy}/*u-boot-${params.MACHINE}*.xmodem.bin . || true'
sh 'cp ${build_deploy}/imx-boot . || true'
sh 'cp ${build_deploy}/imx-boot.sd . || true'
}
@ -216,12 +213,12 @@ def build(env_in, image_type_in, single_fitImage) {
def archive(image_type_in, single_fitImage) {
def image_type = "${image_type_in}" == "" ? "" : "-${image_type_in}"
dir ("tmp/build-output") {
def image_basename = "netmodule-linux-image${image_type}-${MACHINE}"
def image_basename = "netmodule-linux-image${image_type}-${params.MACHINE}"
def basename_in = "${build_deploy}/${image_basename}"
def basename_out = "./image${image_type}-${MACHINE}"
def basename_out = "./image${image_type}-${params.MACHINE}"
sh "cp ${basename_in}.manifest ${basename_out}.manifest"
sh "bash -c '${WORKSPACE}/openembedded-core/scripts/buildhistory-collect-srcrevs -p ${buildhistory} > srcrev-${MACHINE}${image_type}.inc'"
sh "bash -c '${WORKSPACE}/openembedded-core/scripts/buildhistory-collect-srcrevs -p ${buildhistory} > srcrev-${params.MACHINE}${image_type}.inc'"
sh label: 'Copy License Manifest', returnStatus: true, script: """
LATEST_LICENSE_DIR=\$(ls -Artd ${build_licenses}/netmodule-linux-image${image_type}* | tail -n 1)
@ -229,21 +226,21 @@ def archive(image_type_in, single_fitImage) {
if (single_fitImage == false) {
sh label: 'Copy initramfs License Manifest', returnStatus: true, script: """
LATEST_LICENSE_DIR=\$(ls -Artd ${build_licenses}/initramfs-ostree-image-${MACHINE}-* | tail -n 1)
LATEST_LICENSE_DIR=\$(ls -Artd ${build_licenses}/initramfs-ostree-image-${params.MACHINE}-* | tail -n 1)
cp \$LATEST_LICENSE_DIR/license.manifest initramfs-ostree-image_license.manifest
"""
}
if(single_fitImage){
if(image_type_in == "minimal")
sh "cp ${build_deploy}/initramfs-linux/fitImage-${image_basename}-${MACHINE} fitImage-${image_basename}"
sh "cp ${build_deploy}/initramfs-linux/fitImage-${image_basename}-${params.MACHINE} fitImage-${image_basename}"
else
sh "cp ${build_deploy}/fct-linux/fitImage-${image_basename}-${MACHINE} fitImage-${image_basename}"
sh "cp ${build_deploy}/fct-linux/fitImage-${image_basename}-${params.MACHINE} fitImage-${image_basename}"
sh "cp ${basename_in}.tar.gz ${basename_out}.tar.gz"
}
else {
sh "cp ${build_deploy}/fitImage-${MACHINE}.bin ."
sh "cp ${build_deploy}/fitImage-${params.MACHINE}.bin ."
sh "cp ${basename_in}.ota-ext4 ${basename_out}.ota-ext4"
sh "cp ${basename_in}.wic ${basename_out}.wic"
def ostree_archive = "ostree_repo${image_type}.tar.gz"