Skip to content

Commit

Permalink
A builtin operation can be triggered on the executing step
Browse files Browse the repository at this point in the history
Signed-off-by: Didier Wenzek <[email protected]>
  • Loading branch information
didier-wenzek committed Sep 10, 2024
1 parent f27bf17 commit 79cf19b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ Override Built-In Operation
Should Contain ${software_list[0]} "done"
Execute Command tedge mqtt pub --retain te/device/main///cmd/software_list/robot-456 ''

Override Built-In Operation Executing Step
# Trigger a software update using a custom software-update workflow with rollbacks
Execute Command
... tedge mqtt pub --retain te/device/main///cmd/software_update/test-builtin-executing-step '{"status":"init","updateList":[{"type":"apt","modules":[{"name":"broken-package","version":"latest","action":"install"}]}]}'
Should Have MQTT Messages te/device/main///cmd/software_update/test-builtin-executing-step message_pattern=.*rollback.* minimum=1
Execute Command tedge mqtt pub --retain te/device/main///cmd/software_update/test-builtin-executing-step ''

Trigger Device Restart Using A Sub-Command
[Documentation] To detect if the device has been rebooted, a marker file is created in the /run directory
... which should be deleted when the device is restarted
Expand Down Expand Up @@ -198,6 +205,7 @@ Custom Setup

Copy Configuration Files
ThinEdgeIO.Transfer To Device ${CURDIR}/software_list.toml /etc/tedge/operations/
ThinEdgeIO.Transfer To Device ${CURDIR}/software_update.toml /etc/tedge/operations/
ThinEdgeIO.Transfer To Device ${CURDIR}/custom-download.toml /etc/tedge/operations/
ThinEdgeIO.Transfer To Device ${CURDIR}/schedule-download.sh /etc/tedge/operations/
ThinEdgeIO.Transfer To Device ${CURDIR}/launch-download.sh /etc/tedge/operations/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
operation = "software_update"

[init]
action = "proceed"
on_success = "scheduled"

[scheduled]
action = "proceed"
on_success = "executing"

[executing]
operation = "builtin:software_update" # trigger the built-in behavior for software update
on_exec = "await_operation"

[await_operation]
action = "await-operation-completion" # awaiting the builtin operation to complete
on_success = "successful"
on_error = "rollback"

[rollback]
script = "/etc/tedge/operations/echo-as-json.sh rollback done"
on_success = "failed"
on_error = "failed"

[successful]
action = "cleanup"

[failed]
action = "cleanup"

0 comments on commit 79cf19b

Please sign in to comment.