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

Camel JBang Update #16874

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Camel JBang Update #16874

wants to merge 3 commits into from

Conversation

Croway
Copy link
Contributor

@Croway Croway commented Jan 21, 2025

Use openrewrite recipes via Camel JBang to update Camel, Camel Spring Boot and Camel Quarkus applications:

  • update list shows versions that can be used for upgrades
$ camel update list
 VERSION                       RUNTIME        DESCRIPTION
 3.15                          Camel Quarkus  Migrates `camel 4.4` quarkus application to `camel 4.8`.
 3.8                           Camel Quarkus  Migrates `camel 4.0` quarkus application to `camel 4.4`.
 4.8.0                         Camel          Migrates Apache Camel 4 application to Apache Camel 4.8.0 
  • update run $VERSION execute the update
$ camel update run 3.15 --runtime=quarkus
...
[Logs from io.quarkus.platform:quarkus-maven-plugin]
...
$ camel update run 4.8.0
...
[Logs from openrewrite]
...

@Croway Croway force-pushed the camel-cli-update branch 2 times, most recently from 97691fe to 37de264 Compare January 21, 2025 16:21
@davsclaus
Copy link
Contributor

It is a bit confusing with CEQ vs Camel versions. I wonder if the CLI can show Camel and Runtime columns with version numbers.

We ought to have the info, ala what you can do with

camel version list --runtime=quarkus
camel version list --runtime=spring-boot

@Croway
Copy link
Contributor Author

Croway commented Jan 22, 2025

It is a bit confusing with CEQ vs Camel versions. I wonder if the CLI can show Camel and Runtime columns with version numbers.

We ought to have the info, ala what you can do with

camel version list --runtime=quarkus
camel version list --runtime=spring-boot

Good point, I expected this kind of comment, I added the runtime version information in the list like this

 VERSION                       RUNTIME        RUNTIME VERSION  DESCRIPTION
 4.4.3                         Camel Quarkus  3.8.x            Migrates `camel 4.0` quarkus application to `camel 4.4`.
 4.8.0                         Camel                           Migrates Apache Camel 4 application to Apache Camel 4.8.0
 4.8.0                         Camel Quarkus  3.15.x           Migrates `camel 4.4` quarkus application to `camel 4.8`.

And the run can be executed with the Camel version:

camel update run 4.4.3 --runtime=quarkus

I had to make some assumptions... but it is working, and I can translate Quarkus/Camel versions

@@ -68,7 +73,7 @@ public class UpdateRun extends CamelCommand {
boolean debug;

@CommandLine.Option(names = { "--quarkusMavenPluginVersion" },
defaultValue = "3.15.2")
defaultValue = "3.17.7")
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a constant for that in RuntimeType


return 0;
if (!p.waitFor(240, TimeUnit.SECONDS)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this 240 seconds an option we should make configurable ?

Comment on lines 113 to 116
if (Files.list(Path.of("."))
.filter(f -> f.getFileName().toString().equals("pom.xml"))
.count()
== 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe you can refactor as Path.of(".")).noneMatch(f -> f.getFileName().toString().equals("pom.xml"))

@Croway Croway force-pushed the camel-cli-update branch 2 times, most recently from cb3a489 to 0021d33 Compare January 24, 2025 10:38
@Croway Croway changed the title Camel cli update Camel JBang Update Jan 24, 2025
@github-actions github-actions bot added the core label Jan 24, 2025
Handle quarkus

Handle extra repos

Handle downloads concurrently

Refactor camel update
@github-actions github-actions bot removed the core label Jan 28, 2025
@Croway
Copy link
Contributor Author

Croway commented Jan 29, 2025

It is possible to define extra recipes and artifacts like
camel update run 4.9.0 --runtime=camel-main --extraRecipeArtifactCoordinates=org.openrewrite.recipe:rewrite-third-party:0.15.0 --extraActiveRecipes=io.quarkus.updates.core.quarkus30.JavaxActivationMigrationToJakartaActivatio

Considering this example, the applied recipes are the following:
[INFO] Using active recipe(s) [org.apache.camel.upgrade.CamelMigrationRecipe, io.quarkus.updates.core.quarkus30.JavaxActivationMigrationToJakartaActivation]

@davsclaus
Copy link
Contributor

@Croway it would be good to have this ready mon/tue next week

@Croway
Copy link
Contributor Author

Croway commented Jan 31, 2025

@Croway it would be good to have this ready mon/tue next week

sure thing, I'll do another round of test today and set it to ready for review. Thanks for the heads up

@Croway Croway marked this pull request as ready for review January 31, 2025 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants