Uploaded image for project: 'Mender'
  1. Mender
  2. MEN-5518

deployments: device deployment life-cycle improvements

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Done
    • Priority: (None)
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
    • Backlog:
      yes
    • Days in progress:
      0

      Description

      tl;dr

      https://github.com/kjaskiewiczz/deployments/commit/07710c6fa5b0ba72019dd718c7c0e69e34b7e383

       

      Currently, when the device is starting the update, backend records the artifact name and the device type reported with the deployments/next request.

      It's possible that the device will ask for an update while being in the update process.

      It's actually part of the normal flow since introduction of update control. Part of the deployments/next response is update control map, which has to be checked by the device during update process.

      The artifact name and the device type should not change during the update process, but we already know this is not the case for some versions of the client.

      It means we should handle artifact name and device type changes in the backend somehow.

      In fact, we already have some handling in place, but I doubt it was properly designed.

      In my opinion, when there is a change in the artifact name or device type during the update process, it's an error, the deployments service should mark the device deployment as failed and the client should perform rollback.

      Unfortunately, we cannot do that. There are two reasons for that:

      1. It means changing current backend behavior and breaking backward compatibility (I think it's a smaller issue, but I'm not sure);
      2. Customers have devices in the field with client which is misbehaving and reporting different artifact name/device type during the update process. Applying handling mentioned above would prevent those devices from applying any update.

      The question is what to do?

      Current handling.

      Artifact name change

      When the device is asking for given deployment for the first time and the artifact name reported by the device is the same as the one from the deployment, backend will mark the device deployment as "already installed" and return empty response to the device.

      In case the artifact name reported by the device is different than the one form the deployment or the  deployment was already started for the device, the backend will return deployments instructions. 

      This behavior is pretty new. Previous one was:

      When the device is asking for given deployment for the first time and the artifact name reported by the device is the same as the one from the deployment, backend will mark the device deployment as "already installed" and return empty response to the device.

      In case the artifact name reported by the device is different than the one form the deployment or the  deployment was already started for the device, the backend will return deployments instructions. 

      Device type change

      When the device is asking for particular deployment for the first time, deployments service selects the artifact based on the device type reported by the device (and possibly based on other things) and records both, selected artifact and the device type with the device deployment object. In case the deployments service was not able to select the artifact for the device, deployments service will set the status of the device deployment to "no artifact" and will return empty response to the device.

      When the device is asking for the deployment during update process (device deployment object exist and contains device type), and the device type reported by the device is different then the one recorded in the device deployment object, deployment service will try to select new artifact for the device.

      Proposal

      Artifact name change

      Keep current behavior.

      Device type change

      Apply similar behavior to the one from artifact name change.

      It means ignoring device type reported by the device if the deployment for this device is in progress.

        Attachments

          Activity

            People

            Assignee:
            kjaskiewicz Krzysztof Jaśkiewicz
            Reporter:
            kjaskiewicz Krzysztof Jaśkiewicz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support