jenkins: changed boolean parameter RELEASE_BUILD with string RLS_VERSION

for having the possibility to tag the build after a successful test
result we need to define the release build otherwise

BugzID: 66460

Signed-off-by: Marc Mattmueller <marc.mattmueller@netmodule.com>
This commit is contained in:
Marc Mattmueller 2020-11-09 18:13:14 +01:00
parent 0fd66a4f8d
commit 26e565bb45
1 changed files with 23 additions and 7 deletions

30
Jenkinsfile vendored
View File

@ -9,13 +9,12 @@ pipeline {
parameters {
choice(name: 'MACHINE_TYPE', choices: ['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')
booleanParam(name: 'RELEASE_BUILD', defaultValue: false, description: ' use latest tagged release intead of latest versions')
string(name: 'RLS_VERSION', defaultValue: '', description: 'Set the version to build and use committed submodules')
booleanParam(name: 'CLEAN_BUILD', defaultValue: false, description: 'clean all temp directories before build starts')
}
environment {
PACKAGE_NAME = 'nm-os'
SLACK_TOKEN = '54fghFEpv1Rmf6GJ4gJ7cL2y'
MACHINE = "${MACHINE_TYPE}"
@ -41,22 +40,22 @@ pipeline {
stage('prepare') {
steps {
script {
if(params.RELEASE_BUILD) {
if("${params.RLS_VERSION}" != "") {
sh 'git submodule update' // set all submodules to freezed commit
// currentBuild.rawBuild.keepLog(true) // keep this build forever
}
else {
sh 'git submodule update --remote --rebase' // update all submodules to HEAD
}
sh(returnStdout: true, script: "git submodule status").trim() // print submodule hashes to jenkins log
version = sh returnStdout: true, script: 'git describe --tags --dirty'
version = version.trim()
version = build_version()
println "----------------------------------\n Job Parameters:\n----------------------------------\n\
MACHINE_TYPE = ${params.MACHINE_TYPE}\n\
IMAGE_TYPE = ${params.IMAGE_TYPE}\n\
RELEASE_BUILD = ${params.RELEASE_BUILD}\n\
CLEAN_BUILD = ${params.CLEAN_BUILD}\n\
RLS_VERSION = ${params.RLS_VERSION}\n\
--> version = ${version}\n\
----------------------------------\n"
env.BUILD_VERSION = "${version}"
@ -89,6 +88,23 @@ pipeline {
}
def build_version(versionParam) {
def gitCmd = "git describe --tags"
if(versionParam == "") {
gitCmd = "${gitCmd} --dirty"
}
gitversion = sh(returnStdout: true, script: "${gitCmd}").trim()
gitversion = gitversion.split('-')
if(versionParam == "") {
gitversion[0] = versionParam
}
rlsVersion = gitversion.join('-')
return rlsVersion
}
def build_and_archive() {
if (params.IMAGE_TYPE == 'sdk') {
sh "bash -c '. ./env.image-ostree && bitbake -k netmodule-linux-image -c populate_sdk'"