Uploaded image for project: 'Kogito'
  1. Kogito
  2. KOGITO-9729

SonataFlow builder image is not preserving resources path

    XMLWordPrintable

Details

    • 2023 Week 36-38 (from Sep 4)
    • Critical

    Description

      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

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: