This commit is contained in:
Jim Nicholson 2024-02-01 02:10:31 -08:00
parent 263ee996ec
commit 6573134d26

View File

@ -4,18 +4,21 @@ import groovy.transform.Field
@Field
Map defaults = [
saveArtifaces: false,
buildTest: 'Makefile',
buildCmd: 'make all'
]
def call(Map config = [:]) {
assert config.artifacts : 'must specify artifacts!'
Map runConfig = defaults + config
if (runConfig.saveArtifacts) {
assert config.artifacts : 'Error: saveArtifacts is set to true; must specify artifacts!'
}
if ( fileExists(runConfig.buildTest)) {
sh """
${runConfig.buildCmd}
"""
} else {
echo "Skipping buildStep since ${runConfig.buildTest} does not exist in workspace."
error("ERROR: File ${runConfig.buildTest} does not exist in workspace.")
}
}