[Elastic-Agent] Do not use unversioned home with watcher binary path#25423
Conversation
|
Pinging @elastic/ingest-management (Team:Ingest Management) |
|
Pinging @elastic/agent (Team:Agent) |
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
Trends 🧪💚 Flaky test reportTests succeeded. Expand to view the summary
Test stats 🧪
|
|
@blakerouse should i do this or should we move binary/create symlink in the setPath func |
ruflin
left a comment
There was a problem hiding this comment.
@michalpristas Can you reference the issue this is coming from?
|
|
||
| func invokeCmd() *exec.Cmd { | ||
| homeExePath := filepath.Join(paths.Home(), agentName) | ||
| func invokeCmd(topPath string) *exec.Cmd { |
There was a problem hiding this comment.
I saw the name topPath in the past? What does it exactly mean?
There was a problem hiding this comment.
with the structure we have topPath is the top of agent directory structure e.g. /etc/Elastic/Agent
we also use a homePath which points to a home of a certain agent version e.g /etc/Elastic/Agent/data/elastic-agent-abc123/
|
As a follow up, we should start to think on how we can test these things in an automated way. |
|
The only time unversioned path is used is in the container. Self-upgrade is not supported in the container anyway, so could we just disable the watcher completely instead? |
blakerouse
left a comment
There was a problem hiding this comment.
This change does seem okay and should still go in.
But related to my previous comment, when will the watcher run in a container?
|
@blakerouse it will not, the only case when it's running is when specifically told to using DEV flag [allowUpgrade part] |
What does this PR do?
The problem is when agent tries to invoke watcher which checks upgraded agent for failures and at the same time unversioned home path is set.
Usually agent took its home path which is
{top_path}/data/elastic-agent-{hash}/elastic-agentand invokedwatchsub-command on binary at that path.When unversioned path is set it tries to run watcher from
{top_path}/data/elastic-agentand as so it results in binary not found.Fixes: #25371
Why is it important?
Reduce noise created by failng attempt to run this. This is just a case when running
containersub-command which tempers paths.Checklist
CHANGELOG.next.asciidocorCHANGELOG-developer.next.asciidoc.cc @michel-laterman