PMM-15266 Bring back the update status endpoint - #5733
Conversation
PMM-14969 (#5394) removed StartUpdate and UpdateStatus together with the GUI-triggered upgrade flow. Pre-3.9 clients, however, keep polling /v1/server/updates:getStatus after they trigger an update - that is how they learn the freshly started server has finished initializing. Without it they never leave the "in progress" state when migrating to 3.9.0. Restore UpdateStatus only. StartUpdate stays removed, so the auth token file it used to write (/srv/pmm-update.json) is gone as well and the token can no longer be verified: it was issued by the instance this one replaced. Requests carrying one are accepted as is. Completion now comes from the supervisord state of pmm-init, the program that runs the initialization and upgrade tasks. Unlike the maintenance mode marker, supervisord reports a program as running from the moment it is spawned, so there is no window right after a restart in which the endpoint would wrongly report an update as complete. The nginx maintenance mode bypass listed /v1/updates/Status, a PMM 2 path that has matched nothing in 3.x, so the progress log never reached pmm-managed while an upgrade was running. It now names the actual endpoint.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5733 +/- ##
==========================================
+ Coverage 43.59% 45.44% +1.85%
==========================================
Files 415 418 +3
Lines 43134 43363 +229
==========================================
+ Hits 18804 19708 +904
+ Misses 22454 21713 -741
- Partials 1876 1942 +66
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Only "done" matters to pre-3.9 clients, so stop serving the pmm-init progress log: log_lines and log_offset always marshal as their default values, and auth_token is accepted without being verified. All three fields are marked deprecated in the proto. Dropping the log removes Updater.InitLog along with the gRPCMessageMaxSize it needed to cap a single response, which restores updater.go and main.go to their pre-restoration state. The offset a client carries over refers to the log of the instance it polled before the update, so replaying from it could only return the previous boot's output. Also drop two documentation rows left stale by PMM-14969: the removed /v1/server/updates:start endpoint and the "Start updates" permission, which no longer has a UI trigger. Signed-off-by: Alex Demidoff <a@demidoff.me>
WalkthroughVery well. The PR adds ChangesUpdate status
Sequence Diagram(s)sequenceDiagram
participant Client
participant UpdateStatus
participant Supervisord
Client->>UpdateStatus: POST /v1/server/updates:getStatus
UpdateStatus->>Supervisord: ProgramRunning("pmm-init")
Supervisord-->>UpdateStatus: Running state
UpdateStatus-->>Client: Done status and compatibility fields
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Warning Review ran into problems🔥 ProblemsRepository analysis: Couldn't refresh Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@api/server/v1/json/client/server_service/server_service_client.go`:
- Around line 460-475: Update the OpenAPI definition for UpdateStatus so
AuthToken is transmitted only over HTTPS, then regenerate the client so the
UpdateStatus operation no longer permits the http scheme when
UpdateStatusBody.AuthToken is present. Preserve the existing UpdateStatus client
behavior otherwise.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 3a4193a5-c462-4f80-9d13-a41ea6eb67c3
⛔ Files ignored due to path filters (4)
api/descriptor.binis excluded by!**/*.binapi/server/v1/server.pb.gois excluded by!**/*.pb.goapi/server/v1/server.pb.gw.gois excluded by!**/*.pb.gw.goapi/server/v1/server_grpc.pb.gois excluded by!**/*.pb.go
📒 Files selected for processing (19)
api-tests/server/updates_test.goapi/server/v1/json/client/server_service/server_service_client.goapi/server/v1/json/client/server_service/update_status_parameters.goapi/server/v1/json/client/server_service/update_status_responses.goapi/server/v1/json/v1.jsonapi/server/v1/server.pb.validate.goapi/server/v1/server.protoapi/swagger/swagger-dev.jsonapi/swagger/swagger.jsonbuild/ansible/roles/initialization/tasks/main.ymlbuild/ansible/roles/nginx/files/conf.d/pmm.confdocumentation/docs/admin/roles/index.mdmanaged/services/grafana/auth_server.gomanaged/services/server/deps.gomanaged/services/server/mock_supervisord_service_test.gomanaged/services/server/server.gomanaged/services/server/server_test.gomanaged/services/supervisord/devcontainer_test.gomanaged/services/supervisord/supervisord.go
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
percona/pmm-qa(manual)percona/pmm(manual)
💤 Files with no reviewable changes (1)
- documentation/docs/admin/roles/index.md
Ticket number: PMM-15266
Feature build: SUBMODULES-4508
PMM-14969 (#5394) removed StartUpdate and UpdateStatus together with the GUI-triggered upgrade flow. Pre-3.9 clients, however, keep polling
/v1/server/updates:getStatusafter they trigger an update - that is how they learn the freshly started server has finished initializing. Without it they never leave the "in progress" state when migrating to 3.9.0.Restore UpdateStatus only. StartUpdate stays removed, so the auth token file it used to write (/srv/pmm-update.json) is gone as well and the token can no longer be verified: it was issued by the instance this one replaced. Requests carrying one are accepted as is.
Completion now comes from the supervisord state of pmm-init, the program that runs the initialization and upgrade tasks. Unlike the maintenance mode marker, supervisord reports a program as running from the moment it is spawned, so there is no window right after a restart in which the endpoint would wrongly report an update as complete.
The nginx maintenance mode bypass listed
/v1/updates/Status, a PMM 2 path that has matched nothing in 3.x, so the progress log never reached pmm-managed while an upgrade was running. It now names the actual endpoint.