From 79127ec59d5611fe4460e3b2e84fe94fbb0fccd2 Mon Sep 17 00:00:00 2001 From: Itms Date: Sat, 31 Aug 2024 15:44:11 +0200 Subject: [PATCH] Automatically try to unbreak CI incremental builds This entirely reverts ee3318309b and removes the [CLEANBUILD] feature, which needed to be used without omission to be efficient. Instead, in case of build failure, the CI automatically starts a non-incremental second build by running `make clean` (or the MSBuild equivalent) before retrying the build. --- build/jenkins/pipelines/freeBSD.Jenkinsfile | 25 +++++------- build/jenkins/pipelines/linux.Jenkinsfile | 43 +++++++++------------ build/jenkins/pipelines/macOS.Jenkinsfile | 35 +++++++++-------- build/jenkins/pipelines/windows.Jenkinsfile | 35 +++++++++-------- 4 files changed, 63 insertions(+), 75 deletions(-) diff --git a/build/jenkins/pipelines/freeBSD.Jenkinsfile b/build/jenkins/pipelines/freeBSD.Jenkinsfile index 847a126e59..b2c01a342d 100644 --- a/build/jenkins/pipelines/freeBSD.Jenkinsfile +++ b/build/jenkins/pipelines/freeBSD.Jenkinsfile @@ -35,16 +35,6 @@ pipeline { LLVM_OBJDUMP = '/usr/bin/llvm-objdump' } stages { - stage("Cleanup") { - when { - changelog '.*\\[CLEANBUILD\\].*' - } - steps { - script { env.CLEANBUILD = 'true' } - sh "git clean -fdx build/ source/" - } - } - stage ("Pre-build") { steps { discoverGitReferenceBuild() @@ -64,7 +54,15 @@ pipeline { stage ("Release Build") { steps { - sh "cd build/workspaces/gcc/ && gmake -j2 config=release" + retry (2) { + script { + try { sh "cd build/workspaces/gcc/ && gmake -j2 config=release" } + catch(e) { + sh "cd build/workspaces/gcc/ && gmake clean config=release" + throw e + } + } + } timeout(time: 15) { sh "cd binaries/system/ && ./test > cxxtest-release.xml" @@ -80,11 +78,6 @@ pipeline { post { always { - script { - if (env.CLEANBUILD == 'true') { - sh "git clean -fdx build/ source/" - } - } recordIssues enabledForFailure: true, qualityGates: [[threshold: 1, type: 'NEW']], tool: clang() } } diff --git a/build/jenkins/pipelines/linux.Jenkinsfile b/build/jenkins/pipelines/linux.Jenkinsfile index 5731521e99..56ad0a1613 100644 --- a/build/jenkins/pipelines/linux.Jenkinsfile +++ b/build/jenkins/pipelines/linux.Jenkinsfile @@ -60,19 +60,6 @@ pipeline { } stages { - stage("Cleanup") { - when { - allOf { - environment name: 'JENKINS_PCH', value: 'pch' - changelog '.*\\[CLEANBUILD\\].*' - } - } - steps { - script { env.CLEANBUILD = 'true' } - sh "git clean -fdx build/ source/" - } - } - stage("Pre-build") { steps { sh "git lfs pull -I binaries/data/tests" @@ -97,7 +84,15 @@ pipeline { stage("Debug Build") { steps { - sh "cd build/workspaces/gcc/ && make -j1 config=debug" + retry(2) { + script { + try { sh "cd build/workspaces/gcc/ && make -j1 config=debug" } + catch(e) { + sh "cd build/workspaces/gcc/ && make clean config=debug" + throw e + } + } + } timeout(time: 15) { sh "cd binaries/system/ && ./test_dbg > cxxtest-debug.xml" } @@ -111,7 +106,15 @@ pipeline { stage("Release Build") { steps { - sh "cd build/workspaces/gcc/ && make -j1 config=release" + retry(2) { + script { + try { sh "cd build/workspaces/gcc/ && make -j1 config=release" } + catch(e) { + sh "cd build/workspaces/gcc/ && make clean config=release" + throw e + } + } + } timeout(time: 15) { sh "cd binaries/system/ && ./test > cxxtest-release.xml" } @@ -123,16 +126,6 @@ pipeline { } } } - - post { - always { - script { - if (env.CLEANBUILD == 'true' && env.JENKINS_PCH == 'pch') { - sh "git clean -fdx build/ source/" - } - } - } - } } post { diff --git a/build/jenkins/pipelines/macOS.Jenkinsfile b/build/jenkins/pipelines/macOS.Jenkinsfile index 33b9f62f49..263b1d0a3f 100644 --- a/build/jenkins/pipelines/macOS.Jenkinsfile +++ b/build/jenkins/pipelines/macOS.Jenkinsfile @@ -29,16 +29,6 @@ pipeline { } stages { - stage("Cleanup") { - when { - changelog '.*\\[CLEANBUILD\\].*' - } - steps { - script { env.CLEANBUILD = 'true' } - sh "git clean -fdx build/ source/" - } - } - stage ("Pre-build") { steps { discoverGitReferenceBuild() @@ -58,7 +48,15 @@ pipeline { stage("Debug Build") { steps { - sh "cd build/workspaces/gcc/ && make -j4 config=debug" + retry(2) { + script { + try { sh "cd build/workspaces/gcc/ && make -j4 config=debug" } + catch(e) { + sh "cd build/workspaces/gcc/ && make clean config=debug" + throw e + } + } + } timeout(time: 15) { sh "cd binaries/system/ && ./test_dbg > cxxtest-debug.xml" } @@ -72,7 +70,15 @@ pipeline { stage("Release Build") { steps { - sh "cd build/workspaces/gcc/ && make -j4 config=release" + retry(2) { + script { + try { sh "cd build/workspaces/gcc/ && make -j4 config=release" } + catch(e) { + sh "cd build/workspaces/gcc/ && make clean config=release" + throw e + } + } + } timeout(time: 15) { sh "cd binaries/system/ && ./test > cxxtest-release.xml" } @@ -87,11 +93,6 @@ pipeline { post { always { - script { - if (env.CLEANBUILD == 'true') { - sh "git clean -fdx build/ source/" - } - } recordIssues enabledForFailure: true, qualityGates: [[threshold: 1, type: 'NEW']], tool: clang() } } diff --git a/build/jenkins/pipelines/windows.Jenkinsfile b/build/jenkins/pipelines/windows.Jenkinsfile index 619c9bf357..a321d52b01 100644 --- a/build/jenkins/pipelines/windows.Jenkinsfile +++ b/build/jenkins/pipelines/windows.Jenkinsfile @@ -32,16 +32,6 @@ pipeline { } stages { - stage("Cleanup") { - when { - changelog '.*\\[CLEANBUILD\\].*' - } - steps { - script { env.CLEANBUILD = 'true' } - bat "git clean -fdx build/ source/" - } - } - stage ("Pre-build") { steps { discoverGitReferenceBuild() @@ -58,7 +48,15 @@ pipeline { stage("Debug Build") { steps { - bat("cd build\\workspaces\\vs2017 && ${visualStudioPath} pyrogenesis.sln /p:Configuration=Debug ${buildOptions}") + 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 + } + } + } timeout(time: 15) { bat "cd binaries\\system && test_dbg.exe > cxxtest-debug.xml" } @@ -72,7 +70,15 @@ pipeline { stage ("Release Build") { steps { - bat("cd build\\workspaces\\vs2017 && ${visualStudioPath} pyrogenesis.sln /p:Configuration=Release ${buildOptions}") + 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 + } + } + } timeout(time: 5) { bat "cd binaries\\system && test.exe > cxxtest-release.xml" } @@ -87,11 +93,6 @@ pipeline { post { always { - script { - if (env.CLEANBUILD == 'true') { - bat "git clean -fdx build/ source/" - } - } recordIssues enabledForFailure: true, qualityGates: [[threshold: 1, type: 'NEW']], tool: msBuild() } }