jobs/BuildAll,Common: added time measurement for building targets
the nightly builds the target in a loop. To have directly a job log with an overview about the consumed build times, the nightly prints the measured time after each target build. Signed-off-by: Marc Mattmüller <marc.mattmueller@netmodule.com>
This commit is contained in:
parent
aa1e58f58c
commit
c08549263b
|
|
@ -221,6 +221,7 @@ def runBuildJob(commonHelpers, buildTarget, buildBranch) {
|
|||
def buildMachine(commonHelpers, machine, buildBranch) {
|
||||
Boolean isMachineSuccessfullyBuilt = true
|
||||
println "BUILDING ${machine}"
|
||||
commonHelpers.setupTimeMeasurement()
|
||||
// NOTE: this catchError statement is needed in case of an
|
||||
// abort of the build job or similar failures
|
||||
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
|
||||
|
|
@ -235,6 +236,7 @@ def buildMachine(commonHelpers, machine, buildBranch) {
|
|||
if(!isMachineSuccessfullyBuilt) {
|
||||
println "Failed building properly machine ${machine}"
|
||||
}
|
||||
commonHelpers.printMeasuredTimeToNow("building ${machine}")
|
||||
return isMachineSuccessfullyBuilt
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -100,6 +100,29 @@ def getNginxCredentialID() {
|
|||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
def getCurrentUtcEpochTime() {
|
||||
def currTimeUtc = sh(returnStdout: true, script: "bash -c \"date -u +%s\"").trim()
|
||||
return currTimeUtc
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
def setupTimeMeasurement() {
|
||||
env.START_TIME = getCurrentUtcEpochTime()
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
def getMeasuredTime() {
|
||||
Integer t_now = Integer.parseInt(getCurrentUtcEpochTime())
|
||||
Integer t_start = Integer.parseInt("${env.START_TIME}")
|
||||
Integer timeDiffS = (t_now - t_start)
|
||||
return timeDiffS
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
def printMeasuredTimeToNow(timeDescriptor) {
|
||||
measTimeS = getMeasuredTime()
|
||||
println "Measured time for ${timeDescriptor} [s] = " + measTimeS
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
def setupGlobalEnvironmentVariables(repoDir, machine) {
|
||||
env.MACHINE = "${machine}"
|
||||
|
|
|
|||
Loading…
Reference in New Issue