Commit da3877c
[Fleet] Implement agent upgrade rollback (elastic#247398)
## Summary
Closes elastic/ingest-dev#6212
This PR adds Fleet support for Elastic Agent upgrade rollback (main
issue: elastic/ingest-dev#3971).
Key points:
* Feature is behind `enableAgentRollback` feature flag
* Feature is only available for Enterprise license
* New single agent upgrade rollback API endpoint: `POST
/api/fleet/agents/{agentId}/rollback`
* New bulk agent upgrade rollback API endpoint: `POST
/api/fleet/agents/bulk_rollback`
* Upgrade rollback generates an `UPGRADE` type agent action with
`rollback: true` and the rollback version set by the agent
* For multiple agents, one action per rollback version is generated
* Single agent and bulk upgrade rollback available from Fleet UI
### Screenshots
Single agent confirmation modal:
<img width="1919" height="773" alt="Screenshot 2025-12-23 at 16 06 09"
src="https://github.com/user-attachments/assets/6b3948b6-b530-4c18-b2b8-8763234ae75d"
/>
Multiple agents confirmation modal:
<img width="1919" height="773" alt="Screenshot 2025-12-23 at 16 02 29"
src="https://github.com/user-attachments/assets/1b7e36b2-7c67-4b17-aae5-75a86fb7e015"
/>
Action result example:
<img width="1919" height="881" alt="Screenshot 2025-12-23 at 16 01 24"
src="https://github.com/user-attachments/assets/f84eb8bb-fc55-4fb7-ac22-48042da87718"
/>
If action was correctly created and rollback failed, it shows in the
agent's upgrade details:
<img width="1919" height="881" alt="Screenshot 2025-12-23 at 15 40 41"
src="https://github.com/user-attachments/assets/3aa51fcb-12ac-4c59-920f-6d685605fe09"
/>
### Testing
Properly testing agent rollback is not straightforward right now as the
feature is new and requires a "rollbackable" upgrade. See
elastic/elastic-agent#11143 for steps.
Alternatively, the agent document can be directly edited with fake
upgrade rollback information in order to test that Fleet behaves
correctly (the action will fail in this case).
Scenarios to check:
* Single agent
* If no upgrade rollback, UI element should be disabled and API request
should fail fast
* Same if agent has expired rollback
* If agent has a valid rollback, an `UPGRADE` type action should be
created with `rollback: true` and the correct rollback version
* Multiple agents
* Should work with list of agent ids (manual selection in the UI)
* Should work with agent kuery (select all in the UI)
* If agents have different rollback versions, there should be one action
per version
* Agents not found and agents with no (valid) rollback should generate
corresponding action errors
### Checklist
- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.
### Identify risks
This is a new experimental feature behind the `enableAgentRollback`
feature flag and leaves existing flows largely untouched.
## Release note
Adds capability for rolling back a recent upgrade of a Fleet-managed
Elastic Agent upgrade using Fleet UI or API.
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>1 parent 495350f commit da3877c
File tree
38 files changed
+2900
-35
lines changed- oas_docs
- output
- x-pack/platform
- test
- fixtures/es_archives/fleet/agents
- fleet_api_integration
- apis/agents
- plugin_api_integration/test_suites/task_manager
38 files changed
+2900
-35
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22070 | 22070 | | |
22071 | 22071 | | |
22072 | 22072 | | |
| 22073 | + | |
| 22074 | + | |
| 22075 | + | |
| 22076 | + | |
| 22077 | + | |
| 22078 | + | |
| 22079 | + | |
| 22080 | + | |
| 22081 | + | |
| 22082 | + | |
| 22083 | + | |
| 22084 | + | |
| 22085 | + | |
| 22086 | + | |
| 22087 | + | |
| 22088 | + | |
| 22089 | + | |
| 22090 | + | |
| 22091 | + | |
| 22092 | + | |
| 22093 | + | |
| 22094 | + | |
| 22095 | + | |
| 22096 | + | |
| 22097 | + | |
| 22098 | + | |
22073 | 22099 | | |
22074 | 22100 | | |
22075 | 22101 | | |
| |||
24418 | 24444 | | |
24419 | 24445 | | |
24420 | 24446 | | |
| 24447 | + | |
| 24448 | + | |
| 24449 | + | |
| 24450 | + | |
| 24451 | + | |
| 24452 | + | |
| 24453 | + | |
| 24454 | + | |
| 24455 | + | |
| 24456 | + | |
| 24457 | + | |
| 24458 | + | |
| 24459 | + | |
| 24460 | + | |
| 24461 | + | |
| 24462 | + | |
| 24463 | + | |
| 24464 | + | |
| 24465 | + | |
| 24466 | + | |
| 24467 | + | |
| 24468 | + | |
| 24469 | + | |
| 24470 | + | |
| 24471 | + | |
| 24472 | + | |
24421 | 24473 | | |
24422 | 24474 | | |
24423 | 24475 | | |
| |||
24925 | 24977 | | |
24926 | 24978 | | |
24927 | 24979 | | |
| 24980 | + | |
| 24981 | + | |
| 24982 | + | |
| 24983 | + | |
| 24984 | + | |
| 24985 | + | |
| 24986 | + | |
| 24987 | + | |
| 24988 | + | |
| 24989 | + | |
| 24990 | + | |
| 24991 | + | |
| 24992 | + | |
| 24993 | + | |
| 24994 | + | |
| 24995 | + | |
| 24996 | + | |
| 24997 | + | |
| 24998 | + | |
| 24999 | + | |
| 25000 | + | |
| 25001 | + | |
| 25002 | + | |
| 25003 | + | |
| 25004 | + | |
| 25005 | + | |
24928 | 25006 | | |
24929 | 25007 | | |
24930 | 25008 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22070 | 22070 | | |
22071 | 22071 | | |
22072 | 22072 | | |
| 22073 | + | |
| 22074 | + | |
| 22075 | + | |
| 22076 | + | |
| 22077 | + | |
| 22078 | + | |
| 22079 | + | |
| 22080 | + | |
| 22081 | + | |
| 22082 | + | |
| 22083 | + | |
| 22084 | + | |
| 22085 | + | |
| 22086 | + | |
| 22087 | + | |
| 22088 | + | |
| 22089 | + | |
| 22090 | + | |
| 22091 | + | |
| 22092 | + | |
| 22093 | + | |
| 22094 | + | |
| 22095 | + | |
| 22096 | + | |
| 22097 | + | |
| 22098 | + | |
22073 | 22099 | | |
22074 | 22100 | | |
22075 | 22101 | | |
| |||
24418 | 24444 | | |
24419 | 24445 | | |
24420 | 24446 | | |
| 24447 | + | |
| 24448 | + | |
| 24449 | + | |
| 24450 | + | |
| 24451 | + | |
| 24452 | + | |
| 24453 | + | |
| 24454 | + | |
| 24455 | + | |
| 24456 | + | |
| 24457 | + | |
| 24458 | + | |
| 24459 | + | |
| 24460 | + | |
| 24461 | + | |
| 24462 | + | |
| 24463 | + | |
| 24464 | + | |
| 24465 | + | |
| 24466 | + | |
| 24467 | + | |
| 24468 | + | |
| 24469 | + | |
| 24470 | + | |
| 24471 | + | |
| 24472 | + | |
24421 | 24473 | | |
24422 | 24474 | | |
24423 | 24475 | | |
| |||
24925 | 24977 | | |
24926 | 24978 | | |
24927 | 24979 | | |
| 24980 | + | |
| 24981 | + | |
| 24982 | + | |
| 24983 | + | |
| 24984 | + | |
| 24985 | + | |
| 24986 | + | |
| 24987 | + | |
| 24988 | + | |
| 24989 | + | |
| 24990 | + | |
| 24991 | + | |
| 24992 | + | |
| 24993 | + | |
| 24994 | + | |
| 24995 | + | |
| 24996 | + | |
| 24997 | + | |
| 24998 | + | |
| 24999 | + | |
| 25000 | + | |
| 25001 | + | |
| 25002 | + | |
| 25003 | + | |
| 25004 | + | |
| 25005 | + | |
24928 | 25006 | | |
24929 | 25007 | | |
24930 | 25008 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29185 | 29185 | | |
29186 | 29186 | | |
29187 | 29187 | | |
| 29188 | + | |
| 29189 | + | |
| 29190 | + | |
| 29191 | + | |
| 29192 | + | |
| 29193 | + | |
| 29194 | + | |
| 29195 | + | |
| 29196 | + | |
| 29197 | + | |
| 29198 | + | |
| 29199 | + | |
| 29200 | + | |
| 29201 | + | |
| 29202 | + | |
| 29203 | + | |
| 29204 | + | |
| 29205 | + | |
29188 | 29206 | | |
29189 | 29207 | | |
29190 | 29208 | | |
| |||
29708 | 29726 | | |
29709 | 29727 | | |
29710 | 29728 | | |
| 29729 | + | |
| 29730 | + | |
| 29731 | + | |
| 29732 | + | |
| 29733 | + | |
| 29734 | + | |
| 29735 | + | |
| 29736 | + | |
| 29737 | + | |
| 29738 | + | |
| 29739 | + | |
| 29740 | + | |
| 29741 | + | |
| 29742 | + | |
| 29743 | + | |
| 29744 | + | |
| 29745 | + | |
| 29746 | + | |
29711 | 29747 | | |
29712 | 29748 | | |
29713 | 29749 | | |
| |||
30087 | 30123 | | |
30088 | 30124 | | |
30089 | 30125 | | |
| 30126 | + | |
| 30127 | + | |
| 30128 | + | |
| 30129 | + | |
| 30130 | + | |
| 30131 | + | |
| 30132 | + | |
| 30133 | + | |
| 30134 | + | |
| 30135 | + | |
| 30136 | + | |
| 30137 | + | |
| 30138 | + | |
| 30139 | + | |
| 30140 | + | |
| 30141 | + | |
| 30142 | + | |
| 30143 | + | |
30090 | 30144 | | |
30091 | 30145 | | |
30092 | 30146 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31744 | 31744 | | |
31745 | 31745 | | |
31746 | 31746 | | |
| 31747 | + | |
| 31748 | + | |
| 31749 | + | |
| 31750 | + | |
| 31751 | + | |
| 31752 | + | |
| 31753 | + | |
| 31754 | + | |
| 31755 | + | |
| 31756 | + | |
| 31757 | + | |
| 31758 | + | |
| 31759 | + | |
| 31760 | + | |
| 31761 | + | |
| 31762 | + | |
| 31763 | + | |
| 31764 | + | |
31747 | 31765 | | |
31748 | 31766 | | |
31749 | 31767 | | |
| |||
32267 | 32285 | | |
32268 | 32286 | | |
32269 | 32287 | | |
| 32288 | + | |
| 32289 | + | |
| 32290 | + | |
| 32291 | + | |
| 32292 | + | |
| 32293 | + | |
| 32294 | + | |
| 32295 | + | |
| 32296 | + | |
| 32297 | + | |
| 32298 | + | |
| 32299 | + | |
| 32300 | + | |
| 32301 | + | |
| 32302 | + | |
| 32303 | + | |
| 32304 | + | |
| 32305 | + | |
32270 | 32306 | | |
32271 | 32307 | | |
32272 | 32308 | | |
| |||
32646 | 32682 | | |
32647 | 32683 | | |
32648 | 32684 | | |
| 32685 | + | |
| 32686 | + | |
| 32687 | + | |
| 32688 | + | |
| 32689 | + | |
| 32690 | + | |
| 32691 | + | |
| 32692 | + | |
| 32693 | + | |
| 32694 | + | |
| 32695 | + | |
| 32696 | + | |
| 32697 | + | |
| 32698 | + | |
| 32699 | + | |
| 32700 | + | |
| 32701 | + | |
| 32702 | + | |
32649 | 32703 | | |
32650 | 32704 | | |
32651 | 32705 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
| 196 | + | |
| 197 | + | |
196 | 198 | | |
197 | 199 | | |
198 | 200 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
354 | 357 | | |
355 | 358 | | |
356 | 359 | | |
| |||
0 commit comments