Merge branch 'develop' into ansible-instance

This commit is contained in:
Marc Mattmüller 2023-09-12 15:50:28 +02:00
commit cccc0538a0
2 changed files with 25 additions and 0 deletions

View File

@ -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
}
//-----------------------------------------------------------------------------

View File

@ -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}"