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

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

flobz
Copy link
Contributor

@flobz flobz commented Feb 8, 2024

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

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
Signed-off-by: Florian Bezannier <florian.bezannier@hotmail.fr>
@flobz flobz force-pushed the feature/target_self_version_assign branch from 3cc5f12 to dcf589b Compare March 7, 2024 13:08
@flobz
Copy link
Contributor Author

flobz commented Mar 8, 2024

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

/**
* Allow a target to declare running distribution set version
*/
@JsonIgnoreProperties(ignoreUnknown = true)
Copy link
Contributor

Choose a reason for hiding this comment

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

could use lombok annotations already available hawkbit wide

@Data@ToString
@ToString 

and to remove some boilerplate code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Lombok isn't in hawkbit-ddi-api dependencies, you want to add it ?

+ DdiRestConstants.INSTALLED_BASE_ACTION, consumes = {
MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR })
ResponseEntity<Void> setAsssignedOfflineVersion(@Valid DdiAssignedVersion ddiAssignedVersion,
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure about if the enpoint shalle be installed_base_action ...
have to think over it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have you an answer now ? So we can freeze the API definition.

Copy link
Contributor

Choose a reason for hiding this comment

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

Not yet. We are up to release 0.5.0. After that we will have enough time to think about that DDI API change ...

@avgustinmm
Copy link
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
Copy link
Contributor Author

flobz commented Mar 19, 2024

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

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

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
4 participants