2021-06-15 14:34:56 +02:00
|
|
|
import static com.sap.piper.Prerequisites.checkScript
|
|
|
|
import groovy.transform.Field
|
|
|
|
|
|
|
|
@Field def STEP_NAME = getClass().getName()
|
|
|
|
|
|
|
|
void call(Map parameters = [:]) {
|
|
|
|
final script = checkScript(this, parameters) ?: this
|
2021-06-16 18:04:37 +02:00
|
|
|
String piperGoPath = parameters?.piperGoPath ?: './piper'
|
|
|
|
Map cpe = script?.commonPipelineEnvironment?.getCPEMap(script)
|
2021-06-15 18:42:04 +02:00
|
|
|
if (cpe == null) {
|
2021-06-15 14:34:56 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2021-06-18 11:00:59 +02:00
|
|
|
def jsonMap = groovy.json.JsonOutput.toJson(cpe)
|
|
|
|
if (piperGoPath && jsonMap) {
|
|
|
|
withEnv(["PIPER_pipelineEnv=${jsonMap}"]) {
|
|
|
|
def output = script.sh(returnStdout: true, script: "${piperGoPath} writePipelineEnv")
|
|
|
|
if (parameters?.verbose) {
|
|
|
|
script.echo("wrote commonPipelineEnvironment: ${output}")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
script.echo("can't write pipelineEnvironment: piperGoPath: ${piperGoPath} piperEnvironment ${jsonMap}")
|
2021-06-16 18:04:37 +02:00
|
|
|
}
|
2021-06-15 14:34:56 +02:00
|
|
|
}
|