jenkinsfile: added jenkins pipeline for building the SDK
The SDK bases on the ostree dev image BugzID: 73564 Signed-off-by: Marc Mattmueller <marc.mattmueller@netmodule.com>
This commit is contained in:
parent
3534420590
commit
11962381b9
|
|
@ -0,0 +1,113 @@
|
|||
// Loading code requires a NODE context
|
||||
// But we want the code accessible outside the node Context
|
||||
// So declare yoctocommon (object created by the LOAD operation) outside the Node block.
|
||||
def yoctocommon
|
||||
|
||||
|
||||
// declarative pipeline
|
||||
pipeline {
|
||||
agent {
|
||||
node {
|
||||
label 'lxbuild4'
|
||||
}
|
||||
}
|
||||
|
||||
parameters {
|
||||
choice(name: 'MACHINE', choices: ['select...', 'am335x-nrhw20', 'am335x-nmhw21', 'imx8-nmhw23', 'am335x-nmhw24', 'am335x-hw25', 'am335x-hw26'], description: 'choose target platform')
|
||||
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: 'DO_UPDATE_TO_HEAD', defaultValue: true, description: 'update submodules to head')
|
||||
}
|
||||
|
||||
options {
|
||||
timeout(time: 8, unit: 'HOURS')
|
||||
buildDiscarder(
|
||||
logRotator(numToKeepStr: '5',
|
||||
daysToKeepStr: '5',
|
||||
artifactNumToKeepStr: '5',
|
||||
artifactDaysToKeepStr: '5'
|
||||
)
|
||||
)
|
||||
disableConcurrentBuilds()
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('prepare') {
|
||||
steps {
|
||||
script {
|
||||
if("${params.MACHINE}" == "select...") {
|
||||
error("Missing machine type --> select parameter MACHINE for a proper build")
|
||||
}
|
||||
|
||||
// load yocto common file
|
||||
env.ROOTDIR = pwd()
|
||||
yoctocommon = load "${env.ROOTDIR}/Jenkinsfile_Common"
|
||||
|
||||
// Prepare Build Environment
|
||||
env.YOCTO_DEPLOYS = "${env.SHARED_BUILD}/tmp/deploy/sdk"
|
||||
yoctocommon.handleSubmodules(params.DO_UPDATE_TO_HEAD)
|
||||
version = yoctocommon.getVersionString("${params.RLS_VERSION}", "sdk")
|
||||
env.BUILD_VERSION = "${version}"
|
||||
currentBuild.displayName = "${version}-${params.MACHINE}-sdk" //replace Bitbake timestamp after building
|
||||
printJobParameters()
|
||||
yoctocommon.changeDistroVersion("${version}")
|
||||
yoctocommon.syncSources("${env.BINARY_STORAGE_URL}", "${env.DOWNLOAD_DIR}")
|
||||
}
|
||||
writeFile file: 'VERSION', text: "${env.PACKAGE_NAME}: ${env.BUILD_VERSION}"
|
||||
}
|
||||
}
|
||||
|
||||
stage('clean') {
|
||||
when { expression { return params.CLEAN_BUILD } }
|
||||
steps {
|
||||
dir ("${SHARED_BUILD}/tmp") { deleteDir() }
|
||||
dir ("${SHARED_BUILD}/tmp-glibc") { deleteDir() }
|
||||
}
|
||||
}
|
||||
|
||||
stage('build') {
|
||||
steps {
|
||||
script {
|
||||
sh "bash -c '. ./env.image-ostree && bitbake netmodule-linux-image-dev -c populate_sdk'"
|
||||
}
|
||||
archiveArtifacts artifacts: "${env.YOCTO_DEPLOYS}/netmodule-linux-ostree*netmodule-linux-image-dev*.sh", onlyIfSuccessful: true
|
||||
}
|
||||
post {
|
||||
always {
|
||||
script {
|
||||
yoctocommon.syncSources("${env.DOWNLOAD_DIR}", "${env.BINARY_STORAGE_URL}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('collect versions') {
|
||||
steps {
|
||||
script {
|
||||
revisions = yoctocommon.getAutoRevHashes('ostree')
|
||||
writeFile(file: "${env.AUTOREV_VERSION_FILE}", text: "${revisions}")
|
||||
}
|
||||
}
|
||||
post {
|
||||
success {
|
||||
archiveArtifacts(artifacts: "${env.SUBMODULE_VERION_FILE}, ${env.AUTOREV_VERSION_FILE}, ${env.DISTRO_VERSION_FILE}", onlyIfSuccessful: false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // stages
|
||||
}
|
||||
|
||||
|
||||
def printJobParameters() {
|
||||
println "----------------------------------\n\
|
||||
Job Parameters:\n\
|
||||
----------------------------------\n\
|
||||
MACHINE = ${params.MACHINE}\n\
|
||||
CLEAN_BUILD = ${params.CLEAN_BUILD}\n\
|
||||
UPDATE_TO_HEAD = ${params.DO_UPDATE_TO_HEAD}\n\
|
||||
RLS_VERSION = ${params.RLS_VERSION}\n\
|
||||
--> version = ${env.BUILD_VERSION}\n\
|
||||
----------------------------------\n"
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue