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() } }