From ee3318309b8afca957cf22cf4715f18da291af4a Mon Sep 17 00:00:00 2001 From: Itms Date: Tue, 27 Aug 2024 11:30:05 +0200 Subject: [PATCH] Allow to force non-incremental Jenkins builds In all the builds using precompiled headers, an update to libraries will crash the CI, as those headers will become outdated. It is then necessary to force a full rebuild of the game by cleaning up the workspaces. This commit allows this CI behavior to be triggered by specifying [CLEANBUILD] in the first line of the commit message. This will constitute an opportunity to inform users that they need to clean their workspaces when pulling the update. --- build/jenkins/pipelines/freeBSD.Jenkinsfile | 15 +++++++++++++ build/jenkins/pipelines/linux.Jenkinsfile | 24 +++++++++++++++++++++ build/jenkins/pipelines/macOS.Jenkinsfile | 15 +++++++++++++ build/jenkins/pipelines/windows.Jenkinsfile | 15 +++++++++++++ 4 files changed, 69 insertions(+) diff --git a/build/jenkins/pipelines/freeBSD.Jenkinsfile b/build/jenkins/pipelines/freeBSD.Jenkinsfile index 76be15a175..847a126e59 100644 --- a/build/jenkins/pipelines/freeBSD.Jenkinsfile +++ b/build/jenkins/pipelines/freeBSD.Jenkinsfile @@ -35,6 +35,16 @@ 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() @@ -70,6 +80,11 @@ 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 2d601a0421..5731521e99 100644 --- a/build/jenkins/pipelines/linux.Jenkinsfile +++ b/build/jenkins/pipelines/linux.Jenkinsfile @@ -60,12 +60,26 @@ 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" sh "git lfs pull -I \"binaries/data/mods/_test.*\"" sh "libraries/build-source-libs.sh -j1 2> ${JENKINS_COMPILER}-prebuild-errors.log" + script { if (env.JENKINS_PCH == "no-pch") { sh "build/workspaces/update-workspaces.sh -j1 --jenkins-tests --without-pch 2>> ${JENKINS_COMPILER}-prebuild-errors.log" @@ -109,6 +123,16 @@ 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 17c868521b..33b9f62f49 100644 --- a/build/jenkins/pipelines/macOS.Jenkinsfile +++ b/build/jenkins/pipelines/macOS.Jenkinsfile @@ -29,6 +29,16 @@ pipeline { } stages { + stage("Cleanup") { + when { + changelog '.*\\[CLEANBUILD\\].*' + } + steps { + script { env.CLEANBUILD = 'true' } + sh "git clean -fdx build/ source/" + } + } + stage ("Pre-build") { steps { discoverGitReferenceBuild() @@ -77,6 +87,11 @@ 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 a48859a1e7..619c9bf357 100644 --- a/build/jenkins/pipelines/windows.Jenkinsfile +++ b/build/jenkins/pipelines/windows.Jenkinsfile @@ -32,6 +32,16 @@ pipeline { } stages { + stage("Cleanup") { + when { + changelog '.*\\[CLEANBUILD\\].*' + } + steps { + script { env.CLEANBUILD = 'true' } + bat "git clean -fdx build/ source/" + } + } + stage ("Pre-build") { steps { discoverGitReferenceBuild() @@ -77,6 +87,11 @@ pipeline { post { always { + script { + if (env.CLEANBUILD == 'true') { + bat "git clean -fdx build/ source/" + } + } recordIssues enabledForFailure: true, qualityGates: [[threshold: 1, type: 'NEW']], tool: msBuild() } }