Skip to content

feat: allow a target to set offline assigned distribution set - #1620

Merged
avgustinmm merged 4 commits into
eclipse-hawkbit:masterfrom
flobz:feature/target_self_version_assign
Aug 1, 2024
Merged

avgustinmm merged 4 commits into
eclipse-hawkbit:masterfrom
flobz:feature/target_self_version_assign

Conversation

@flobz

@flobz flobz commented Feb 8, 2024 •

Copy link
Copy Markdown
Contributor

Hello,
This PR allows a target to update it's assigned version (fix: #446).

It's relies on #563 but allow a target to do that it self instead of using Management API.

why :

  1. allow to know a target version before first update (eg: after flashing)
  2. allow offline rollback mechanism

Related discussion:
#242

@hawkbit-bot

Copy link
Copy Markdown

Can one of the admins verify this patch?

@flobz
flobz force-pushed the feature/target_self_version_assign branch 3 times, most recently from b9b1ed6 to 3cc5f12 Compare March 5, 2024 15:58
@flobz
flobz force-pushed the feature/target_self_version_assign branch from 3cc5f12 to dcf589b Compare March 7, 2024 13:08
@flobz

flobz commented Mar 8, 2024

Copy link
Copy Markdown
Contributor Author

@avgustinmm would you be able to review this PR soon ?

@avgustinmm

Copy link
Copy Markdown
Contributor

@avgustinmm would you be able to review this PR soon ?

@flobz thanks for your contribution.

By coincidence, I was reviewing the PR at the same time you wrote. Though I added many comments into my review they are, in general, mostly related to same thing - not exposing backend management service methods to controller permissions.

I have some questions regarding the motivation of the PR. If the target requests a rollback I suppose the scenario would be something like:

  1. Deploy software, but it is detected as not working
  2. Device keeps a record about the previous version
  3. It update/set offline assignment -> it creates install actions
  4. then it queries as it always does for updates and the same update it has requested is triggered

However, I'm not sure how "allow to know a target version before first update (eg: after flashing)" would work?
Device, at the step 4 (above), should "realize" that its initial version is the same that has been assigned to it and will not install it but will just feedback that it is installed without actually installing it?

I'm still not sure these are real usecases. Isn't it up to a backend service, responsible for device management, to provision installed ds info and to "realize" error states and to launch recover/rollback actions?

And finally - since this is an DDI API method it shall be very stable so it is very important the path of the method. At the moment I'm not sure installedBase is a proper path.

@flobz

flobz commented Mar 19, 2024

Copy link
Copy Markdown
Contributor Author

Device, at the step 4 (above), should "realize" that its initial version is the same that has been assigned to it and will not install it but will just feedback that it is installed without actually installing it?

In the case where no version is assigned to the target because we don't want to update it, it's nice to know it's version no ?

I'm still not sure these are real usecases. Isn't it up to a backend service, responsible for device management, to provision installed ds info and to "realize" error states and to launch recover/rollback actions?

In my opinion a target should be autonomous. We use rauc with two slot so, for example if one slot is corrupt target should automatically switch to the other slot and tell hawkbit that the installed version isn't anymore the version on the corrupt slot but version on the healthy slot.

@lizziemac

Copy link
Copy Markdown

Seconded - I'm also using a 2-partition layout for updates, as well as a recovery mode that flashes a "golden image" to both partitions in certain scenarios.

It's important for the device to be the source of truth because even the best backend can't handle all error cases.

In the past week I've encountered two issues where the device was on a different version than hawkbit thought

  • The device "failed" to update, however when I checked what version it was on,it was on the newly assigned DS (that failed)
  • When going into recovery mode and reflashing with the golden image on both partitions, the device in hawkbit inaccurately reflected the previous version, instead of the golden version

@avgustinmm

Copy link
Copy Markdown
Contributor

Hi, I looked again at the PR and discussion. The point is to change the installed distribution set reference of the target - with the provisioning one or with offline installed/applied one. Why then do assign which changes assigned distribution set and create actions - which none will ever finish? Or device will then confirm it (that's why I asked about the flow).
Shouldn't simply an 'updated offline' (or 'update installed version') action (DDI method) simply set installed DS as the feedback action does when action is finished with success?

@flobz

flobz commented Jul 12, 2024

Copy link
Copy Markdown
Contributor Author

Hello @avgustinmm ,
Sorry I don't understand you question. Can be more explicit ?
Thanks

@avgustinmm

Copy link
Copy Markdown
Contributor

I propose to implement a method updateInstalledVersion which will set target's installedDistributionSet to the version specified by device. This will:

  • allow pre-provisioned device to set its correct installed version in hawkBit server
  • allow device to set offline installed version to hawkBit as installed
    Optionally, along with setting installedDistributionSet it could also create an finished action with proper message in order to keep track.

@flobz

flobz commented Jul 12, 2024 •

Copy link
Copy Markdown
Contributor Author

Ok I understand thanks.
To be honest assign version offline was already implemented by #563 for the management API so it was simpler to add it.

It can lead to issue in certain case maybe, for eg:

Given a dual boot system with v1 on filesystem1 and v2 on filesystem 2.
If at the beginning the system is on fs2 and the assigned and installed version on hawkbit is v2
When fs2 is corrupted
Then the device reboot on fs1
And hawkbit installed version is updated to be v1

At this point assigned version is still v2 so hawkbit will ask the system to update and we don't want that no ?

Why then do assign which changes assigned distribution set and create actions - which none will ever finish? Or device will then confirm it (that's why I asked about the flow).

The device just called the new API endpoint 1 time an the action is marked as finish.

@avgustinmm

avgustinmm commented Jul 25, 2024 •

Copy link
Copy Markdown
Contributor

@flobz,
maybe I've misunderstood what the offline assignment currently does. We found out that it actually:

  • creates action in finished state
  • sets installed and assigned distribution set
  • if there is a pending command (i.e. new assignment) it does nothing - so doesn't override next assignments

So, it seems it does what you need. You could resolve the branch conflicts and we'll try to find out the proper REST API endpoint for it (hope next week). Also, please document the API endpoint with "Experimental, could be changed" or something like this to get the notion that it's not still final/stable.

@flobz

flobz commented Jul 25, 2024

Copy link
Copy Markdown
Contributor Author

Ok great news! Thanks.
Conflict is resolved.

@avgustinmm
avgustinmm dismissed their stale review August 1, 2024 08:49

outdated

@avgustinmm
avgustinmm merged commit 0013750 into eclipse-hawkbit:master Aug 1, 2024
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.

Assigning artifacts after successful update again

5 participants