Skip to content

Commit 807fc47

Browse files
author
Sergei Parshev
committed
JENKINS-59911 Chained assignment is not working in pipeline
Found that groovy in pipeline is not supporting the chained assignment. In tests it's working well, but in pipeline value becomes null. Get the details here: https://issues.jenkins-ci.org/browse/JENKINS-59911
1 parent 48df9be commit 807fc47

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/com/griddynamics/devops/mpl/MPLConfig.groovy

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,10 @@ public class MPLConfig implements Map, Serializable {
158158
else
159159
throw new MPLException("Invalid config key path '${key_list[i-1] = '<'+key_list[i-1]+'>'; key_list.join('.')}': marked key value type '${parent?.getClass()}' is not suitable to set the nested variable")
160160

161-
if( value == null )
162-
value = parent[key] = [:]
161+
if( value == null ) {
162+
parent[key] = [:]
163+
value = parent[key]
164+
}
163165
}
164166

165167
parent[key] = val

0 commit comments

Comments
 (0)