1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-01-18 05:18:24 +02:00

build new config on the fly

This commit is contained in:
Christopher Fenner 2018-07-04 11:12:32 +02:00 committed by GitHub
parent 232705f58c
commit af753d3c54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,15 @@ import groovy.transform.Field
import groovy.text.SimpleTemplateEngine
@Field String STEP_NAME = 'newmanExecute'
@Field Set STEP_CONFIG_KEYS = ['dockerImage','failOnError','newmanCollection','newmanEnvironment','newmanGlobals','newmanRunCommand','testRepository']
@Field Set STEP_CONFIG_KEYS = [
'dockerImage',
'failOnError',
'newmanCollection',
'newmanEnvironment',
'newmanGlobals',
'newmanRunCommand',
'testRepository'
]
@Field Set PARAMETER_KEYS = STEP_CONFIG_KEYS
def call(Map parameters = [:]) {
@ -29,9 +37,10 @@ def call(Map parameters = [:]) {
) {
sh "npm install newman --global --quiet"
for(String collection : collectionList){
config.newmanCollection = collection
// resolve templates
def command = SimpleTemplateEngine.newInstance().createTemplate(config.newmanRunCommand).make([config: config]).toString()
def command = SimpleTemplateEngine.newInstance()
.createTemplate(config.newmanRunCommand)
.make([config: config.plus(newmanCollection: collection)]).toString()
sh "newman ${command}${config.failOnError?'':' --suppress-exit-code'}"
}
}