pipelineUtils/vars/buildStep.groovy
2024-02-01 01:40:36 -08:00

22 lines
477 B
Groovy

#!/usr/bin/env groovy
import groovy.transform.Field
@Field
Map defaults = [
buildTest: 'Makefile',
buildCmd: 'make all'
]
def call(Map config = [:]) {
assert config.artifacts : 'must specify artifacts!'
String runConfig = defaults + config
if ( fileExists(runConfig.buildTest)) {
sh """
${runConfig.buildCmd}
"""
} else {
echo "Skipping buildStep since ${runConfig.buildTest} does not exist in workspace."
}
}