Merge branch 'develop' into ansible-instance
This commit is contained in:
commit
57873d15cd
|
|
@ -134,7 +134,7 @@ def runUpdateSrcRevJob(commonHelpers, buildBranch, isCleanRequested, isDryRun) {
|
||||||
try {
|
try {
|
||||||
updateJob = build(job: "${env.SRCREV_JOB}",
|
updateJob = build(job: "${env.SRCREV_JOB}",
|
||||||
quietPeriod: 0,
|
quietPeriod: 0,
|
||||||
propagate: true,
|
propagate: false,
|
||||||
wait: true,
|
wait: true,
|
||||||
parameters: [string(name: 'BUILD_BRANCH', value: buildBranch),
|
parameters: [string(name: 'BUILD_BRANCH', value: buildBranch),
|
||||||
booleanParam(name: 'CLEAN_BUILD', value: isCleanRequested),
|
booleanParam(name: 'CLEAN_BUILD', value: isCleanRequested),
|
||||||
|
|
@ -143,7 +143,6 @@ def runUpdateSrcRevJob(commonHelpers, buildBranch, isCleanRequested, isDryRun) {
|
||||||
}
|
}
|
||||||
catch(Exception e) {
|
catch(Exception e) {
|
||||||
error("Exception: " + e.toString())
|
error("Exception: " + e.toString())
|
||||||
return
|
|
||||||
}
|
}
|
||||||
// assert to be sure
|
// assert to be sure
|
||||||
if(updateJob == null) {
|
if(updateJob == null) {
|
||||||
|
|
@ -181,11 +180,12 @@ def isMachineSane(machine) {
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
def runBuildJob(commonHelpers, buildTarget, buildBranch) {
|
def runBuildJob(commonHelpers, buildTarget, buildBranch) {
|
||||||
def buildJob = null
|
def buildJob = null
|
||||||
Boolean isSuccessfullyBuilt = true
|
def theBuildResult = 'SUCCESS'
|
||||||
|
Boolean hasException = false
|
||||||
try {
|
try {
|
||||||
buildJob = build(job: "${env.BUILD_JOB}",
|
buildJob = build(job: "${env.BUILD_JOB}",
|
||||||
quietPeriod: 0,
|
quietPeriod: 0,
|
||||||
propagate: true,
|
propagate: false,
|
||||||
wait: true,
|
wait: true,
|
||||||
parameters: [string(name: 'TARGET', value: buildTarget),
|
parameters: [string(name: 'TARGET', value: buildTarget),
|
||||||
string(name: 'BUILD_BRANCH', value: buildBranch),
|
string(name: 'BUILD_BRANCH', value: buildBranch),
|
||||||
|
|
@ -196,17 +196,26 @@ def runBuildJob(commonHelpers, buildTarget, buildBranch) {
|
||||||
booleanParam(name: 'DEBUGGING', value: params.DEBUGGING)]
|
booleanParam(name: 'DEBUGGING', value: params.DEBUGGING)]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) {
|
||||||
|
println "job ${env.BUILD_JOB} for TARGET=${buildTarget} was cancelled or aborted"
|
||||||
|
theBuildResult = 'ABORTED'
|
||||||
|
}
|
||||||
catch(Exception e) {
|
catch(Exception e) {
|
||||||
error("Exception: " + e.toString())
|
hasException = true
|
||||||
return
|
theBuildResult = 'FAILURE'
|
||||||
|
println "Exception caught: " + e.toString()
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
if(!hasException && (buildJob != null)) {
|
||||||
|
theBuildResult = buildJob.getResult()
|
||||||
|
}
|
||||||
|
return theBuildResult
|
||||||
}
|
}
|
||||||
// assert to be sure
|
// assert to be sure
|
||||||
if(buildJob == null) {
|
if(buildJob == null) {
|
||||||
error("Something went really wrong with ${env.BUILD_JOB} (TARGET=${buildTarget})")
|
error("Something went really wrong with ${env.BUILD_JOB} (TARGET=${buildTarget})")
|
||||||
return
|
|
||||||
}
|
}
|
||||||
isSuccessfullyBuilt = (buildJob.getResult() == 'SUCCESS')
|
return buildJob.getResult()
|
||||||
return isSuccessfullyBuilt
|
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
def buildMachine(commonHelpers, machine, buildBranch) {
|
def buildMachine(commonHelpers, machine, buildBranch) {
|
||||||
|
|
@ -215,7 +224,13 @@ def buildMachine(commonHelpers, machine, buildBranch) {
|
||||||
// NOTE: this catchError statement is needed in case of an
|
// NOTE: this catchError statement is needed in case of an
|
||||||
// abort of the build job or similar failures
|
// abort of the build job or similar failures
|
||||||
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
|
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
|
||||||
isMachineSuccessfullyBuilt = runBuildJob(commonHelpers, machine, buildBranch)
|
def buildJobStatus = runBuildJob(commonHelpers, machine, buildBranch)
|
||||||
|
if(buildJobStatus != 'SUCCESS') {
|
||||||
|
isMachineSuccessfullyBuilt = false
|
||||||
|
if(buildJobStatus == 'ABORTED') {
|
||||||
|
currentBuild.result = 'ABORTED'
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(!isMachineSuccessfullyBuilt) {
|
if(!isMachineSuccessfullyBuilt) {
|
||||||
println "Failed building properly machine ${machine}"
|
println "Failed building properly machine ${machine}"
|
||||||
|
|
@ -231,7 +246,7 @@ def buildAllTargets(commonHelpers, buildBranch) {
|
||||||
|
|
||||||
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
||||||
for (machine in listOfTargets) {
|
for (machine in listOfTargets) {
|
||||||
if(isMachineSane(machine)) {
|
if(!commonHelpers.isCurrentJobAborted() && isMachineSane(machine)) {
|
||||||
Boolean isMachineSuccess = buildMachine(commonHelpers, machine, buildBranch)
|
Boolean isMachineSuccess = buildMachine(commonHelpers, machine, buildBranch)
|
||||||
if(!isMachineSuccess && areBuildsSuccessful) {
|
if(!isMachineSuccess && areBuildsSuccessful) {
|
||||||
areBuildsSuccessful = false
|
areBuildsSuccessful = false
|
||||||
|
|
@ -245,5 +260,4 @@ def buildAllTargets(commonHelpers, buildBranch) {
|
||||||
error("Failing build - first machine failing = ${firstMachineFailing}")
|
error("Failing build - first machine failing = ${firstMachineFailing}")
|
||||||
}
|
}
|
||||||
} // end catchError
|
} // end catchError
|
||||||
commonHelpers.cleanupRepository("${env.YOCTO_REPO_DIR}")
|
|
||||||
}
|
}
|
||||||
|
|
@ -74,6 +74,10 @@ def isCurrentJobSuccess() {
|
||||||
return (currentBuild.currentResult == 'SUCCESS')
|
return (currentBuild.currentResult == 'SUCCESS')
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
def isCurrentJobAborted() {
|
||||||
|
return ((currentBuild.currentResult == 'ABORTED') || (currentBuild.result == 'ABORTED'))
|
||||||
|
}
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
def cleaningClonedRepoDir() {
|
def cleaningClonedRepoDir() {
|
||||||
println "cleaning the entire repository..."
|
println "cleaning the entire repository..."
|
||||||
sh("git clean -ffdx")
|
sh("git clean -ffdx")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue