KaotoIO / kaoto

The UI of the Kaoto project
https://kaoto.io
Apache License 2.0
37 stars 29 forks source link

Fix loading of Red Hat artifacts for catalog #1645

Closed apupier closed 1 week ago

apupier commented 1 week ago

the test is passing locally for me despite i checked settings.xml to not have the red hat maven repoitory and remove the org.apache/camel folder from my .m2 so maybe another specific part is failing?

relates to https://github.com/KaotoIO/kaoto/issues/1597

codecov[bot] commented 1 week ago

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Please upload report for BASE (main@94ebfb8). Learn more about missing BASE report.

Files with missing lines Patch % Lines
.../camelcatalog/maven/CamelCatalogVersionLoader.java 0.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1645 +/- ## ======================================= Coverage ? 83.98% Complexity ? 365 ======================================= Files ? 284 Lines ? 8147 Branches ? 1605 ======================================= Hits ? 6842 Misses ? 1217 Partials ? 88 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.


🚨 Try these New Features:

apupier commented 1 week ago

I think the reason it works with the test and not from command-line is that camel-yaml-dsl artifact is part of the test dependencies, consequently the schema/camelYamlDsl.json is always picked from this one and not from what is loaded dynamically

apupier commented 1 week ago

io.kaoto.camelcatalog.maven.CamelCatalogVersionLoader.configureRepositories(String) is called too late for Camel Yaml DSL loading. it is called when loading Camel Catalogs. Potential quick and dirty fix: switch order of loading catalog and camel yaml dsl in io.kaoto.camelcatalog.generator.CatalogGenerator.generate() better: configuring repositories sooner, or ensuring each of the loader are loading the repositories if they need it

sonarcloud[bot] commented 1 week ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

apupier commented 1 week ago

io.kaoto.camelcatalog.maven.CamelCatalogVersionLoader.configureRepositories(String) is called too late for Camel Yaml DSL loading. it is called when loading Camel Catalogs. Quickfix provided: calling the CamelCatalog which is configuring the repositories at first not perfect as note all versions are aligned and some others might need it but should be enough to unblock current situation

note that the provided is not efficient because the camel-yaml-dsl test dependency is leaking in the other tests, thus even without the fix the test is passing... I guess it would require to create a separate module for the test or to ensure a specific version is picked (see also next paragraph)

Another note: when several catalog are generated at same time, I'm not sure that we can ensure that it picks the exact correct version of the camel-yaml-dsl, it might be the first one found, whatever version it is; To be checked. In practice I think that most of the time there are no differences.

lordrip commented 1 week ago

When running

./mvnw package; java -jar ./target/catalog-generator-0.0.1-SNAPSHOT.jar -o ./dist/camel-catalog -k 4.6.0 -m 4.4.0.redhat-00045 -n "Default Catalog"

I got image