Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependencies not added automatically when using dataformats #5662

Open
lsergio opened this issue Jun 20, 2024 · 5 comments
Open

Dependencies not added automatically when using dataformats #5662

lsergio opened this issue Jun 20, 2024 · 5 comments

Comments

@lsergio
Copy link
Contributor

lsergio commented Jun 20, 2024

What happened?

When I created an integration that included the following step:

steps:
- marshal:
    base64: {}

Camel-K didn't include the camel-base64 dependency automatically and it only worked after I included it explicitly in the dependencies section of the spec.

I see that for languages it does so, like in this example:

when:
- expression:
    jq:
      expression: '.store.book.price < 30'    

where the use of jq caused the required dependencies for it to work to be added automatically to the Integration classpath.

I'm assuming dataformats should work like expression languages, and that's the reason I'm opening a bug. If this is by design, please just close it.

Steps to reproduce

No response

Relevant log output

No response

Camel K version

2.2.0

@lsergio lsergio added the kind/bug Something isn't working label Jun 20, 2024
@squakez
Copy link
Contributor

squakez commented Jun 21, 2024

cc @christophd

@squakez
Copy link
Contributor

squakez commented Jun 21, 2024

@lsergio I understand this is affecting when you're adding a Kamelet, right?

@lsergio
Copy link
Contributor Author

lsergio commented Jun 21, 2024

No, this actually happened with a plain k8s Integration:

apiVersion: camel.apache.org/v1
kind: Integration
metadata:
  name: base64test
spec:
  sources:
  - name: main.yaml
    content: |-
      - from:
          uri: "rest:get:/base64"
          steps:
          - marshal:
              base64: {}
          - log:
              message: "Result: ${body}"

The Integration builds, but fails to start with the error:

Caused by: java.lang.IllegalArgumentException: Data format 'base64' could not be created. Ensure that the data format is valid and the associated Camel component is present on the classpath
	at org.apache.camel.reifier.dataformat.DataFormatReifier.createDataFormat(DataFormatReifier.java:279)
	at org.apache.camel.reifier.dataformat.DataFormatReifier.getDataFormat(DataFormatReifier.java:152)
	at org.apache.camel.reifier.dataformat.DataFormatReifier.getDataFormat(DataFormatReifier.java:112)
	at org.apache.camel.reifier.MarshalReifier.createProcessor(MarshalReifier.java:35)
	at org.apache.camel.reifier.ProcessorReifier.makeProcessor(ProcessorReifier.java:853)
	at org.apache.camel.reifier.ProcessorReifier.addRoutes(ProcessorReifier.java:593)
	at org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:213)
	... 31 more

Adding:

  dependencies:
  - "camel:base64"

causes a new kit to be built and solves the issue.

@squakez
Copy link
Contributor

squakez commented Jun 21, 2024

Ah, okey. Sorry @christophd I added a mention to you thinking it was related to Kamelets. Thans @lsergio for clarification. Then, I think this is falling under the more general problem described in #527. We discussed some possibility to enhance that by making use of Camel JBang, but, so far, no outcome. If you want, you can try fixing this by adding the parsing in our code. Look at this reference implementation #3312 as it does not seem particularly complex to develop.

@squakez squakez added kind/feature New feature or request area/DSL and removed kind/bug Something isn't working labels Jun 21, 2024
Copy link
Contributor

This issue has been automatically marked as stale due to 90 days of inactivity.
It will be closed if no further activity occurs within 15 days.
If you think that’s incorrect or the issue should never stale, please simply write any comment.
Thanks for your contributions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants