-
Notifications
You must be signed in to change notification settings - Fork 154
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
Allow users to specify base path with elastic-agent install
#2500
Conversation
🌐 Coverage report
|
e47bb32
to
e09b799
Compare
5d48b77
to
3886be1
Compare
3886be1
to
7423dd2
Compare
7423dd2
to
09a1495
Compare
b316812
to
09a1495
Compare
1852e7c
to
c3b4a1a
Compare
elastic-agent install
elastic-agent install
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.
I have read through this PR and was surprise on how mechanical most of the changes are, which is great to see and makes me feel some what better about us having the support this as a team.
There is a key question that is inline that we need to verify and understand what it means with changing the results of the RunningInstalled
function.
I have not tested this either and with a change like this I really want to have time to build locally and test it.
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.
Lets go with what you have with the .installed
file, you have talked me into it. ;-)
Overall most of the changes are mechanical and I am happy with how this turned out and looks. Honestly thought it would have been a lot worse.
Hi Team, We have created 12 testcases for this feature under Fleet test suite at links:
Below testcases will be executed after 8.8.0 release:
Further testcases for the agent installation without the Known limitations:
Please let us know if we are missing any scenario to be covered here. Thanks! |
Hi Team, Status:
Build details: As the testing is completed on this feature, we are marking this as QA:Validated. Please let us know if anything else is required from our end. |
What does this PR do?
This PR allows users to specify a new option,
--base-path <custom-base-path>
with theelastic-agent install
command. An Elastic Agent that's installed with this option will be installed under<custom-base-path>/Elastic/Agent
(Linux/MacOS) or<custom-base-path>\Elastic\Agent
(Windows).For example, on Linux, the default base path where Elastic Agent is installed is
/opt
. Thus, Elastic Agent's files get installed under/opt/Elastic/Agent
. However, with the enhancement in this PR, if a user runselastic-agent install --basepath /foo/bar
, Elastic Agent's files will be installed under/foo/bar/Elastic/Agent
.The thinking behind the implementation is as follows:
install
sub-command code path, thetopPath
— the path to the root folder where Elastic Agent's files are installed — is determined dynamically by combining the given--base-path
andElastic/Agent
(on Linux/Mac) orElastic\Agent
(on Windows). The default value of--base-path
is OS-specific:/Library
for Mac,/opt
for Linux, andC:\Program Files
for Windows.topPath
is determined from the running executable's path. This makes it irrelevant whichtopPath
was used at installation time or how to "persist" it across restarts and upgrades.Why is it important?
This enhancement allows users to install Elastic Agent under a different base path than the default one for their OS, to be compliant with requirements in certain organizations.
Checklist
I have made corresponding change to the default configuration files./changelog/fragments
using the changelog toolI have added an integration test or an E2E testTODO in follow up PR: Create integration or E2E test for testing custom installation base paths #2524How to test this PR locally
There are several scenarios to test with this change, detailed below.
For each scenario MacOS + Apple Silicon is assumed so please make the necessary adjustments for your test platform.
Install Elastic Agent into custom base path
Uninstall Elastic Agent to start with clean slate.
Build Elastic Agent package from this PR.
Install Elastic Agent into custom base path.
Check that Elastic Agent files are installed under custom base path.
tree
installed:Check that symlink is correctly created (MacOS and Linux only).
Check that
version
andstatus
subcommands work and return expected results.Uninstall Elastic Agent.
Check that Elastic Agent files are removed from custom base path.
Install Elastic Agent into custom base path and upgrade it
Uninstall Elastic Agent to start with clean slate.
Build Elastic Agent package from this PR.
Install Elastic Agent into custom base path.
Note the installed Elastic Agent's version, particularly the SHA.
Note the installed Elastic Agent's status, particularly the number of components running and their PIDs.
Add a no-op commit (e.g. whitespace-only change) and rebuild Elastic Agent package so we have a new version.
Note the commit SHA of the latest commit.
Upgrade the installed Elastic Agent to the new one you just built.
Check that upgraded Elastic Agent files are installed under custom base path.
tree
installed:Check that symlink is still correct (MacOS and Linux only).
Check the installed Elastic Agent's version, particularly the SHA, and ensure that a) it's different from the previously installed Elastic Agent's SHA from step 4 and b) it corresponds to the SHA of the latest commit from step 6.
Check the installed Elastic Agent's status, particularly the number of components running and their PIDs, and ensure that the number of components is the same as before (from step 5) but their PIDs have changed.
Uninstall Elastic Agent.
Check that Elastic Agent files are removed from custom base path.
Cleanup: make sure to remove the test commit.
Install Elastic Agent into custom base path and check that diagnostics work
Uninstall Elastic Agent to start with clean slate.
Build Elastic Agent package from this PR.
Install Elastic Agent into custom base path.
Gather Elastic Agent diagnostics and check that they are as expected, particularly the
path
s in thevariables.yaml
andpre-config.yaml
files.Install Elastic Agent into default base path (regression test)
Uninstall Elastic Agent to start with clean slate.
Build Elastic Agent package from this PR.
Install Elastic Agent into the default base path.
Check that Elastic Agent files are installed under default base path.
tree
installed:Check that symlink is correctly created (MacOS and Linux only).
Check that
version
andstatus
subcommands work and return expected results.Uninstall Elastic Agent.
Check that Elastic Agent files are removed from default base path.
Install Elastic Agent into default base path and upgrade it (regression test)
Uninstall Elastic Agent to start with clean slate.
Build Elastic Agent package from this PR.
Install Elastic Agent into custom base path.
Note the installed Elastic Agent's version, particularly the SHA.
Note the installed Elastic Agent's status, particularly the number of components running and their PIDs.
Add a no-op commit (e.g. whitespace-only change) and rebuild Elastic Agent package so we have a new version.
Note the commit SHA of the latest commit.
Upgrade the installed Elastic Agent to the new one you just built.
Check that upgraded Elastic Agent files are installed under custom base path.
tree
installed:Check that symlink is still correct (MacOS and Linux only).
Check the installed Elastic Agent's version, particularly the SHA, and ensure that a) it's different from the previously installed Elastic Agent's SHA from step 4 and b) it corresponds to the SHA of the latest commit from step 6.
Check the installed Elastic Agent's status, particularly the number of components running and their PIDs, and ensure that the number of components is the same as before (from step 5) but their PIDs have changed.
Uninstall Elastic Agent.
Check that Elastic Agent files are removed from custom base path.
Cleanup: make sure to remove the test commit.
Run Elastic Agent in container (regression test)
Build Elastic Agent Docker image from this PR.
Run Elastic Agent Docker container.
Check that Elastic Agent files are installed under default base path within the container.
Check that
version
andstatus
subcommands work and return expected results.Cleanup: stop the Elastic Agent Docker container.
Run Elastic Agent without installing it (regression test)
Build Elastic Agent package from this PR.
Run Elastic Agent.
Check that
version
andstatus
subcommands work and return expected results.