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