camel icon indicating copy to clipboard operation
camel copied to clipboard

Upgrade recipes based on openrewrite

Open JiriOndrusek opened this issue 1 year ago • 7 comments

ticket: https://issues.apache.org/jira/browse/CAMEL-20896

This is a draft of a migration module using Openrewrite recipes for Camel migration. This version is a extraction of recipes from project https://github.com/quarkusio/quarkus-updates/ into a Camel repository. Please look at the README.adoc to understand more about the module.

Here is a list with TODOs (the reason why this PR is a draft)

  • This module should be standalone project. It might be necessary to release new version of recipes and it wouldn't be possible if whole Camel has to be released as well.
  • Better CLI for executing the migration would be nice. Look for example on quarkus guide It would be nice to use something like camel update 4.4 (which in case of camel 3.x would trigger update to 4.0 and then to 4.4)
  • Some recipes from quarkus-updates can not be used, as they are quarkus related. (org.openrewrite.java.camel.migrate.removedExtensions)

Thequarkus-update refactor is in progress, the initial proposal is https://github.com/quarkusio/quarkus-updates/pull/177

Description

Target

  • [ ] I checked that the commit is targeting the correct branch (note that Camel 3 uses camel-3.x, whereas Camel 4 uses the main branch)

Tracking

  • [ ] If this is a large change, bug fix, or code improvement, I checked there is a JIRA issue filed for the change (usually before you start working on it).

Apache Camel coding standards and style

  • [ ] I checked that each commit in the pull request has a meaningful subject line and body.
  • [ ] I have run mvn clean install -DskipTests locally and I have committed all auto-generated changes

JiriOndrusek avatar Jun 19 '24 09:06 JiriOndrusek

@davsclaus What do you think?

JiriOndrusek avatar Jun 19 '24 09:06 JiriOndrusek

I have some recipes I'd like to contribute, if this PR eventually gets merged.

ammachado avatar Jun 19 '24 15:06 ammachado

@JiriOndrusek thanks for starting on this - looks good. We can keep the docs in the readme file here in the beginning. When its more ready then it would be good to have docs that are published on the website too. And later a blog post to introduce this feature is also welcome.

And surely rules is welcome @ammachado

davsclaus avatar Jun 20 '24 10:06 davsclaus

@JiriOndrusek thanks for starting on this - looks good. We can keep the docs in the readme file here in the beginning. When its more ready then it would be good to have docs that are published on the website too. And later a blog post to introduce this feature is also welcome.

And surely rules is welcome @ammachado

I'm not sure about the one thing mostly. I know that Quarkus team keeps recipes in the repository separated from the Quarkus project. This approach seems to me as a right call. If recipes are separated from the main repo, the release cycle is not dictated by the main repo. Therefore if some kind of change (like missing recipe) or fix needs to be released, there is no need to release the whole project (Camel in this case). I'm not sure what is needed for the recipes to be located in the standalone repository, but I'd vote for doing so.

Next action:

  • Next week my proposal to Quarkus-updates should be reviewed. Based on that, I might need to update this draft. Once proposal to Quarkus is approved, we can continue with making this draft merged and recipes artifact released (because the artifact would be required for the Quarkus's draft to be merged).

JiriOndrusek avatar Jun 20 '24 12:06 JiriOndrusek

@davsclaus @oscerd would it be possible to create a separated project for this recipes?

  • If some kind of change (like missing recipe) or fix needs to be provided in the recipes, if they are part of Camel, the whole project needs to be released.
  • Or if some lower version of camel is released, we would like to have the recipes for migration to such version in the newest recipes artifact, therefore we would need to release recipes module, which might be problematic if it is part of Camel).

What do you think?

(current status update: Quarkus-updates changes are going to be approved, I have to run manually some tests and comparisons to make that happen. )

JiriOndrusek avatar Jun 28 '24 08:06 JiriOndrusek

The previous comment brings other questions.

Currently the recipes could upgrade only to the newest camel version. It would be nice to add an option to upgrade to a specific version or to upgrade in the stream (like LTS stream 4.4.x). These functionality is not part of this PR but it would be nice to have it as an option in some CLI wrapper.

JiriOndrusek avatar Jun 28 '24 08:06 JiriOndrusek

@davsclaus @oscerd would it be possible to create a separated project for this recipes?

  • If some kind of change (like missing recipe) or fix needs to be provided in the recipes, if they are part of Camel, the whole project needs to be released.
  • Or if some lower version of camel is released, we would like to have the recipes for migration to such version in the newest recipes artifact, therefore we would need to release recipes module, which might be problematic if it is part of Camel).

What do you think?

(current status update: Quarkus-updates changes are going to be approved, I have to run manually some tests and comparisons to make that happen. )

I don't see particular reason to avoid the creation of a separated repository for this.

oscerd avatar Jun 28 '24 08:06 oscerd

Yeah we could create a new repo (need to come up with a good name): camel-upgrade (or camel-upgrade-recipes) or what a good git repo name can be. Then its easier to start there and build up a set of recipies and have this released indepdent to get started and worked out.

davsclaus avatar Jul 01 '24 19:07 davsclaus

Yeah we could create a new repo (need to come up with a good name): camel-upgrade (or camel-upgrade-recipes) or what a good git repo name can be. Then its easier to start there and build up a set of recipies and have this released indepdent to get started and worked out.

I agree with both suggested names. For the future I think hat the camel-upgrade-recipes might be better, because it would allow to create multi-module project where all modules would start with camel-upgrade-. (more modules might be necessary in the future if we would need to enhance the user experience with some helper tooling)

Questions:

  1. Once the name is settled, who would be able to create an empty project in camel repo? (I'm going to prepare changes from this PR to create a standalone project)
  2. Should I place the recipes into the sub-module for the sake of future? (I'd say yes, because it won't complicate anything even if we won't create other sub-modules

JiriOndrusek avatar Jul 02 '24 07:07 JiriOndrusek

I think @oscerd can help setup the git repo

davsclaus avatar Jul 02 '24 09:07 davsclaus

I can create that even now.

oscerd avatar Jul 02 '24 09:07 oscerd

Is the name camel-upgrade-recipes?

oscerd avatar Jul 02 '24 09:07 oscerd

Is the name camel-upgrade-recipes?

Yes

davsclaus avatar Jul 02 '24 10:07 davsclaus

https://github.com/apache/camel-upgrade-recipes

oscerd avatar Jul 02 '24 10:07 oscerd

https://github.com/apache/camel-upgrade-recipes

Thank yuo, I'll prepare a new PR to that project with the content from this PR (and fixes to make it standalone)

JiriOndrusek avatar Jul 02 '24 10:07 JiriOndrusek

Superseded by https://github.com/apache/camel-upgrade-recipes/pull/1

JiriOndrusek avatar Jul 09 '24 12:07 JiriOndrusek