Closed alexgg closed 1 year ago
Manual tests:
[x] Update to new target supervisor version - golden path
Nov 29 12:23:36 8fc8809 upgrade-2.x.sh[11044]: Extracted default version is v14.13.13...
Nov 29 12:23:36 8fc8809 upgrade-2.x.sh[11062]: Supervisor state: Target 14.13.13, current 14.10.0, scheduled 14.10.0
Nov 29 12:23:36 8fc8809 upgrade-2.x.sh[11078]: Patching supervisor target state from v14.10.0 to v14.13.13
Nov 29 12:23:37 8fc8809 upgrade-2.x.sh[11096]: Extracted supervisor vars: ID: 2753296
Nov 29 12:23:37 8fc8809 upgrade-2.x.sh[11102]: Setting supervisor version in the API...
Nov 29 12:23:38 8fc8809 upgrade-2.x.sh[11116]: Successfully set supervision version in target state
Nov 29 12:23:38 8fc8809 upgrade-2.x.sh[11123]: Updating supervisor target state from v14.10.0 to v14.13.13
...
Nov 29 12:24:07 8fc8809 upgrade-2.x.sh[11348]: Finished update, not rebooting as requested.
[x] Update to target version newer than current but not newer than scheduled
/tmp/upgrade-2.x.sh --hostos-version 4.1.1 --balenaos-registry registry2.balena-cloud.com --no-reboot
await sdk.models.device.setSupervisorRelease('38cacba', 'v15.0.1')
Nov 29 12:39:23 38cacba upgrade-2.x.sh[9871]: Extracted default version is v14.13.13... Nov 29 12:39:24 38cacba upgrade-2.x.sh[9894]: Supervisor state: Target 14.13.13, current 14.10.0, scheduled 15.0.2 Nov 29 12:39:24 38cacba upgrade-2.x.sh[9910]: Updating supervisor target state from v14.10.0 to v15.0.2 ... Nov 29 12:41:50 38cacba upgrade-2.x.sh[10170]: Rebooting into new OS in 5 seconds...
[ ] Update to target version newer than scheduled but not newer than current
SHOULD NOT HAPPEN - API does not allow setting current higher than scheduled
[x] Update to target version not newer than current nor scheduled
Nov 29 13:29:57 069f98a upgrade-2.x.sh[10585]: Extracted default version is v14.13.13...
Nov 29 13:29:57 069f98a upgrade-2.x.sh[10608]: Supervisor state: Target 14.13.13, current 15.0.1, scheduled 15.0.1
Nov 29 13:29:57 069f98a upgrade-2.x.sh[10624]: Supervisor update: no update needed.
Nov 29 13:29:58 069f98a upgrade-2.x.sh[10657]: No update package cleanup done
Nov 29 13:29:58 069f98a upgrade-2.x.sh[10672]: Finished update, not rebooting as requested.
Currently, HUP fails if there is a scheduled supervisor update pending in the cloud to avoid concurrent updates.
This has caused a race condition as follows:
actions-backend[8486]: 331a727bc378acf3cd86f305b917bdc16eada2c468fe3a0c41df5ab475be21fe POST actions.balena-devices.com /v1/8412784dc5bf1d5f1a78c5f6d6fbb5e1/supervisorupgrade 500 52 25.528ms
This change modifies the supervisor update logic to take into account the provided target version, and the current and scheduled target state version and acts accordingly.
Change-type: patch