-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Setup keystore during integration tests #22966
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
d2f75e7
1a767bf
ebca91f
88a10e9
1174ab9
7dd4d7e
7d1c40e
27ed1f8
08c1b64
20881b5
67b4163
a6958e6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,6 +38,7 @@ import org.gradle.api.tasks.Copy | |
| import org.gradle.api.tasks.Delete | ||
| import org.gradle.api.tasks.Exec | ||
|
|
||
| import java.nio.charset.StandardCharsets | ||
| import java.nio.file.Paths | ||
| import java.util.concurrent.TimeUnit | ||
|
|
||
|
|
@@ -164,6 +165,8 @@ class ClusterFormationTasks { | |
| setup = configureStopTask(taskName(task, node, 'stopPrevious'), project, setup, node) | ||
| setup = configureExtractTask(taskName(task, node, 'extract'), project, setup, node, configuration) | ||
| setup = configureWriteConfigTask(taskName(task, node, 'configure'), project, setup, node, seedNode) | ||
| setup = configureCreateKeyStoreTask(taskName(task, node, 'createKeyStore'), project, setup, node) | ||
| setup = configureAddKeyStoreTasks(task, project, setup, node) | ||
| if (node.config.plugins.isEmpty() == false) { | ||
| if (node.nodeVersion == VersionProperties.elasticsearch) { | ||
| setup = configureCopyPluginsTask(taskName(task, node, 'copyPlugins'), project, setup, node) | ||
|
|
@@ -306,6 +309,32 @@ class ClusterFormationTasks { | |
| } | ||
| } | ||
|
|
||
| /** Adds a task to create keystore */ | ||
| static Task configureCreateKeyStoreTask(String name, Project project, Task setup, NodeInfo node) { | ||
|
||
| File esKeyStoreUtil = Paths.get(node.homeDir.toString(), "bin/" + "elasticsearch-keystore").toFile() | ||
| Task createKeyStore = project.tasks.create(name: name, type: LoggedExec, dependsOn: setup) { | ||
|
||
| commandLine esKeyStoreUtil, 'create' | ||
| } | ||
| } | ||
|
|
||
| /** Adds tasks to add to keystore */ | ||
|
||
| static Task configureAddKeyStoreTasks(Task parent, Project project, Task setup, NodeInfo node) { | ||
|
||
| Map kvs = node.config.keyStoreSetting | ||
| File esKeyStoreUtil = Paths.get(node.homeDir.toString(), "bin/" + "elasticsearch-keystore").toFile() | ||
| Task parentTask = setup | ||
| for (Map.Entry<String, String> entry in kvs) { | ||
| String key = entry.getKey() | ||
| Task t = project.tasks.create(name: taskName(parent, node, 'addToKeyStore#' + key), type: LoggedExec, dependsOn: parentTask) { | ||
| commandLine esKeyStoreUtil, 'add', key, '-x' | ||
| } | ||
| t.doFirst { | ||
| standardInput = new ByteArrayInputStream(entry.getValue().getBytes(StandardCharsets.UTF_8)) | ||
| } | ||
| parentTask = t | ||
| } | ||
| return parentTask | ||
| } | ||
|
|
||
| static Task configureExtraConfigFilesTask(String name, Project project, Task setup, NodeInfo node) { | ||
| if (node.config.extraConfigFiles.isEmpty()) { | ||
| return setup | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plural please? Also, just for consistency with the code in ES, can we use all lower case for keystore, so
keystoreSettings?