jenkins_sdk: cleaned up and changed archiving

the heap size of the java engine was exceeded when using archive
artifacts, thus the archiving is now done by deploying the sdk to
nexus.

additionally a cleaning of leftovers is added in the preparing
stage and the stage collecting the revisions is removed.

BugzID: 73631
Signed-off-by: Marc Mattmueller <marc.mattmueller@netmodule.com>
This commit is contained in:
Marc Mattmueller 2021-07-08 09:48:18 +02:00
parent 15832f8603
commit 3d0c6767c1
1 changed files with 49 additions and 22 deletions

View File

@ -25,7 +25,7 @@ pipeline {
}
options {
timeout(time: 8, unit: 'HOURS')
timeout(time: 5, unit: 'HOURS')
buildDiscarder(
logRotator(numToKeepStr: '5',
daysToKeepStr: '5',
@ -50,7 +50,8 @@ pipeline {
yoctocommon = load "${env.ROOTDIR}/Jenkinsfile_Common"
// Prepare Build Environment
env.YOCTO_DEPLOYS = "**/tmp/deploy/sdk"
env.YOCTO_DEPLOYS = "${env.SHARED_BUILD}/tmp/deploy/sdk"
cleanLastBuildArtifacts()
yoctocommon.handleSubmodules("${params.RLS_VERSION}")
version = yoctocommon.getVersionString("${params.RLS_VERSION}", "sdk")
env.BUILD_VERSION = "${version}"
@ -78,31 +79,21 @@ pipeline {
sh "bash -c '. ./env.image-ostree && bitbake netmodule-linux-sdk'"
}
else {
sh "bash -c '. ./env.image-ostree && bitbake -c populate_sdk netmodule-linux-image-dev'"
sh "bash -c '. ./env.image-ostree && bitbake -fc populate_sdk netmodule-linux-image-dev'"
}
}
archiveArtifacts artifacts: "${env.YOCTO_DEPLOYS}/netmodule-linux-ostree*-netmodule-linux-*.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)
script{
deploySdkToArtifactory(params.BUILD_FROM_DEV_IMAGE, "${params.MACHINE}")
}
} // success
always {
script {
yoctocommon.syncSources("${env.DOWNLOAD_DIR}", "${env.BINARY_STORAGE_URL}")
}
} // always
}
}
@ -122,3 +113,39 @@ def printJobParameters() {
----------------------------------\n"
}
def cleanLastBuildArtifacts() {
println "cleaning artifacts from last build..."
sh "rm -f ${env.YOCTO_DEPLOYS}/*"
sh "bash -c '. ./env.image-ostree && bitbake -c cleanall netmodule-linux-sdk'"
}
def deploySdkToArtifactory(isBuildFromDev, machine) {
def cpuType = machine.split("-")[0]
def sdkArtifact = sh(returnStdout: true, script: "ls ${env.YOCTO_DEPLOYS}/netmodule-linux-ostree*-netmodule-linux-*.sh").trim()
if(isBuildFromDev) {
def jenkinsBaseUrl = "https://jenkins.netmodule.intranet"
def workspaceUrl = "${jenkinsBaseUrl}/job/NMOS/job/build-sdk/job/${env.BRANCH_NAME}/${currentBuild.number}/execution/node/3/ws/build/tmp/deploy/sdk"
def artifactFile = sh(returnStdout: true, script: "basename ${sdkArtifact}")
println "Download link of image-sdk (cpuType=${cpuType}): ${workspaceUrl}/${artifactFile}"
return
}
println "Deploying ${sdkArtifact} (cpuType=${cpuType}) to NEXUS..."
nexusArtifactUploader(
nexusVersion: "nexus3",
protocol: "https",
nexusUrl: "repo.netmodule.intranet:443",
groupId: "nm.sdk",
version: "latest",
repository: "nm-os",
credentialsId: "0099cd5a-81d4-4698-9b55-1206895d19fb",
artifacts: [
[artifactId: "${cpuType}",
classifier: "",
file: "${sdkArtifact}",
type: "sh"]
]
);
}