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:
parent
0fd66a4f8d
commit
26e565bb45
|
|
@ -9,13 +9,12 @@ pipeline {
|
||||||
parameters {
|
parameters {
|
||||||
choice(name: 'MACHINE_TYPE', choices: ['am335x-nmhw21', 'imx8-nmhw23', 'am335x-nmhw24', 'am335x-hw25', 'am335x-hw26'], description: 'choose target platform')
|
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')
|
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')
|
booleanParam(name: 'CLEAN_BUILD', defaultValue: false, description: 'clean all temp directories before build starts')
|
||||||
}
|
}
|
||||||
|
|
||||||
environment {
|
environment {
|
||||||
PACKAGE_NAME = 'nm-os'
|
PACKAGE_NAME = 'nm-os'
|
||||||
SLACK_TOKEN = '54fghFEpv1Rmf6GJ4gJ7cL2y'
|
|
||||||
|
|
||||||
MACHINE = "${MACHINE_TYPE}"
|
MACHINE = "${MACHINE_TYPE}"
|
||||||
|
|
||||||
|
|
@ -41,22 +40,22 @@ pipeline {
|
||||||
stage('prepare') {
|
stage('prepare') {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
if(params.RELEASE_BUILD) {
|
if("${params.RLS_VERSION}" != "") {
|
||||||
sh 'git submodule update' // set all submodules to freezed commit
|
sh 'git submodule update' // set all submodules to freezed commit
|
||||||
// currentBuild.rawBuild.keepLog(true) // keep this build forever
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sh 'git submodule update --remote --rebase' // update all submodules to HEAD
|
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 = build_version()
|
||||||
version = version.trim()
|
|
||||||
|
|
||||||
println "----------------------------------\n Job Parameters:\n----------------------------------\n\
|
println "----------------------------------\n Job Parameters:\n----------------------------------\n\
|
||||||
MACHINE_TYPE = ${params.MACHINE_TYPE}\n\
|
MACHINE_TYPE = ${params.MACHINE_TYPE}\n\
|
||||||
IMAGE_TYPE = ${params.IMAGE_TYPE}\n\
|
IMAGE_TYPE = ${params.IMAGE_TYPE}\n\
|
||||||
RELEASE_BUILD = ${params.RELEASE_BUILD}\n\
|
|
||||||
CLEAN_BUILD = ${params.CLEAN_BUILD}\n\
|
CLEAN_BUILD = ${params.CLEAN_BUILD}\n\
|
||||||
|
RLS_VERSION = ${params.RLS_VERSION}\n\
|
||||||
|
--> version = ${version}\n\
|
||||||
----------------------------------\n"
|
----------------------------------\n"
|
||||||
|
|
||||||
env.BUILD_VERSION = "${version}"
|
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() {
|
def build_and_archive() {
|
||||||
if (params.IMAGE_TYPE == 'sdk') {
|
if (params.IMAGE_TYPE == 'sdk') {
|
||||||
sh "bash -c '. ./env.image-ostree && bitbake -k netmodule-linux-image -c populate_sdk'"
|
sh "bash -c '. ./env.image-ostree && bitbake -k netmodule-linux-image -c populate_sdk'"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue