From ebd66fef89d6c88bffb9e437f7a41e466ee6cbd2 Mon Sep 17 00:00:00 2001 From: Itms Date: Sun, 10 Nov 2024 13:14:25 +0100 Subject: [PATCH] Retry non-incremental CI builds as a new run When a non-incremental build is needed for a PR, the current code cleans up workspaces and retries, but this leaves the build error in the console output. This marks the build as unstable, as if warnings were present. Instead, let the build fail and instead reschedule a clean build, which will override the build status in Gitea. --- build/jenkins/pipelines/freeBSD.Jenkinsfile | 29 +++++++++---- build/jenkins/pipelines/linux.Jenkinsfile | 46 +++++++++++++-------- build/jenkins/pipelines/macOS.Jenkinsfile | 46 +++++++++++++-------- build/jenkins/pipelines/windows.Jenkinsfile | 46 +++++++++++++-------- 4 files changed, 108 insertions(+), 59 deletions(-) diff --git a/build/jenkins/pipelines/freeBSD.Jenkinsfile b/build/jenkins/pipelines/freeBSD.Jenkinsfile index 1127d83075..5a69794b2c 100644 --- a/build/jenkins/pipelines/freeBSD.Jenkinsfile +++ b/build/jenkins/pipelines/freeBSD.Jenkinsfile @@ -22,6 +22,10 @@ pipeline { // Stop previous build in pull requests, but not in branches options { disableConcurrentBuilds(abortPrevious: env.CHANGE_ID != null) } + parameters { + booleanParam description: 'Non-incremental build', name: 'CLEANBUILD' + } + agent { node { label 'FreeBSDAgent' @@ -44,6 +48,12 @@ pipeline { sh "libraries/build-source-libs.sh 2> freebsd-prebuild-errors.log" sh "build/workspaces/update-workspaces.sh --jenkins-tests 2>> freebsd-prebuild-errors.log" + + script { + if (params.CLEANBUILD) { + sh "cd build/workspaces/gcc/ && gmake clean config=release" + } + } } post { failure { @@ -54,16 +64,19 @@ pipeline { stage ("Release Build") { steps { - retry (2) { - script { - try { sh "cd build/workspaces/gcc/ && gmake config=release" } - catch(e) { - sh "cd build/workspaces/gcc/ && gmake clean config=release" - throw e - } - } + sh "cd build/workspaces/gcc/ && gmake config=release" + } + post { + failure { + script { if (!params.CLEANBUILD) { + build wait: false, job: "$JOB_NAME", parameters: [booleanParam(name: 'CLEANBUILD', value: true)] + }} } + } + } + stage ("Release Tests") { + steps { timeout(time: 15) { sh "cd binaries/system/ && ./test > cxxtest-release.xml" } diff --git a/build/jenkins/pipelines/linux.Jenkinsfile b/build/jenkins/pipelines/linux.Jenkinsfile index 9291d0028f..d655653769 100644 --- a/build/jenkins/pipelines/linux.Jenkinsfile +++ b/build/jenkins/pipelines/linux.Jenkinsfile @@ -21,6 +21,10 @@ pipeline { // Stop previous build in pull requests, but not in branches options { disableConcurrentBuilds(abortPrevious: env.CHANGE_ID != null) } + parameters { + booleanParam description: 'Non-incremental build', name: 'CLEANBUILD' + } + agent none stages { stage("Setup") { @@ -74,6 +78,13 @@ pipeline { sh "build/workspaces/update-workspaces.sh --jenkins-tests 2>> ${JENKINS_COMPILER}-prebuild-errors.log" } } + + script { + if (params.CLEANBUILD) { + sh "cd build/workspaces/gcc/ && make clean config=debug" + sh "cd build/workspaces/gcc/ && make clean config=release" + } + } } post { failure { @@ -84,15 +95,19 @@ pipeline { stage("Debug Build") { steps { - retry(2) { - script { - try { sh "cd build/workspaces/gcc/ && make config=debug" } - catch(e) { - sh "cd build/workspaces/gcc/ && make clean config=debug" - throw e - } - } + sh "cd build/workspaces/gcc/ && make config=debug" + } + post { + failure { + script { if (!params.CLEANBUILD) { + build wait: false, job: "$JOB_NAME", parameters: [booleanParam(name: 'CLEANBUILD', value: true)] + }} } + } + } + + stage("Debug Tests") { + steps { timeout(time: 15) { sh "cd binaries/system/ && ./test_dbg > cxxtest-debug.xml" } @@ -106,15 +121,12 @@ pipeline { stage("Release Build") { steps { - retry(2) { - script { - try { sh "cd build/workspaces/gcc/ && make config=release" } - catch(e) { - sh "cd build/workspaces/gcc/ && make clean config=release" - throw e - } - } - } + sh "cd build/workspaces/gcc/ && make config=release" + } + } + + stage("Release Tests") { + steps { timeout(time: 15) { sh "cd binaries/system/ && ./test > cxxtest-release.xml" } diff --git a/build/jenkins/pipelines/macOS.Jenkinsfile b/build/jenkins/pipelines/macOS.Jenkinsfile index fbf6e1f12b..2d7c52e603 100644 --- a/build/jenkins/pipelines/macOS.Jenkinsfile +++ b/build/jenkins/pipelines/macOS.Jenkinsfile @@ -21,6 +21,10 @@ pipeline { // Stop previous build in pull requests, but not in branches options { disableConcurrentBuilds(abortPrevious: env.CHANGE_ID != null) } + parameters { + booleanParam description: 'Non-incremental build', name: 'CLEANBUILD' + } + agent { node { label 'macOSAgent' @@ -38,6 +42,13 @@ pipeline { sh "libraries/build-macos-libs.sh 2> macos-prebuild-errors.log" sh "build/workspaces/update-workspaces.sh --jenkins-tests 2>> macos-prebuild-errors.log" + + script { + if (params.CLEANBUILD) { + sh "cd build/workspaces/gcc/ && make clean config=debug" + sh "cd build/workspaces/gcc/ && make clean config=release" + } + } } post { failure { @@ -48,15 +59,19 @@ pipeline { stage("Debug Build") { steps { - retry(2) { - script { - try { sh "cd build/workspaces/gcc/ && make config=debug" } - catch(e) { - sh "cd build/workspaces/gcc/ && make clean config=debug" - throw e - } - } + sh "cd build/workspaces/gcc/ && make config=debug" + } + post { + failure { + script { if (!params.CLEANBUILD) { + build wait: false, job: "$JOB_NAME", parameters: [booleanParam(name: 'CLEANBUILD', value: true)] + }} } + } + } + + stage("Debug Tests") { + steps { timeout(time: 15) { sh "cd binaries/system/ && ./test_dbg > cxxtest-debug.xml" } @@ -70,15 +85,12 @@ pipeline { stage("Release Build") { steps { - retry(2) { - script { - try { sh "cd build/workspaces/gcc/ && make config=release" } - catch(e) { - sh "cd build/workspaces/gcc/ && make clean config=release" - throw e - } - } - } + sh "cd build/workspaces/gcc/ && make config=release" + } + } + + stage("Release Tests") { + steps { timeout(time: 15) { sh "cd binaries/system/ && ./test > cxxtest-release.xml" } diff --git a/build/jenkins/pipelines/windows.Jenkinsfile b/build/jenkins/pipelines/windows.Jenkinsfile index ae3e29cd68..7eb74b2e0d 100644 --- a/build/jenkins/pipelines/windows.Jenkinsfile +++ b/build/jenkins/pipelines/windows.Jenkinsfile @@ -24,6 +24,10 @@ pipeline { // Stop previous build in pull requests, but not in branches options { disableConcurrentBuilds(abortPrevious: env.CHANGE_ID != null) } + parameters { + booleanParam description: 'Non-incremental build', name: 'CLEANBUILD' + } + agent { node { label 'WindowsAgent' @@ -43,20 +47,31 @@ pipeline { bat "(robocopy /MIR /NDL /NJH /NJS /NP /NS /NC E:\\wxWidgets-3.2.6\\lib libraries\\win32\\wxwidgets\\lib) ^& IF %ERRORLEVEL% LEQ 1 exit 0" bat "(robocopy /MIR /NDL /NJH /NJS /NP /NS /NC E:\\wxWidgets-3.2.6\\include libraries\\win32\\wxwidgets\\include) ^& IF %ERRORLEVEL% LEQ 1 exit 0" bat "cd build\\workspaces && update-workspaces.bat --atlas --jenkins-tests" + + script { + if (params.CLEANBUILD) { + bat "cd build\\workspaces\\vs2017 && ${visualStudioPath} pyrogenesis.sln /p:Configuration=Debug /t:Clean" + bat "cd build\\workspaces\\vs2017 && ${visualStudioPath} pyrogenesis.sln /p:Configuration=Release /t:Clean" + } + } } } stage("Debug Build") { steps { - retry(2) { - script { - try { bat("cd build\\workspaces\\vs2017 && ${visualStudioPath} pyrogenesis.sln /p:Configuration=Debug ${buildOptions}") } - catch(e) { - bat("cd build\\workspaces\\vs2017 && ${visualStudioPath} pyrogenesis.sln /p:Configuration=Debug /t:Clean") - throw e - } - } + bat "cd build\\workspaces\\vs2017 && ${visualStudioPath} pyrogenesis.sln /p:Configuration=Debug ${buildOptions}" + } + post { + failure { + script { if (!params.CLEANBUILD) { + build wait: false, job: "$JOB_NAME", parameters: [booleanParam(name: 'CLEANBUILD', value: true)] + }} } + } + } + + stage("Debug Tests") { + steps { timeout(time: 15) { bat "cd binaries\\system && test_dbg.exe > cxxtest-debug.xml" } @@ -70,15 +85,12 @@ pipeline { stage ("Release Build") { steps { - retry(2) { - script { - try { bat("cd build\\workspaces\\vs2017 && ${visualStudioPath} pyrogenesis.sln /p:Configuration=Release ${buildOptions}") } - catch(e) { - bat("cd build\\workspaces\\vs2017 && ${visualStudioPath} pyrogenesis.sln /p:Configuration=Release /t:Clean") - throw e - } - } - } + bat "cd build\\workspaces\\vs2017 && ${visualStudioPath} pyrogenesis.sln /p:Configuration=Release ${buildOptions}" + } + } + + stage ("Release Tests") { + steps { timeout(time: 5) { bat "cd binaries\\system && test.exe > cxxtest-release.xml" }