Jenkinsfile fixes

- Mark build with warnings unstable
- Do not set the global build status to failure if a single build failed
This commit is contained in:
Roland Winklmeier
2018-06-13 20:12:14 +02:00
committed by Klaus Basan
parent 18b6ee700b
commit 8dd22a18b5

55
Jenkinsfile vendored
View File

@@ -1,6 +1,7 @@
abortPreviousRunningBuilds() abortPreviousRunningBuilds()
def builders = [:] def builders = [:]
def buildResults = [:]
// Create a map to pass in to the 'parallel' step so we can fire all the builds at once // Create a map to pass in to the 'parallel' step so we can fire all the builds at once
builders['Build swift Linux'] = { builders['Build swift Linux'] = {
@@ -13,12 +14,12 @@ builders['Build swift Linux'] = {
stage('Linux Build') { stage('Linux Build') {
withEnv(['BITROCK_BUILDER=/opt/installbuilder/bin/builder', 'BITROCK_CUSTOMIZE=/opt/installbuilder/autoupdate/bin/customize.run']) { withEnv(['BITROCK_BUILDER=/opt/installbuilder/bin/builder', 'BITROCK_CUSTOMIZE=/opt/installbuilder/autoupdate/bin/customize.run']) {
sh ''' sh '''
cp /var/lib/jenkins/vatsim.pri.official mkspecs/features/vatsim.pri cp ~/vatsim.pri.official mkspecs/features/vatsim.pri
python3 -u scripts/jenkins.py -w 64 -t gcc -d -j 2 python3 -u scripts/jenkins.py -w 64 -t gcc -d -j 2
''' '''
} }
warnings consoleParsers: [[parserName: 'GNU C Compiler 4 (gcc)']] warnings consoleParsers: [[parserName: 'GNU C Compiler 4 (gcc)']], unstableTotalAll: '0'
xunit testTimeMargin: '3000', thresholdMode: 1, thresholds: [failed(), skipped()], tools: [QtTest(deleteOutputFiles: true, failIfNotNew: false, pattern: 'build/out/release/bin/*_testresults.xml', skipNoTestFiles: true, stopProcessingIfError: false)] xunit testTimeMargin: '3000', thresholdMode: 1, thresholds: [failed(), skipped()], tools: [QtTest(deleteOutputFiles: true, failIfNotNew: false, pattern: 'build/out/release/bin/*_testresults.xml', skipNoTestFiles: true, stopProcessingIfError: false)]
} }
@@ -38,14 +39,14 @@ builders['Build swift Linux'] = {
} catch (error) { } catch (error) {
if (manager.build.getAction(InterruptedBuildAction.class) || if (manager.build.getAction(InterruptedBuildAction.class) ||
(error instanceof org.jenkinsci.plugins.workflow.steps.FlowInterruptedException && error.causes.size() == 0)) { (error instanceof org.jenkinsci.plugins.workflow.steps.FlowInterruptedException && error.causes.size() == 0)) {
println("User abort. No error!") echo 'User abort. No error!'
currentBuild.result = "ABORTED" buildResults['swift-linux'] = 'ABORTED'
} else { } else {
currentBuild.result = "FAILURE" buildResults['swift-linux'] = 'FAILURE'
throw error throw error
} }
} finally { } finally {
notifySlack('Linux', currentBuild.result) notifySlack('Linux', buildResults['swift-linux'])
cleanWs deleteDirs: true, notFailBuild: true cleanWs deleteDirs: true, notFailBuild: true
} }
} }
@@ -59,7 +60,6 @@ builders['Build swift MacOS'] = {
} }
stage('MacOS Build') { stage('MacOS Build') {
echo 'Building'
withEnv(['PATH+LOCAL=/usr/local/bin', 'BITROCK_BUILDER=/Applications/BitRockInstallBuilderQt/bin/builder', 'BITROCK_CUSTOMIZE=/Applications/BitRockInstallBuilderQt/autoupdate/bin/customize.sh']) { withEnv(['PATH+LOCAL=/usr/local/bin', 'BITROCK_BUILDER=/Applications/BitRockInstallBuilderQt/bin/builder', 'BITROCK_CUSTOMIZE=/Applications/BitRockInstallBuilderQt/autoupdate/bin/customize.sh']) {
sh ''' sh '''
cp ~/vatsim.pri.official mkspecs/features/vatsim.pri cp ~/vatsim.pri.official mkspecs/features/vatsim.pri
@@ -67,7 +67,7 @@ builders['Build swift MacOS'] = {
''' '''
} }
warnings consoleParsers: [[parserName: 'Clang (LLVM based)']] warnings consoleParsers: [[parserName: 'Clang (LLVM based)']], unstableTotalAll: '0'
xunit testTimeMargin: '3000', thresholdMode: 1, thresholds: [failed(), skipped()], tools: [QtTest(deleteOutputFiles: true, failIfNotNew: false, pattern: 'build/out/release/bin/*_testresults.xml', skipNoTestFiles: true, stopProcessingIfError: false)] xunit testTimeMargin: '3000', thresholdMode: 1, thresholds: [failed(), skipped()], tools: [QtTest(deleteOutputFiles: true, failIfNotNew: false, pattern: 'build/out/release/bin/*_testresults.xml', skipNoTestFiles: true, stopProcessingIfError: false)]
} }
@@ -79,14 +79,14 @@ builders['Build swift MacOS'] = {
} catch (error) { } catch (error) {
if (manager.build.getAction(InterruptedBuildAction.class) || if (manager.build.getAction(InterruptedBuildAction.class) ||
(error instanceof org.jenkinsci.plugins.workflow.steps.FlowInterruptedException && error.causes.size() == 0)) { (error instanceof org.jenkinsci.plugins.workflow.steps.FlowInterruptedException && error.causes.size() == 0)) {
println("User abort. No error!") echo 'User abort. No error!'
currentBuild.result = "ABORTED" buildResults['swift-macos'] = 'ABORTED'
} else { } else {
currentBuild.result = "FAILURE" buildResults['swift-macos'] = 'FAILURE'
throw error throw error
} }
} finally { } finally {
notifySlack('MacOS', currentBuild.result) notifySlack('MacOS', buildResults['swift-macos'])
cleanWs deleteDirs: true, notFailBuild: true cleanWs deleteDirs: true, notFailBuild: true
} }
} }
@@ -100,13 +100,12 @@ builders['Build swift Win32'] = {
} }
stage('Win32 Build') { stage('Win32 Build') {
echo 'Building'
bat ''' bat '''
copy /Y c:\\var\\vatsim.pri.official mkspecs\\features\\vatsim.pri copy /Y c:\\var\\vatsim.pri.official mkspecs\\features\\vatsim.pri
python -u scripts/jenkins.py -w 32 -t msvc -d python -u scripts/jenkins.py -w 32 -t msvc -d
''' '''
warnings consoleParsers: [[parserName: 'MSBuild']] warnings consoleParsers: [[parserName: 'MSBuild']], unstableTotalAll: '0'
xunit testTimeMargin: '3000', thresholdMode: 1, thresholds: [failed(), skipped()], tools: [QtTest(deleteOutputFiles: true, failIfNotNew: false, pattern: 'build/out/release/bin/*_testresults.xml', skipNoTestFiles: true, stopProcessingIfError: false)] xunit testTimeMargin: '3000', thresholdMode: 1, thresholds: [failed(), skipped()], tools: [QtTest(deleteOutputFiles: true, failIfNotNew: false, pattern: 'build/out/release/bin/*_testresults.xml', skipNoTestFiles: true, stopProcessingIfError: false)]
} }
@@ -118,14 +117,14 @@ builders['Build swift Win32'] = {
} catch (error) { } catch (error) {
if (manager.build.getAction(InterruptedBuildAction.class) || if (manager.build.getAction(InterruptedBuildAction.class) ||
(error instanceof org.jenkinsci.plugins.workflow.steps.FlowInterruptedException && error.causes.size() == 0)) { (error instanceof org.jenkinsci.plugins.workflow.steps.FlowInterruptedException && error.causes.size() == 0)) {
println("User abort. No error!") echo 'User abort. No error!'
currentBuild.result = "ABORTED" buildResults['swift-win32'] = 'ABORTED'
} else { } else {
currentBuild.result = "FAILURE" buildResults['swift-win32'] = 'FAILURE'
throw error throw error
} }
} finally { } finally {
notifySlack('Win32', currentBuild.result) notifySlack('Win32', buildResults['swift-win32'])
killDBusDaemon() killDBusDaemon()
cleanWs deleteDirs: true, notFailBuild: true cleanWs deleteDirs: true, notFailBuild: true
} }
@@ -140,13 +139,12 @@ builders['Build swift Win64'] = {
} }
stage('Win64 Build') { stage('Win64 Build') {
echo 'Building'
bat ''' bat '''
copy /Y c:\\var\\vatsim.pri.official mkspecs\\features\\vatsim.pri copy /Y c:\\var\\vatsim.pri.official mkspecs\\features\\vatsim.pri
python -u scripts/jenkins.py -w 64 -t msvc -d python -u scripts/jenkins.py -w 64 -t msvc -d
''' '''
warnings consoleParsers: [[parserName: 'MSBuild']] warnings consoleParsers: [[parserName: 'MSBuild']], unstableTotalAll: '0'
xunit testTimeMargin: '3000', thresholdMode: 1, thresholds: [failed(), skipped()], tools: [QtTest(deleteOutputFiles: true, failIfNotNew: false, pattern: 'build/out/release/bin/*_testresults.xml', skipNoTestFiles: true, stopProcessingIfError: false)] xunit testTimeMargin: '3000', thresholdMode: 1, thresholds: [failed(), skipped()], tools: [QtTest(deleteOutputFiles: true, failIfNotNew: false, pattern: 'build/out/release/bin/*_testresults.xml', skipNoTestFiles: true, stopProcessingIfError: false)]
} }
@@ -158,14 +156,14 @@ builders['Build swift Win64'] = {
} catch (error) { } catch (error) {
if (manager.build.getAction(InterruptedBuildAction.class) || if (manager.build.getAction(InterruptedBuildAction.class) ||
(error instanceof org.jenkinsci.plugins.workflow.steps.FlowInterruptedException && error.causes.size() == 0)) { (error instanceof org.jenkinsci.plugins.workflow.steps.FlowInterruptedException && error.causes.size() == 0)) {
println("User abort. No error!") echo 'User abort. No error!'
currentBuild.result = "ABORTED" buildResults['swift-win64'] = 'ABORTED'
} else { } else {
currentBuild.result = "FAILURE" buildResults['swift-win64'] = 'FAILURE'
throw error throw error
} }
} finally { } finally {
notifySlack('Win64', currentBuild.result) notifySlack('Win64', buildResults['swift-win64'])
killDBusDaemon() killDBusDaemon()
cleanWs deleteDirs: true, notFailBuild: true cleanWs deleteDirs: true, notFailBuild: true
} }
@@ -195,12 +193,10 @@ node('linux') {
} catch (error) { } catch (error) {
if (manager.build.getAction(InterruptedBuildAction.class) || if (manager.build.getAction(InterruptedBuildAction.class) ||
(error instanceof org.jenkinsci.plugins.workflow.steps.FlowInterruptedException && error.causes.size() == 0)) { (error instanceof org.jenkinsci.plugins.workflow.steps.FlowInterruptedException && error.causes.size() == 0)) {
println("User abort. No error!") echo 'User abort. No error!'
currentBuild.result = "ABORTED"
} }
else else
{ {
currentBuild.result = "FAILURE"
throw error throw error
} }
} finally { } finally {
@@ -243,12 +239,10 @@ node('linux') {
} catch (error) { } catch (error) {
if (manager.build.getAction(InterruptedBuildAction.class) || if (manager.build.getAction(InterruptedBuildAction.class) ||
(error instanceof org.jenkinsci.plugins.workflow.steps.FlowInterruptedException && error.causes.size() == 0)) { (error instanceof org.jenkinsci.plugins.workflow.steps.FlowInterruptedException && error.causes.size() == 0)) {
println("User abort. No error!") echo 'User abort. No error!'
currentBuild.result = "ABORTED"
} }
else else
{ {
currentBuild.result = "FAILURE"
throw error throw error
} }
} finally { } finally {
@@ -256,7 +250,6 @@ node('linux') {
} }
} }
def abortPreviousRunningBuilds() { def abortPreviousRunningBuilds() {
def pname = env.JOB_NAME.split('/')[0] def pname = env.JOB_NAME.split('/')[0]