Skip to content

Commit d26c8b5

Browse files
authored
Evaluate settings values before passing it to task closure (#26243)
The secure settings tool reads from stdIn and we use a closure to provide a value for this. Yet, we evaluate they value too late and end up with the last provided value for all keys.
1 parent cfad668 commit d26c8b5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,9 @@ class ClusterFormationTasks {
351351
String key = entry.getKey()
352352
String name = taskName(parent, node, 'addToKeystore#' + key)
353353
Task t = configureExecTask(name, project, parentTask, node, esKeystoreUtil, 'add', key, '-x')
354+
String settingsValue = entry.getValue() // eval this early otherwise it will not use the right value
354355
t.doFirst {
355-
standardInput = new ByteArrayInputStream(entry.getValue().getBytes(StandardCharsets.UTF_8))
356+
standardInput = new ByteArrayInputStream(settingsValue.getBytes(StandardCharsets.UTF_8))
356357
}
357358
parentTask = t
358359
}

0 commit comments

Comments
 (0)