#!groovy // For skipping stages import org.jenkinsci.plugins.pipeline.modeldefinition.Utils // Global for the stage name StageName = '' // wrapper around stage declaretion to be more verbose // and allow showing as skipped in the UI def build_stage(String name, boolean run, Closure block ) { StageName = name echo " -------- ${StageName} -------- " if(run) { stage(name, block) } else { stage(name) { Utils.markStageSkippedForConditional(STAGE_NAME) } } }