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

Call device update hook when target OS release changes #1852

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/features/ci-cd/hooks/device-update-trigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ hooks.addPureHook('PATCH', 'resin', 'device', {
// * app changed
// * target release changed
// * device name changed - so a user can restart their service and it will pick up the change
// * target OS release changed, so that Supervisors that support this can trigger a HUP
if (
(request.values.is_pinned_on__release !== undefined ||
request.values.belongs_to__application != null ||
request.values.device_name != null) &&
request.values.device_name != null ||
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought the supervisor only updated the device name for containers when they were receiving other updates? In which case there's no point to trigger a supervisor update check in that case as it would just be unnecessary load

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The Supervisor stores the most up-to-date device name in its config table of its sqlite database though, and uses this for SV API's /v2/device/name calls. You're right though that BALENA_DEVICE_NAME_AT_INIT env var for services only changes when starting up the service, and changing the name doesn't result in a service restart by itself.

request.values.should_be_operated_by__release != null) &&
affectedIds.length !== 0
) {
// Send the update requests only after the tx is committed
Expand Down
Loading