Uploaded image for project: 'Serverless logic'
  1. Serverless logic
  2. SRVLOGIC-198

SonataFlow builder image is not preserving resources path

XMLWordPrintable

      Given the following CR:

      apiVersion: sonataflow.org/v1alpha08
      kind: SonataFlow
      metadata: 
        name: greeting
        annotations: 
          sonataflow.org/description: Greeting example on k8s!
          sonataflow.org/version: 0.0.1
      spec: 
        resources: 
          configMaps: 
            - configMap: 
                name: greetings-input-schema
              workflowPath: schemas
        flow: 
          start: ChooseOnLanguage
          dataInputSchema: 
            schema: schemas/input.json
            failOnValidationErrors: true
          functions: 
            - name: greetFunction
              type: custom
              operation: sysout
          states: 
            - name: ChooseOnLanguage
              type: switch
              dataConditions: 
                - condition: "${ .language == \"English\" }"
                  transition: GreetInEnglish
                - condition: "${ .language == \"Spanish\" }"
                  transition: GreetInSpanish
              defaultCondition: GreetInEnglish
            - name: GreetInEnglish
              type: inject
              data: 
                greeting: "Hello from JSON Workflow, "
              transition: GreetPerson
            - name: GreetInSpanish
              type: inject
              data: 
                greeting: "Saludos desde JSON Workflow, "
              transition: GreetPerson
            - name: GreetPerson
              type: operation
              actions: 
                - name: greetAction
                  functionRef: 
                    refName: greetFunction
                    arguments: 
                      message:  ".greeting+.name"
              end: true
      

      When building using the builder having the ConfigMap mount on schemas, the builder image would copy to resources path instead:

      INFO[0026] Running: [/bin/sh -c /home/kogito/launch/build-app.sh ./resources] 
      INFO -> Copying files from /home/kogito/serverless-workflow-project/resources, if any...
      '/home/kogito/serverless-workflow-project/resources/greeting.sw.json' -> 'src/main/resources/greeting.sw.json'
      '/home/kogito/serverless-workflow-project/resources/schemas/input.json' -> 'src/main/resources/input.json'
      '/home/kogito/serverless-workflow-project/resources/input.json' -> 'src/main/resources/input.json'
      

      Leading to this error:

      [ERROR] Invalid process: '/home/kogito/serverless-workflow-project/src/main/resources/greeting.sw.json'. Found error: {}
      java.lang.IllegalArgumentException: cannot find classpath resource schemas/input.json
      

      We should review the following code:
      https://github.com/kiegroup/kogito-images/blob/1.43.x/modules/kogito-swf/common/scripts/added/build-app.sh#L20-L27

              rhn-support-zanini Ricardo Zanini
              rhn-support-zanini Ricardo Zanini
              Jakub Schwan Jakub Schwan
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: