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

Inspect all transitive dependencies of an integration #1777

Merged
merged 19 commits into from
Nov 5, 2020

Conversation

doru1004
Copy link
Contributor

Release Note

kind/feature

This patch adds more functionality to the kamel inspect subcommand. The default behavior of this command consists of outputting the top level dependencies. In this patch we enable the saving of the transitive dependencies for an integration in a specific location on the file system local to where the kamel inspect command was invoked. The transitive dependencies consists of all the jar files required for successfully running the integration.

Copy link
Contributor

@lburgazzoli lburgazzoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added some notes

pkg/cmd/inspect.go Outdated Show resolved Hide resolved
pkg/cmd/inspect.go Outdated Show resolved Hide resolved
pkg/cmd/inspect.go Outdated Show resolved Hide resolved
pkg/builder/builder_steps.go Outdated Show resolved Hide resolved
@doru1004
Copy link
Contributor Author

@lburgazzoli I think I have addressed all the comments. Please let me know what you think. I've made some changes to where the functions that compute the integration dependencies and their sanitization are defined. Let me know if you agree with the move.

Long: `Output dependencies for a list of integration files. By default this command returns the
top level dependencies only. When --all-dependencies is enabled, the transitive dependencies
will be generated by calling Maven and then copied into the directory pointed to by the
--dependencies-directory flag.`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not very sure about this. Would be useful to just get the list of dependencies without having to copy them on a folder ?

@nicolaferraro what do you think ?

@doru1004
Copy link
Contributor Author

doru1004 commented Nov 2, 2020

@lburgazzoli I have modified the patch to only print transitive dependencies. Please let me know if you have any further comments.

@@ -42,4 +42,7 @@ const (

// ImageName --
ImageName = "docker.io/apache/camel-k"

// CamelVersion --
CamelVersion = "3.6.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a readonly file, which is generated from Makefile options. We've removed the need to specify the Camel version, because a runtime version implies only one Camel version and one Quarkus version.

Instead of hardcoding it here, you can load the CamelCatalog for the current runtime version (it's embedded in the /deploy virtual file system) and retrieve it from the metadata section (

).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thanks for the feedback.

Copy link
Member

@nicolaferraro nicolaferraro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's cool @doru1004 .

The only thing strange I see is that the output looks like:

[nferraro@localhost camel-k]$ kamel inspect examples/simple.groovy --all-dependencies --output=yaml
[INFO] Scanning for projects...
[INFO] 
[INFO] ---------< org.apache.camel.k.integration:camel-k-integration >---------
[INFO] Building camel-k-integration 1.3.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- camel-k-maven-plugin:1.5.0:generate-dependency-list (default-cli) @ camel-k-integration ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.856 s
[INFO] Finished at: 2020-11-05T15:24:46+01:00
[INFO] ------------------------------------------------------------------------
dependencies:
- /home/nferraro/.m2/repository/org/apache/camel/k/camel-k-loader-groovy/1.5.0/camel-k-loader-groovy-1.5.0.jar
- /home/nferraro/.m2/repository/org/apache/camel/k/camel-k-runtime-core/1.5.0/camel-k-runtime-core-1.5.0.jar

I.e. the maven part should be probably removed from the output. Wdyt?

@nicolaferraro
Copy link
Member

That's cool @doru1004 .

The only thing strange I see is that the output looks like:

[nferraro@localhost camel-k]$ kamel inspect examples/simple.groovy --all-dependencies --output=yaml
[INFO] Scanning for projects...
[INFO] 
[INFO] ---------< org.apache.camel.k.integration:camel-k-integration >---------
[INFO] Building camel-k-integration 1.3.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- camel-k-maven-plugin:1.5.0:generate-dependency-list (default-cli) @ camel-k-integration ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.856 s
[INFO] Finished at: 2020-11-05T15:24:46+01:00
[INFO] ------------------------------------------------------------------------
dependencies:
- /home/nferraro/.m2/repository/org/apache/camel/k/camel-k-loader-groovy/1.5.0/camel-k-loader-groovy-1.5.0.jar
- /home/nferraro/.m2/repository/org/apache/camel/k/camel-k-runtime-core/1.5.0/camel-k-runtime-core-1.5.0.jar

I.e. the maven part should be probably removed from the output. Wdyt?

Or at least shown only when there's an error

@doru1004
Copy link
Contributor Author

doru1004 commented Nov 5, 2020

I.e. the maven part should be probably removed from the output. Wdyt?

The maven needs to be run to fetch the dependencies. I'm guessing your concern is regarding whether the output of that command is shown or not. Is that correct?

pkg/cmd/inspect.go Outdated Show resolved Hide resolved
pkg/cmd/inspect.go Outdated Show resolved Hide resolved
@nicolaferraro
Copy link
Member

I.e. the maven part should be probably removed from the output. Wdyt?

The maven needs to be run to fetch the dependencies. I'm guessing your concern is regarding whether the output of that command is shown or not. Is that correct?

Yes, it's only about the output. I imagine that external tools that are going to process the output of that command may get confused.

@doru1004
Copy link
Contributor Author

doru1004 commented Nov 5, 2020

After changing to use quarkus I'm getting this type errors when inspecting a simple integration:

[ERROR] 'dependencies.dependency.version' for org.apache.camel.quarkus:camel-quarkus-core:jar is missing. @ line 37, column 17
[ERROR] 'dependencies.dependency.version' for org.apache.camel.quarkus:camel-quarkus-kafka:jar is missing. @ line 41, column 17
[ERROR] 'dependencies.dependency.version' for org.apache.camel.quarkus:camel-quarkus-slack:jar is missing. @ line 45, column 17

Any thoughts?

@nicolaferraro
Copy link
Member

After changing to use quarkus I'm getting this type errors when inspecting a simple integration:

[ERROR] 'dependencies.dependency.version' for org.apache.camel.quarkus:camel-quarkus-core:jar is missing. @ line 37, column 17
[ERROR] 'dependencies.dependency.version' for org.apache.camel.quarkus:camel-quarkus-kafka:jar is missing. @ line 41, column 17
[ERROR] 'dependencies.dependency.version' for org.apache.camel.quarkus:camel-quarkus-slack:jar is missing. @ line 45, column 17

Any thoughts?

I think you need to add the quarkus bom as it's done in the builder

@doru1004
Copy link
Contributor Author

doru1004 commented Nov 5, 2020

@nicolaferraro I resolved the error. The change involves moving to running with Quarkus specific project building and dependency resolution routines.

@doru1004
Copy link
Contributor Author

doru1004 commented Nov 5, 2020

@nicolaferraro I briefly had another error where a warning would be printed when running the maven command. It turned out to be an error on my side as I was using the wrong runtime dependency. Can confirm that no other output than the list of dependencies is being printed.

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

Successfully merging this pull request may close these issues.

3 participants