1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-11-28 08:49:44 +02:00

fix(cpe): add more null checks (#2913)

This commit is contained in:
Kevin Stiehl 2021-06-16 18:04:37 +02:00 committed by GitHub
parent ff507b959e
commit a03be973bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -6,8 +6,8 @@ import groovy.transform.Field
void call(Map parameters = [:]) {
final script = checkScript(this, parameters) ?: this
String piperGoPath = parameters.piperGoPath ?: './piper'
String piperGoPath = parameters?.piperGoPath ?: './piper'
def output = script.sh(returnStdout: true, script: "${piperGoPath} readPipelineEnv")
Map cpeMap = script.readJSON(text: output)
script.commonPipelineEnvironment.setCPEMap(script, cpeMap)
script?.commonPipelineEnvironment?.setCPEMap(script, cpeMap)
}

View File

@ -5,8 +5,8 @@ import groovy.transform.Field
void call(Map parameters = [:]) {
final script = checkScript(this, parameters) ?: this
String piperGoPath = parameters.piperGoPath ?: './piper'
Map cpe = script.commonPipelineEnvironment.getCPEMap(script)
String piperGoPath = parameters?.piperGoPath ?: './piper'
Map cpe = script?.commonPipelineEnvironment?.getCPEMap(script)
if (cpe == null) {
return
}
@ -18,4 +18,7 @@ EOF
"""
def output = script.sh(returnStdout: true, script: writePipelineEnvCommand)
if (parameters?.verbose) {
script.echo("wrote commonPipelineEnvironment: ${output}")
}
}