Search code examples
spring-cloudcloud-foundryspring-cloud-dataflow

How to upgrade the app(jar) registered as application in spring cloud dataflow to new version?


I would like to upgrade the task app registered in SCDF. Is there any way to upgrade the existing app registered to new version or else do i need to register as new application?


Solution

  • You can register multiple versions of the same app using the app register command. Once when you have a list of versions, you can then choose the default version of the app to use.

    Steps:

    dataflow:>app list --id task:timestamp
    ╔═══╤══════╤═════════╤════╤═══════════════════════════╗
    ║app│source│processor│sink│           task            ║
    ╠═══╪══════╪═════════╪════╪═══════════════════════════╣
    ║   │      │         │    │> timestamp-2.1.0.RELEASE <║
    ╚═══╧══════╧═════════╧════╧═══════════════════════════╝
    
    dataflow:>app register --name timestamp --type task --uri maven://org.springframework.cloud.task.app:timestamp-task:2.0.0.RELEASE
    Successfully registered application 'task:timestamp'
    
    dataflow:>app default --id task:timestamp --version 2.0.0.RELEASE
    New default Application task:timestamp:2.0.0.RELEASE
    
    dataflow:>app list --id task:timestamp
    ╔═══╤══════╤═════════╤════╤═══════════════════════════╗
    ║app│source│processor│sink│           task            ║
    ╠═══╪══════╪═════════╪════╪═══════════════════════════╣
    ║   │      │         │    │timestamp-2.1.0.RELEASE    ║
    ║   │      │         │    │> timestamp-2.0.0.RELEASE <║
    ╚═══╧══════╧═════════╧════╧═══════════════════════════╝
    

    However, to use the new default version, you must create a new task definition. A typical workflow would be to let the existing task finish the operation, and you can destroy and recreate+relaunch the same definition once again. The new default version will be automatically picked up in this approach.

    All that said, in the upcoming SCDF v2.3 release, we are revisiting this workflow in the context of CI/CD support for Tasks in SCDF. You can follow along with the progress here: spring-cloud/spring-cloud-dataflow#3406, and its child stories.

    UPDATE: A quick clarification on the following statement.

    However, to use the new default version, you must create a new task definition.

    This is required only for Cloud Foundry because the Task-app droplet/container is persistent in Cloud Foundry.

    If you are using SCDF in Local or in Kubernetes, you do not have to destroy, recreate, and relaunch the Task definition. Just having the new version set as the "default" in the app registry is sufficient for Local and Kubernetes.