Skip to content
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 start_os_update #378

Merged
merged 1 commit into from
Feb 11, 2025

Conversation

jaomaloy
Copy link

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

@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

@jaomaloy jaomaloy force-pushed the jaomaloy/detached-hup branch 2 times, most recently from 0b1c6ee to 30af156 Compare January 30, 2025 12:09
Copy link
Contributor

@kb2ma kb2ma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First pass review. Have not tested operation yet.

DOCUMENTATION.md Outdated Show resolved Hide resolved
balena/models/device.py Outdated Show resolved Hide resolved
balena/models/device.py Outdated Show resolved Hide resolved
balena/models/device.py Outdated Show resolved Hide resolved
@jaomaloy jaomaloy force-pushed the jaomaloy/detached-hup branch 2 times, most recently from 00f8a99 to 0d3c654 Compare February 6, 2025 16:07
@jaomaloy jaomaloy marked this pull request as ready for review February 6, 2025 16:29
@jaomaloy jaomaloy force-pushed the jaomaloy/detached-hup branch 2 times, most recently from 48c22db to c9e3d7d Compare February 6, 2025 16:35
@flowzone-app flowzone-app bot enabled auto-merge February 6, 2025 16:50
@jaomaloy jaomaloy requested a review from kb2ma February 7, 2025 04:17
@kb2ma
Copy link
Contributor

kb2ma commented Feb 7, 2025

Tested HUP against live device with and without runDetached=True, and it worked as expected.

Added a commit with some simple input tests on start_os_update().

@jaomaloy if you can squash in my commit and fix the issue flagged by otaviojacoby, I'm happy to approve. Of course let me know if you have any concerns about the test I added.

@jaomaloy jaomaloy force-pushed the jaomaloy/detached-hup branch 5 times, most recently from 7db7935 to b7df93c Compare February 11, 2025 03:42
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.

Add tests for start_os_update as well.

Change-type: minor
@jaomaloy jaomaloy force-pushed the jaomaloy/detached-hup branch from b7df93c to 7ab93c0 Compare February 11, 2025 03:42
@kb2ma
Copy link
Contributor

kb2ma commented Feb 11, 2025

Testing with 7ab93c0 below. Works as expected. The status value on start_os_update() shows running the appropriate HUP flavor.

<stdin>:1: DeprecationWarning: Call to deprecated method get_os_update_status. (
        This will be removed in a future major release. This will no longer return a
        useful status for runDetached=true updates.
        )
{'status': 'idle', 'action': 'resinhup', 'lastRun': None}

>>> balena.models.device.start_os_update('c575748107105508f1eb8dc69b6e1e19', '6.1.21', run_detached=None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/kbee/dev/python-sdk/repo/balena/models/device.py", line 1780, in start_os_update
    raise ValueError(f"run_detached must be True or False, got {type(run_detached)}: {run_detached}")
ValueError: run_detached must be True or False, got <class 'NoneType'>: None

>>> balena.models.device.start_os_update('c575748107105508f1eb8dc69b6e1e19', '6.1.21', run_detached=True)
{'status': 'triggered', 'lastRun': 1739293507277, 'parameters': {'target_version': '6.1.21'}, 'action': 'resinhup'}

>>> balena.models.device.start_os_update('c575748107105508f1eb8dc69b6e1e19', '6.1.21+rev1')
{'status': 'in_progress', 'lastRun': 1739293852176, 'parameters': {'target_version': '6.1.21+rev1'}, 'action': 'resinhup'}

>>> balena.models.device.start_os_update('c575748107105508f1eb8dc69b6e1e19', '6.1.24', run_detached=False)
{'status': 'in_progress', 'lastRun': 1739294909010, 'parameters': {'target_version': '6.1.24'}, 'action': 'resinhup'}

Copy link
Contributor

@kb2ma kb2ma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Latest update looks good.

@flowzone-app flowzone-app bot merged commit c2ed215 into master Feb 11, 2025
55 checks passed
@flowzone-app flowzone-app bot deleted the jaomaloy/detached-hup branch February 11, 2025 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants