Last active
December 19, 2015 01:19
-
-
Save ysb33r/5875095 to your computer and use it in GitHub Desktop.
An example of a more complex build flow in Jenkins.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def partitions=6 | |
def testResults | |
def buildResult | |
def staticAnalysisResult | |
def smokeTestResult | |
def performanceResult | |
def buildFlow= { buildResult= build( 'BUILDER' ) } | |
def performanceFlow= { performanceResult = build('PERFORMANCE')} | |
def staticAnalysisFlow= { staticAnalysisResult= build( 'STATIC_ANALYSIS' ) } | |
def smokeTestFlow= { | |
smokeTestResult= build ( | |
'TEST_PARTITION', | |
SOURCE_JOB : 'BUILDER', | |
SOURCE_BUILD_NUMBER : buildResult.build.number, | |
PARTITON : "smoke" | |
) | |
} | |
def testFlow= { | |
TestResults= parallel( | |
(1..partitions).collect { ctr -> | |
return { | |
ignore(UNSTABLE) { | |
build ( | |
'TEST_PARTITION', | |
SOURCE_JOB : 'BUILDER', | |
SOURCE_BUILD_NUMBER : buildResult.build.number, | |
PARTITION : "${ctr}/${partitions}" | |
) | |
} | |
} | |
} | |
) | |
} | |
def functionalTestFlow = { [ smokeTestFlow, testFlow ].each {it()} } | |
def mainFlow = { | |
[ buildFlow, | |
{ parallel( functionalTestFlow, performanceFlow ) } | |
].each { it() } | |
} | |
parallel ( | |
mainFlow, | |
staticAnalysisFlow | |
) | |
def testBuildNumbers= [smokeTestResult.build.number] | |
if(testResults) { | |
testBuildNumbers+= testResults.collect { c -> | |
c.lastBuild.build.number | |
} | |
} | |
build ( | |
'COLLECTOR', | |
TEST_JOB_NAME : 'TEST_PARTITION', | |
TEST_BUILD_NUMBERS : testBuildNumbers.join(','), | |
SA_JOB_NAME : staticAnalysisResult.name, | |
SA_BUILD_NUMBER : staticAnalysisResult.build.number, | |
BUILDER_JOB_NAME : buildResult.name, | |
BUILDER_BUILD_NUMBER : buildResult.build.number, | |
PERF_JOB_NAME : performanceResult.name, | |
PERF_BUILD_NUMBER : performanceResult.build.number | |
) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment