@@ -300,6 +300,7 @@ String getScriptOutput(String script, String args='') {
300300 */
301301Boolean runStage (Map params = [:], Map pragmas = [:], Boolean otherCondition = true ) {
302302 // Run stage w/o any conditionals
303+ println (" [${ env.STAGE_NAME} ] Determining if stage should be run (params: ${ params} , pragmas: ${ pragmas} , otherCondition: ${ otherCondition} )" )
303304 if (params. isEmpty() && pragmas. isEmpty()) {
304305 return true
305306 }
@@ -309,40 +310,23 @@ Boolean runStage(Map params=[:], Map pragmas=[:], Boolean otherCondition=true) {
309310 }
310311
311312 String skipMsgParams = ' '
312- params . find { key , value ->
313- println (" Checking parameter ${ key} for value ${ value} : ${ paramsValue(key, value)} " )
314- if (paramsValue(key, value) != value) {
315- skipMsgParams = " Skipping stage due to ${ key} parameter not set to ${ value} "
316- return true
313+ for (entry in params) {
314+ println (" [ ${ env.STAGE_NAME } ] Checking parameter ${ entry. key} for value ${ entry. value} : ${ paramsValue(entry. key, entry. value)} " )
315+ if (paramsValue(entry . key, entry . value) != entry . value) {
316+ skipMsgParams = " Skipping stage due to ${ entry. key} parameter not set to ${ entry. value} "
317+ break
317318 }
318- false
319319 }
320- // for(entry in params) {
321- // println("Checking parameter ${entry.key} for value ${entry.value}: ${paramsValue(entry.key, entry.value)}")
322- // if (paramsValue(entry.key, entry.value) != entry.value) {
323- // skipMsgParams = "Skipping stage due to ${entry.key} parameter not set to ${entry.value}"
324- // break
325- // }
326- // }
327320
328321 String skipMsgPragmas = ' '
329- pragmas . find { key , value ->
330- String expected = value. toString(). toLowerCase()
331- println (" Checking pragma ${ key} for value ${ expected} : ${ cachedCommitPragma(key, expected).toLowerCase()} " )
332- if (cachedCommitPragma(key, expected). toLowerCase() != expected) {
333- skipMsgPragmas = " Skipping stage due to ${ key} pragma not set to ${ expected } "
334- return true
322+ for (entry in pragmas) {
323+ String expected = entry . value. toString(). toLowerCase()
324+ println (" [ ${ env.STAGE_NAME } ] Checking pragma ${ entry. key} for value ${ expected} : ${ cachedCommitPragma(entry. key, expected).toLowerCase()} " )
325+ if (cachedCommitPragma(entry . key, expected). toLowerCase() != expected) {
326+ skipMsgPragmas = " Skipping stage due to ${ entry. key} pragma not set to ${ entry.value } "
327+ break
335328 }
336- false
337329 }
338- // for(entry in pragmas) {
339- // String expected = entry.value.toString().toLowerCase()
340- // println("Checking pragma ${entry.key} for value ${expected}: ${cachedCommitPragma(entry.key, expected).toLowerCase()}")
341- // if (cachedCommitPragma(entry.key, expected).toLowerCase() != expected) {
342- // skipMsgPragmas = "Skipping stage due to ${entry.key} pragma not set to ${entry.value}"
343- // break
344- // }
345- // }
346330
347331 if (startedByUser()) {
348332 // Manual build: check parameters first
@@ -372,6 +356,29 @@ Boolean runStage(Map params=[:], Map pragmas=[:], Boolean otherCondition=true) {
372356 return true
373357}
374358
359+ /**
360+ * runBuildStage
361+ *
362+ * Determine if the build stage should be run.
363+ *
364+ * @param kwargs Map containing the following arguments
365+ * distro the shorthand distro name
366+ * compiler the compiler to use; defaults to 'gcc'
367+ */
368+ Boolean runBuildStage (String distro , String compiler = ' gcc' ) {
369+ Map params = [" CI_BUILD_${ distro.toUpperCase()} " : true ,
370+ ' CI_RPM_TEST_VERSION' : ' ' ]
371+ Map pragmas = [' build' : ' true' ]
372+ if (distro && compiler) {
373+ pragmas[" build-${ distro} -${ compiler} " ] = ' true'
374+ }
375+ else if (distro) {
376+ pragmas[" build-${ distro} " ] = ' true'
377+ }
378+ Boolean otherCondition = true
379+ return runStage(params, pragmas, otherCondition)
380+ }
381+
375382/**
376383 * scriptedBuildStage
377384 *
@@ -383,7 +390,7 @@ Boolean runStage(Map params=[:], Map pragmas=[:], Boolean otherCondition=true) {
383390 * rpmDistro the distro to use for rpm building; defaults to distro
384391 * compiler the compiler to use; defaults to 'gcc'
385392 * runCondition optional condition to determine if the stage should run; defaults
386- * to !skip_build_stage (distro, compiler)
393+ * to runBuildStage (distro, compiler)
387394 * buildRpms whether or not to build rpms; defaults to true
388395 * release the DAOS RPM release value to use; defaults to env.DAOS_RELVAL
389396 * dockerBuildArgs optional docker build arguments
@@ -398,7 +405,7 @@ def scriptedBuildStage(Map kwargs = [:]) {
398405 String distro = kwargs. get(' distro' , ' el8' )
399406 String rpmDistro = kwargs. get(' rpmDistro' , distro)
400407 String compiler = kwargs. get(' compiler' , ' gcc' )
401- Boolean runCondition = kwargs. get(' runCondition' , ! skip_build_stage (distro, compiler))
408+ Boolean runCondition = kwargs. get(' runCondition' , runBuildStage (distro, compiler))
402409 Boolean buildRpms = kwargs. get(' buildRpms' , true )
403410 String release = kwargs. get(' release' , env. DAOS_RELVAL )
404411 String dockerBuildArgs = kwargs. get(' dockerBuildArgs' , ' ' )
@@ -488,6 +495,7 @@ def scriptedUnitTestStage(Map kwargs = [:]) {
488495 if (runCondition) {
489496 node(nodeLabel) {
490497 try {
498+ println (" [${ name} ] Check out from version control" )
491499 checkoutScm(pruneStaleBranch : true )
492500 // Execute the unit test
493501 job_step_update(unitTest(unitTestArgs))
@@ -887,7 +895,7 @@ pipeline {
887895 // failFast true
888896 when {
889897 beforeAgent true
890- expression { ! skip_build_stage () }
898+ expression { runBuildStage () }
891899 }
892900 steps {
893901 script {
@@ -962,7 +970,7 @@ pipeline {
962970 name : ' Build on Leap 15.5 with Intel-C and TARGET_PREFIX' ,
963971 distro :' leap15' ,
964972 compiler : ' icc' ,
965- runCondition : ! skip_build_stage (' leap15_icc' ),
973+ runCondition : runBuildStage (' leap15_icc' ),
966974 buildRpms : false ,
967975 release : env. DAOS_RELVAL ,
968976 dockerBuildArgs : dockerBuildArgs(repo_type : ' stable' ,
@@ -984,7 +992,7 @@ pipeline {
984992 name : ' Build on EL 8.8 with Bullseye' ,
985993 distro :' el8' ,
986994 compiler : ' covc' ,
987- runCondition : ! skip_build_stage (' bullseye' , ' covc' ) && code_coverage_enabled(),
995+ runCondition : runBuildStage (' bullseye' , ' covc' ) && code_coverage_enabled(),
988996 buildRpms : true ,
989997 release : " ${ env.DAOS_RELVAL} .bullseye" ,
990998 dockerBuildArgs : dockerBuildArgs(repo_type : ' stable' ,
@@ -1098,8 +1106,8 @@ pipeline {
10981106 name : ' NLT server leaks' ,
10991107 qualityGates : [[threshold : 1 , type : ' TOTAL' , unstable : true ]],
11001108 tool : issues(pattern : ' nlt-server-leaks.json' ,
1101- name : ' NLT server results' ,
1102- id : ' NLT_server' ),
1109+ name : ' NLT server results' ,
1110+ id : ' NLT_server' ),
11031111 scm : ' daos-stack/daos'
11041112 job_status_update()
11051113 }
@@ -1224,15 +1232,6 @@ pipeline {
12241232 always_script : ' ci/unit/test_nlt_post.sh' ,
12251233 compiler : ' covc' ,
12261234 NLT : true
1227- recordIssues enabledForFailure : true ,
1228- failOnError : false ,
1229- ignoreQualityGate : true ,
1230- name : ' NLT server leaks' ,
1231- qualityGates : [[threshold : 1 , type : ' TOTAL' , unstable : true ]],
1232- tool : issues(pattern : ' nlt-server-leaks.json' ,
1233- name : ' NLT server results' ,
1234- id : ' NLT_server' ),
1235- scm : ' daos-stack/daos'
12361235 job_status_update()
12371236 }
12381237 }
0 commit comments