Update/Upgrade Custom Application Version

If I create a custom application by cloning a subscribed application with overrule enabled, is it possible to apply future new versions from subscribed application to the custom application?

Hi leonard_chu

yes it is possible. There are two way

Quick and dirty way is to delete the cloned device management application and recreate it. But…
Deleting the outdated clone is probably a bad idea as this will result in different application Ids… If you previously had your cloned device management assigned to e.g. a global role, that global role might no longer be able to access the app and needs to be reconfigured with the new clone.

The better approach is probably:

  1. Keep the outdated device management clone

  2. Temporarily create a new device management from the new “subscribed” version of the app with not selecting Overrule subscribed application

  3. Go to the activity log of that new cloned application (detail view of the app) and download the zip file of the new version (Try to avoid the “Updated files in application” entry and choose the oldest entry within that list).

  4. Upload the downloaded zip file to the outdate clone

  5. Remove the temporarily create a device management clone

I have tested this with the Cockpit Application but not tried with the device management application

Thanks very much, @Kai_Reinhardt.
This should work, however it would require extra efforts, especially at scale.
We could probably create a script to automate this.

Do you know if there is any intention to make this as a feature of the platform?
We started to use Extensions recently, and noticed Extensions can only be installed on “custom” Applications. But we always use “subscribed” Applications and get new versions automatically. With current offers, looks like we have to move to “custom” Applications, but then we lose the ability to receive Application auto updates.

Yes

it would mean extra effort. But the effort for me is maximum 10 minutes so not that bad.

Don’t know yet if this is planned to be a feature of the platform.

Extension can only be installed on custom Applications. Yes you will lose the ability to receive Application auto updates for the Applications provided by Cumulocity,

I would assume that these steps could be automated if need be so that manual effort can be eliminated.
Just have a look at the C8Y CLI tool: Cumulocity IoT CLI | Cumulocity IoT CLI (goc8ycli.netlify.app)

I took this as a challenge to see what the effort to support scenario using go-c8y-cli (as I’m the author)…

Good news is that it seems possible, and relatively easy to do.

The process is as follows:

  1. Find the cloned application in your current tenant (assuming you are in the child tenant). And if present save the UI plugin list for use later on

  2. Delete the previously cloned application from the current tenant

  3. Find the built-in application from the parent tenant and clone/copy it to your current tenant

  4. Update the newly cloned application with the UI plugin information taken from step 1.

This might sound like a lot, but it isn’t actually that scary once you get used to using go-c8y-cli and pipelines. The following is an example bash snippet that can does the process as described above.

# Save existing plugin information if it exists
APPLICATION_NAME=devicemanagement
PARENT_TENANT=management

APPLICATION_CONFIG=$(c8y applications list --name "$APPLICATION_NAME" --filter "owner.tenant.id neq $PARENT_TENANT" --select "config.**")

# Remove the existing application (if present)
c8y applications list --name "$APPLICATION_NAME" --filter "owner.tenant.id neq $PARENT_TENANT" | c8y applications delete --force

# Clone the previous application and apply UI plugins to the cloned application (if there were previously any)
c8y applications list --name "$APPLICATION_NAME" --filter "owner.tenant.id eq $PARENT_TENANT" \
| c8y applications copy --confirmText "Recreating $APPLICATION_NAME" "${REST_ARGS[@]}"  \
| c8y applications update --template "{name: '$APPLICATION_NAME', contextPath: $.name, key: $.name + '-application-key' }" --force \
| c8y applications update --template "$APPLICATION_CONFIG" --force

But since this action seems to be fairly common, I figured it might be more useful to create go-c8y-cli extension that can be used to package the above process into an easy-to-use command.

I’ve extended the reubenmiller/c8y-devmgmt extension to add a new command to re-clone the application. To use it you can run the following step:

  1. Install go-c8y-cli as per the documentation

  2. Install the reubenmiller/c8y-devmgmt extension

    c8y extensions install reubenmiller/c8y-devmgmt
    
  3. Set your session (see the Getting started section to learn how to create and use sessions)

  4. Run the command to re-clone/re-create the already cloned application

    c8y devmgmt applications recreate devicemanagement
    

    Below shows an example of the expected output (assuming you are running this from a console). If you run this from a CI environment, then you will get the full JSON output.

    âś“ Deleted /application/applications/109555 => 204 No Content
    ? Confirm (job: 1)
    Recreating devicemanagement [id=1, name=devicemanagement] on tenant t493319102
    [y] Yes  [a] Yes to All  [n] No  [l] No to All y
    | id          | name                  | key                                   |
    |-------------|-----------------------|---------------------------------------|
    | 109559      | devicemanagement      | devicemanagement-application-key      |
    
2 Likes

Please note that there is a reason why you should clone the applications and by doing so opting out of the “auto upgrades”.

This is meant to ensure that an “auto upgrade” would not break compatibility with an installed plugin.

So you should not just blindly upgrade these apps. Instead you should ensure that the newer version of the app is actually still compatible with the plugins you have installed.

1 Like

Thanks, @Christoph_Souris. I did start looking at go-c8y-cli a couple of days ago. It’s been very helpful. :+1:

Thanks, @Reuben_Miller2. This will definitely save lots of time for us.

I was trying to get the process @Kai_Reinhardt described earlier with go-c8y-cli. I prefer this process because it keeps the original cloned application, so that we can keep the version history.

The only step I haven’t confirmed yet is step 4, to upload zip file to the original cloned application and set it as the new active version.

I haven’t found a way to do it yet.
I wanted to use c8y applications versions create, so I tried c8y applications versions list --application devicemanagement to check existing versions, but looks like it doesn’t work with custom applications as I always get ERROR serverError: Cannot find applicationVersion for this application GET https://*.com/application/applications/2157/versions: 404 ApplicationVersion/Not Found Cannot find applicationVersion for this application

Tried with custom devicemanagement application with and without overrule enabled. However, above command works for custom extension.

Could you see anything I did wrong here?

Thanks, @Tristan_Bastian.

I agree with your comment. We are exploring options to help with the final decision.