-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option for detached HUP on startOsUpdate #1443
Conversation
One more thing to add -- OsUpdateActionResult needs a 'triggered' status option. For v2, the status is either 'idle', 'triggered', or possibly 'error'. It will error for example if there is a bad parameter in the request. In that case the HUP is not started on the device. See We could create an OsUpdateActionResult2 for just v2, but I don't think it's worth the effort. We can just remove the unused OsUpdateActionResult status values when v1 is removed. |
4f63a6d
to
bd2d9a9
Compare
8f12260
to
5355aa8
Compare
5355aa8
to
7f416d4
Compare
22ea52b
to
e1c3e18
Compare
14b4fb9
to
b38519e
Compare
@jaomaloy I've gone through all the code now, and overall it is more compact and looks good. Please update the API comments in Also add a comment to |
We will do this at the next step, correct? This PR isn't for deprecation yet but to add the option for true so the rest of our code can use runDetached=true. |
684e313
to
8b20176
Compare
@jaomaloy we want to deprecate now to give users notice of the change and time to adapt. |
Tests look OK, except for what I describe below. When I test v1, I see these results when starting the update, as expected.
However, when running v2, I see these results when starting the update. I actually would expect to see similar results -- basically whatever is in the action server's ACTION_STATUS dictionary.
Looking into the error, I see this in the log for balena-proxy -- generating an error just looking up the device. Of course we don't support getOsUpdateStatus() when running in detached mode. However, it should not generate an error either. Do you get the same results? My concern is that there may be some code or rules in pinejs that are sensitive to the status of the device.
|
There is another problem. If I run a HUP in non-detached mode, and then run a second HUP in detached mode, the second HUP actually runs in non-detached mode. 1st HUP:
2nd HUP. Notice status should be 'triggered'.
Proxy log shows the second attempt did indeed call the /v1 endpoint:
|
8b20176
to
978557c
Compare
This is likely to be because if we getOsUpdateStatus with a v2 running, the result is forced to 'error'. I could just make this return new error type instead?
|
It's good that the SDK code is catching this case, and I don't think we need a separate error. My concern is that the error occurs on line 689 in balena-proxy For v2, the resinhup GET should still return either 'triggered' or 'idle'. They are not really useful, but I don't understand why an error would be generated in this case. I'm concerned that backend modules like the UI will use the SDK as well, and also will get this odd error. Is there something in the pinejs rules or SQL that is failing because the device is in an unexpected state? @Page- , any insights here? |
5271959
to
37992da
Compare
00a7865
to
05e8d91
Compare
@@ -2262,6 +2270,10 @@ const getDeviceModel = function ( | |||
* Unsupported (unpublished) version will result in rejection. | |||
* The version **must** be the exact version number, a "prod" variant and greater than the one running on the device. | |||
* To resolve the semver-compatible range use `balena.model.os.getMaxSatisfyingVersion`. | |||
* @param {Object} [options] - options | |||
* @param {Boolean} [options.runDetached] - run the update in detached mode. | |||
* Default behaviour is runDetached=false but is DEPRECATED and will be removed in a future release. Use runDetached=true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice comment!
LGTM, please rebase and squash commits. @Page- do you want to take another look? |
fef2e74
to
48bdc1d
Compare
When I do a local build, the DOCUMENTATION.md file is updated for the deprecations. I expect this update should be included with the PR. Also, please confirm that the documentation for getOsUpdateStatus() is accurate. I'm not sure it works to put the @summary and @deprecated on a single line. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to resolve comment above on docs.
48bdc1d
to
0d9a60e
Compare
yep, @deprecated needed a new line. |
This will call the v2 actions endpoint for resinhup which runs a detached version of HUP that increases HUP reliability on slow networks but will offer no status updates such as in_progress. Change-type: minor
0d9a60e
to
8923df6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Documentation looks good now.
This will call the v2 actions endpoint for resinhup which runs a detached version of HUP that increases HUP reliability on slow networks but will offer
no status updates such as in_progress.
Resolves: #
HQ:
See:
Depends-on:
Change-type: major|minor|patch
Contributor checklist