Kill leftovers after a successful or failed build
This commit is contained in:
parent
6b10e59877
commit
acc8281b25
1 changed files with 55 additions and 38 deletions
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
def doKillLeftovers() {
|
||||
def doDisplayLeftovers() {
|
||||
if (isUnix()) {
|
||||
sh """
|
||||
# Killing any processes that may interfere with the next build
|
||||
|
|
@ -7,11 +6,23 @@ def doKillLeftovers() {
|
|||
# Don't return an error if the processes don't exist
|
||||
USER=`whoami`
|
||||
ps aux | grep "eclipse"
|
||||
# pkill -U "${USER}" -9 eclipse || true
|
||||
ps aux | grep "make"
|
||||
# pkill -U "${USER}" -9 make || true
|
||||
ps aux | grep "arm-linux"
|
||||
# pkill -U "${USER}" -9 ".*arm-linux.*" || true
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
def doKillLeftovers() {
|
||||
if (isUnix()) {
|
||||
doDisplayLeftovers()
|
||||
sh """
|
||||
# Killing any processes that may interfere with the next build
|
||||
# The build system must be setup to do more than one eclipse build concurrently
|
||||
# Don't return an error if the processes don't exist
|
||||
USER=`whoami`
|
||||
pkill -U "${USER}" -9 eclipse || true
|
||||
pkill -U "${USER}" -9 make || true
|
||||
pkill -U "${USER}" -9 ".*arm-linux.*" || true
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
|
@ -106,45 +117,51 @@ def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand,
|
|||
def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, exportfolder = "${WORKSPACE}/bin") {
|
||||
// The lock is being used because it was being found that the doKillLeftovers was affecting other builds
|
||||
lock(resource: "eclipsebuild_${env.NODE_NAME}") {
|
||||
doKillLeftovers()
|
||||
addToolchainPath(toolchainfolder)
|
||||
doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder)
|
||||
for (appInfo in apps ) {
|
||||
(build, cleanbuild, project, variants, exportpathlist) = appInfo
|
||||
if (build) {
|
||||
if (cleanbuild) {
|
||||
buildtype = "-cleanBuild"
|
||||
doDisplayLeftovers()
|
||||
try {
|
||||
addToolchainPath(toolchainfolder)
|
||||
doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder)
|
||||
for (appInfo in apps ) {
|
||||
(build, cleanbuild, project, variants, exportpathlist) = appInfo
|
||||
if (build) {
|
||||
if (cleanbuild) {
|
||||
buildtype = "-cleanBuild"
|
||||
}
|
||||
else {
|
||||
buildtype = "-build"
|
||||
}
|
||||
for (build_variant in variants) {
|
||||
retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing)
|
||||
doRegisterToolchain(ds5folder, toolchainfolder)
|
||||
echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'"
|
||||
if (isUnix()) {
|
||||
sh """
|
||||
echo Start time: `date`
|
||||
${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'
|
||||
echo End time: `date`
|
||||
"""
|
||||
}
|
||||
else {
|
||||
bat """
|
||||
"%ds5shellcommand%" "%buildcommand%" -no-indexer ${buildtype} "${project}\\${build_variant}"
|
||||
"""
|
||||
}
|
||||
doExport(exportfolder, exportpathlist, "", build_variant)
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
buildtype = "-build"
|
||||
}
|
||||
for (build_variant in variants) {
|
||||
retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing)
|
||||
doRegisterToolchain(ds5folder, toolchainfolder)
|
||||
echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'"
|
||||
if (isUnix()) {
|
||||
sh """
|
||||
echo Start time: `date`
|
||||
${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'
|
||||
echo End time: `date`
|
||||
"""
|
||||
}
|
||||
else {
|
||||
bat """
|
||||
"%ds5shellcommand%" "%buildcommand%" -no-indexer ${buildtype} "${project}\\${build_variant}"
|
||||
"""
|
||||
}
|
||||
doExport(exportfolder, exportpathlist, "", build_variant)
|
||||
// Only export if the project has no variants - signifying that there are files to export which have been prebuilt
|
||||
if (!variants) {
|
||||
doExport(exportfolder, exportpathlist, project)
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Only export if the project has no variants - signifying that there are files to export which have been prebuilt
|
||||
if (!variants) {
|
||||
doExport(exportfolder, exportpathlist, project)
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
error "Build failed - Killing leftovers"
|
||||
doKillLeftovers()
|
||||
}
|
||||
doKillLeftovers()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue