Skip to content

Testclusters: implement support to install plugins#39116

Merged
alpar-t merged 7 commits intoelastic:masterfrom
alpar-t:testclusters-install-plugin
Mar 4, 2019
Merged

Testclusters: implement support to install plugins#39116
alpar-t merged 7 commits intoelastic:masterfrom
alpar-t:testclusters-install-plugin

Conversation

@alpar-t
Copy link
Copy Markdown
Contributor

@alpar-t alpar-t commented Feb 19, 2019

This change extends the DSL and implements calling the commands to install plugins.
The plugin install dir is not configurable, for this reason we have to sync the working dir.
This fixes some other issues for which the plugin was muted and thus closes #37889.
Since the test was muted, some changes around distribution name are also required,
so there are some change in this PR that don't relate directly, but I didn't want to add new functionality without enabling the test.

@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-core-infra

}

public void loggedExec(Action<ExecSpec> action) {
LoggedExec.exec(project, action);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method should really not even be part of LoggedExec. Perhaps better to just move all that stuff directly into it's own class, or even GradleServicesAdapter.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intent was to eliminate uses of LoggedExec as a task and keeps the methods only.
I agree there's opportunity for cleanup and improvement here, but wouldn't want to do it in this PR.

config.put("cluster.initial_master_nodes", "[" + nodeName + "]");
}
try {
Files.delete(configFile);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've seen a number of instances of us creating big strings in memory. LoggedExec is another, more problematic instance of this. Individually, these are not big issues but we need to be careful about this stuff as the build becomes more complex, and we rely more on the daemon, memory pressure will become an issue. We should try and keep this in mind and prefer streaming this stuff when possible.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoggedExec is a special case. We could redirect output to files, but most of the exec calls are tiny invocations, so the I/O overhead to disk is much more than writing into the heap. But I agree here we should consider writing the file through a stream instead of building up in a String.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. If it hasn't been problematic yet it may just not be an issue. We still have a situation where a bad execution could potentially create a load of output that blows out the heap. We could pretty simply put some safeguards here to ensure the output doesn't exceed some configured threshold and truncate if it does. Separate discussion 😄

Copy link
Copy Markdown
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good, a few comments

}
private void createWorkingDir(Path distroExtractDir) throws IOException {
services.sync(spec -> {
spec.from(distroExtractDir.toFile());
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In ClusterFormationTasks, we always have a fresh directory we extract into. This isn't great for build performance, but it means we don't have any possiblity of old stuff being used. From a reproducibility perspective, I think we should wipe the data/logs/temp dirs here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, sync() does exactly this. In contrast to copy() a sync first deletes the target folder before performing the copy.

config.put("cluster.initial_master_nodes", "[" + nodeName + "]");
}
try {
Files.delete(configFile);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to delete the config file when it is written below this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed it, it's an oversight.

config.put("cluster.initial_master_nodes", "[" + nodeName + "]");
}
try {
Files.delete(configFile);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoggedExec is a special case. We could redirect output to files, but most of the exec calls are tiny invocations, so the I/O overhead to disk is much more than writing into the heap. But I agree here we should consider writing the file through a stream instead of building up in a String.

@alpar-t
Copy link
Copy Markdown
Contributor Author

alpar-t commented Feb 26, 2019

@mark-vieira @rjernst ready for another review

@alpar-t alpar-t merged commit f8122b5 into elastic:master Mar 4, 2019
@alpar-t alpar-t deleted the testclusters-install-plugin branch March 4, 2019 07:14
alpar-t added a commit that referenced this pull request Mar 4, 2019
* methods to run bin script
* Add support for specifying and installing plugins
* Add OS specific distirbution support
* Add test to verify plugin installed
* Remove use of Gradle internal OperatingSystem
alpar-t added a commit that referenced this pull request Mar 4, 2019
* methods to run bin script
* Add support for specifying and installing plugins
* Add OS specific distirbution support
* Add test to verify plugin installed
* Remove use of Gradle internal OperatingSystem
@alpar-t alpar-t removed the v6.7.0 label Mar 4, 2019
@mark-vieira mark-vieira added the Team:Delivery Meta label for Delivery team label Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Delivery/Build Build or test infrastructure >non-issue Team:Delivery Meta label for Delivery team v7.0.0-rc2 v7.2.0 v8.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TestClustersPluginIT fails with connection errors

5 participants