Cherry-pick #21425 to 7.x: [Elastic Agent] Add upgrade CLI to initiate upgrade of Agent locally #21542
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Cherry-pick of PR #21425 to 7.x branch. Original message:
What does this PR do?
Adds a new
upgrade
CLI command that communicates with the running Elastic Agent to perform self-upgrading. This also allows a local upgrade to a new build using the--source-uri file://${path}
command line flag.Why is it important?
To allow upgrading of the installed Elastic Agent, as well as to help with testing the upgrade process because of the allowed
file://
prefix in the--source-uri
.Checklist
[ ] I have made corresponding changes to the documentation[ ] I have made corresponding change to the default configuration files[ ] I have added tests that prove my fix is effective or that my feature worksCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.How to test this PR locally
Using a properly installed Elastic Agent with
./elastic-agent install
. You can initiate an upgrade:The above will fail because there is no pushed 8.0.0, but using the same command and the added
--source-uri
upgrading can be tested.This requires that the branch was build with DEV on so that the *.asc files are not required
DEV=true mag package
. You can point it to the same installed version but that will result in the following error:Adding a commit and rebuilding will result in a new version that will successfully upgrade.
Related issues