File tree 1 file changed +14
-11
lines changed
1 file changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -6,20 +6,23 @@ import groovy.transform.Field
6
6
void call (Map parameters = [:]) {
7
7
final script = checkScript(this , parameters) ?: this
8
8
String piperGoPath = parameters?. piperGoPath ?: ' ./piper'
9
- Map cpe = script?. commonPipelineEnvironment?. getCPEMap(script)
10
- if (cpe == null ) {
11
- return
9
+ String command = " ${ piperGoPath} writePipelineEnv"
10
+
11
+ if (parameters. value) {
12
+ command + = " --value '${ parameters.value} '"
12
13
}
14
+ Map cpe = script?. commonPipelineEnvironment?. getCPEMap(script)
15
+ if (cpe == null ) return
13
16
14
17
def jsonMap = groovy.json.JsonOutput . toJson(cpe)
15
- if (piperGoPath && jsonMap) {
16
- withEnv([" PIPER_pipelineEnv=${ jsonMap} " ]) {
17
- def output = script. sh(returnStdout : true , script : " ${ piperGoPath} writePipelineEnv" )
18
- if (parameters?. verbose) {
19
- script. echo(" wrote commonPipelineEnvironment: ${ output} " )
20
- }
18
+ if (! jsonMap) {
19
+ script. echo(" can't write pipelineEnvironment: empty environment" )
20
+ return
21
+ }
22
+ withEnv([" PIPER_pipelineEnv=${ jsonMap} " ]) {
23
+ def output = script. sh(returnStdout : true , script : command)
24
+ if (parameters?. verbose) {
25
+ script. echo(" wrote commonPipelineEnvironment: ${ output} " )
21
26
}
22
- } else {
23
- script. echo(" can't write pipelineEnvironment: piperGoPath: ${ piperGoPath} piperEnvironment ${ jsonMap} " )
24
27
}
25
28
}
You can’t perform that action at this time.
0 commit comments