Skip to content

Conversation

@tkfu
Copy link
Member

@tkfu tkfu commented Jan 7, 2026

No description provided.

simao and others added 30 commits April 24, 2025 13:59
latest changes from upstream

See merge request toradex/torizon-cloud/director!290
New endpoint:

- `POST` :director/api/v1/admin/remote-commands

With payload:

```
  {
    "remoteCommands":
    {
      "allowed_commands": {
        "restart-service": { // can be `restart-service`, `reboot`
          "args": ["aktualizr-torizon"]
        }
      },
      "version": "v1alpha"
    }
  }
```

Will set the allowed commands to the provided payload. This works in a
similar way as remote-sessions.
Fix quote in admin roles sql query

Closes OTA-2973

See merge request toradex/torizon-cloud/director!292
Add support for remote commands.

Closes OTA-2641

See merge request toradex/torizon-cloud/director!289
Rename MultiTargetUpdates to TargetUpdateSpec, meant to signal it
representas a specification for an update.

Rename UpdateId, that used to refer to a MTU/TargetUpdateSpec, but now
refers to an update resource with it's own id.

Removed references to scheduled updates, update scheduling can now be
done via the update resource

Simplified manifest compiler logic slightly as we can rely on the
correlation id a bit more since the resource update contains a
correlation id.

Added migration from scheduled updates to updates

This MR adds the following endpoints:

POST '/updates/devices/:device-id' with a json encoded payload with type:

```
case class CreateDeviceUpdateRequest(targets: Map[HardwareIdentifier, TargetUpdateRequest],
                                     scheduledFor: Option[Instant] = None)
```

Creates an update for a device. if `scheduledFor` it not None, it will
be scheduled

GET `/updates/devices/:device-id`

Lists the updates for the device, with the type
`PaginationResult[UpdateResponse]`, where:

```
case class UpdateResponse(updateId: UpdateId,
                          status: Update.Status,
                          createdAt: Instant,
                          scheduledFor: Option[Instant],
                          completedAt: Option[Instant],
                          packages: Map[HardwareIdentifier, TargetFilename],
                          results: Map[EcuIdentifier, UpdateResultResponse])

case class UpdateResponse(updateId: UpdateId,
                          status: Update.Status,
                          createdAt: Instant,
                          scheduledFor: Option[Instant],
                          completedAt: Option[Instant],
                          packages: Map[HardwareIdentifier, TargetFilename])

case object Scheduled extends Status
case object Assigned extends Status
case object PartiallyCompleted extends Status
case object Cancelled extends Status
case object Completed extends Status
```

GET `/updates/devices/:device-id/:update-id` returns the detail of an
update with type `UpdateDetailResponse`

```
case class UpdateDetailResponse(updateId: UpdateId,
                                status: Update.Status,
                                createdAt: Instant,
                                scheduledFor: Option[Instant],
                                completedAt: Option[Instant],
                                packages: Map[HardwareIdentifier, TargetFilename],
                                results: Map[EcuIdentifier, UpdateResultResponse])
```

GET `/uptades/devices/:device-id/:update-id/events` returns a list of
events for a device, related to the specified update, with type
`UpdateResponse`.

```
case class UpdateResponse(updateId: UpdateId,
                          status: Update.Status,
                          createdAt: Instant,
                          scheduledFor: Option[Instant],
                          completedAt: Option[Instant],
                          packages: Map[HardwareIdentifier, TargetFilename])
```

PATCH `/uptades/devices/:device-id/:update-id cancels the specified update.
Add new updates resource endpoint

See merge request toradex/torizon-cloud/director!291
batches to the database.

The last 20 manifests for a device are available through the debug UI.

A paginated endpoint providing the last 200 device manifests for a
device is available through the debug json api.

# Conflicts:
#	build.sbt
#	src/main/scala/com/advancedtelematic/director/db/Repository.scala
Filter ecus by namespace

Closes OTA-2930

See merge request toradex/torizon-cloud/director!295
Add new listener for `DeviceManifestReported`

See merge request toradex/torizon-cloud/director!293
Problem:
Scheduled updates are a bit weird in that they don't have an assignment until
the scheduled time. Our update cancelation logic assumed that all updates canceled via
the PATCH: updates/{updateId} endpoint would have an assignment and this caused a subtle
issue for cancelling scheduled updates.

When cancelling scheduled updates, the cancellAll() method would return an empty list which
resulted in never emitting a DeviceUpdateCancelled message so a device update would never be
triggered.

Solution:
Add a check inside the cancellAll() function to ensure we always return something from the
list (if the future isn't failed) even if the assignments table isn't updated.

Signed-off-by: Ben Clouser <[email protected]>
If we don't do this, we have to rely on correlationIds sent by the
user, which might not exist or be accurate.

This requires some refactoring to avoid duplication, and requires the
cancellation methdos to get from the database updates ALL updates and
not just a single update.
Return the ecu serial of the ecus with active updates in the response
[OTA-3088] publish deviceCancelled event even if no assignments exist

Closes OTA-3088

See merge request toradex/torizon-cloud/director!296
Simao Mata's avatar Fix error message when device has an active update

See merge request toradex/torizon-cloud/director!297
bump libats

# Conflicts:
#	build.sbt
#	src/main/scala/com/advancedtelematic/director/data/DataType.scala
#	src/main/scala/com/advancedtelematic/director/db/Repository.scala
Use typed parameters for pagination limit/offset

See merge request toradex/torizon-cloud/director!294
Add index
Fix delete query

See merge request toradex/torizon-cloud/director!300
Use pekko instead of akka

See merge request toradex/torizon-cloud/director!302
When searching by tags, the user can no longer use any other
filtering parameters.

The format of the tag values is restricted so it can be used with `=`
and prevent SQL injection, as we now need to dynamically build a query
string, since slick does not support searching by tuples, and
`(tag_id, tag_value)` is a tuple.

Adding more filtering methods is possible, but the dynamically build
query needs to be further complicated. The filtering methods to add
should be limited to the rows in the `Device` table.
Ignore unknown devices when searching for device ids

Closes OTA-2526

See merge request toradex/torizon-cloud/director!304
Add `success` to update events

Closes OTA-2930

See merge request toradex/torizon-cloud/director!298
Add search by tags

Closes OTA-3178

See merge request toradex/torizon-cloud/director!303
simao and others added 17 commits October 7, 2025 17:01
Added `UpdateResponse.deviceResult: Option[UpdateEcuResult]`

Instead of a `Seq` for update results, use an `Option` since there is
only one report per ecu installation. Also renamed that attribute from
`EcuInstallationResult.reports` to `result`.

Since we have multiple results, reports and success attributes, rename
`UpdateDetailResponse.results` to `ecuResults`.
Provide more info in update listing endpoint

Closes OTA-2930

See merge request toradex/torizon-cloud/director!299
Include device report in update detail response

See merge request toradex/torizon-cloud/director!305
Changes to `Seen` when its assignments move to `InFlight`. Note that
since we also check this status when cancelling an update, and this
check runs before the "assignments in flight" check, when an user
previously got a `assignment_in_flight_devices` error, they will now
get a `update_cannot_be_cancelled` error instead.

# Conflicts:
#	src/main/scala/com/advancedtelematic/director/db/UpdatesDBIO.scala
Add `Seen` status to Update

Closes OTA-3211

See merge request toradex/torizon-cloud/director!306
When fetching ecu results for device update endpoint
when calculating manifest checksum
Do not take signatures into account

Closes OTA-3242

See merge request toradex/torizon-cloud/director!308
Match ecu results on correlationId and deviceId

Closes OTA-3240

See merge request toradex/torizon-cloud/director!307
Do not consider `report_counter` when calculating manifest checksum

See merge request toradex/torizon-cloud/director!312
…aster'

OTA-3305 Return root metadata canonicalized

See merge request toradex/torizon-cloud/director!313
@tkfu tkfu merged commit 855edc9 into master Jan 7, 2026
3 checks passed
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.

4 participants