Repository navigation
CAMEL-26350: camel-jbang - camel plugin update selects the plugin releases again, and camel self-update runs it - #30667
Conversation
…eases again, and camel self-update runs it camel plugin add stores the exact release of a community plugin built for the CLI (CAMEL-26344), so a plugin stayed on the release of the Camel line it was added with after camel self-update, and the user had to add it again. camel plugin update [name] selects the release again for the running CLI, for the plugins whose release camel plugin add selected (the ones with camelVersions), and rewrites a plugin when another release is selected, printing the change (forage 1.6.2 -> 1.7.0 (built for Camel 4.23.0)). The new release is downloaded first, so a plugin whose new release cannot be downloaded keeps its release (exit code 1). A plugin added with --version or --gav, a plugin of the Apache Camel project and a plugin added as LATEST are reported and kept; the last gets the camel plugin add command that selects a release. When no release matches, or the releases cannot be read, it warns and keeps the plugin. A release built for the CLI is never replaced by an older one (such as when the POM of the stored release cannot be read). The configuration file is only written when a plugin changes. --dry-run reports without downloading or writing. camel self-update runs camel plugin update with the new CLI once it is installed, when there are plugins: only the new CLI knows its Camel version. A failure prints a hint and never fails the update of the CLI. --skip-plugins turns it off. --check reports what camel plugin update would change with the version to install. The load-time warning now tells to run camel plugin update.
…e again once a release for the Camel version is published A plugin such as Forage publishes its release for a new Camel version some time after the Camel release. Until then camel plugin update keeps the stored release (one built for another Camel version gains nothing), so the advice no longer promises what it cannot do yet: - camel plugin update, when the CLI is newer than all the releases, says that no release is built for this Camel version yet, keeps the stored release, and tells to run camel plugin update again when a release for the Camel version is published - the load-time warning tells to run camel plugin update to select the release built for this Camel version, if it is published - a plugin that does not link with the CLI points to camel plugin update when camel plugin add selected its release, and to camel plugin add otherwise The plugin documentation and the upgrade guide say so.
gnodet-bot
left a comment
There was a problem hiding this comment.
Well-engineered feature. The PluginUpdate branch logic, subprocess integration in SelfUpdateCommand, and PluginBaseCommand refactoring are all solid. One minor doc clarity note below.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
|
📝 Doc clarity note ( Two sentences exceed the 25-word readability guideline: Sentence 1 (45 words): "After installing a new version of the Camel CLI, Sentence 2 (49 words): "A plugin may publish that release some time after the Camel release: while the new version is newer than the Camel versions of all the releases of the plugin, the plugin keeps its release, and the CLI reminds to run Suggested rewrites:
Low severity — the meaning is clear, the sentences are just dense. This comment was generated by an AI agent, Hermès on behalf of @gnodet. |
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
|
🧪 CI tested the following changed modules:
🔬 Scalpel shadow comparison — Scalpel: 5 of 733 tested, 6 compile-only — current: 5 all testedMaveniverse Scalpel detected 5 affected modules (current approach: 5). Skip-tests mode would test 5 modules (3 direct + 5 downstream), skip tests for 6 (generated code, meta-modules) Modules Scalpel would test (5)
Modules with tests skipped (6)
💡 Manual integration tests recommended:
All tested modules (14 modules, 3m 56s total)Total reactor time: 3m 56s
Top 20 slowest modules:
|
…ile, with its footer within 80 columns CliHelpGoldenTest failed because the help of the new plugin update command was not in cli-help.txt. The footer of the command is also rewrapped: aesh wraps footer lines at 80 columns, which left single words on a line.
gnodet-bot
left a comment
There was a problem hiding this comment.
Following up on my earlier review — the doc clarity note (long sentences in camel-4x-upgrade-guide-4_24.adoc) is still open.
The new commit (add plugin update to CLI help golden file + rewrap footer within 80 columns) is clean: the footer text rewrap in PluginUpdate.java is correct and the golden file update is necessary.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
davsclaus
left a comment
There was a problem hiding this comment.
Thanks, a careful piece of work: it reuses the CAMEL-26344 selection, downloads before it rewrites an entry, does not downgrade a release already built for the CLI, and leaves the file as it is when nothing changes. The tests are deterministic and cover each decision, and the docs and upgrade guide are thorough.
A few points:
- self-update into an older CLI (
SelfUpdateCommand.java:232,:309):updatePluginsalso runs whenself-updateinstalls a CLI older than 4.24, e.g.--version 4.22.3,--version LTS/--version 4.22from a 4.24+ CLI, or a maintenance nightly. Those CLIs have noplugin update, so the child fails, and the warning tells the user to runcamel plugin update, which that version does not have. How about skipping it (or printing a short note) whenVersionHelper.compare(installed, "4.24.0") < 0, and the same incheckPlugins, so--checkdoes not preview changes that will not happen? SelfUpdateCommand.java:86: the--checkdescription still says "Only report whether a newer version is available"; it now also reports the plugin changes.--dry-run/--check"without downloading": the resolver still fetches maven-metadata and POMs into~/.m2. Maybe "without downloading the plugins or changing anything"?PluginUpdate.java:188: the reused no-match hint suggestscamel plugin add X --version <version>, which makes the entry an explicit one thatplugin update/self-updatethen never touch again. Worth a word in the hint or in the "Updating plugins" section.- Nit: the "auto-selected" check (a release version plus
camelVersions) is in bothPluginUpdate.updateandPluginHelper.addOrDelete; a small shared helper would keep them in sync. - Nit: one line in the 4.24 upgrade guide entry is far longer than the rest of its wrapping (gnodet-bot noted it too).
Claude Code on behalf of davsclaus. This review was generated by an AI agent and may contain inaccuracies; please verify all suggestions before applying.
…I older than 4.24, clearer descriptions and hints - camel self-update skips camel plugin update, and the --check preview, with a note when the Camel CLI it installs is older than 4.24 (a nightly build by its release), as such a CLI has no camel plugin update - the --check description says it also reports what camel plugin update would change - --dry-run and --check say "without downloading the plugins or changing anything", as the releases and POMs of the plugins are still read - the no-match hint of camel plugin update says that a version given with camel plugin add --version is then kept, and the Updating plugins section says so - PluginHelper.isSelectedRelease, used by camel plugin update and by the advice for a plugin that does not link - the upgrade guide entry is split into shorter sentences and wrapped as the rest of the file
|
Thanks for the reviews. All six points are addressed in e3d2846:
Claude Code on behalf of Croway |
gnodet-bot
left a comment
There was a problem hiding this comment.
Previous findings are all addressed. LGTM.
- Doc clarity (upgrade guide long sentences): ✅ split into short sentences using the suggested rewrites, now 14–24 words each
- Self-update into CLI < 4.24: ✅
hasPluginUpdate()skips the hook with a note --checkdescription: ✅ updated to mention plugin changes--dry-run/--checkwording: ✅ "without downloading the plugins or changing anything"- No-match hint: ✅ "(camel plugin update then keeps that version)" added
- Shared
isSelectedReleasehelper: ✅PluginHelper.isSelectedRelease(entry)used by bothPluginUpdateandaddOrDelete
This review was generated by an AI agent, Hermès on behalf of @gnodet.
|
LGTM |
JIRA: CAMEL-26350
Problem
Since CAMEL-26344,
camel plugin add <name>stores the exact release of a community plugin built for the CLI (for exampleio.kaoto.forage:camel-jbang-plugin-forage:1.6.2withcamelVersions=[4.22.0,4.23.0)) instead ofLATEST.camel self-updateonly replaces the CLI and never touches~/.camel-jbang-plugins.json, so after an upgrade the plugins stay on the release of the previous Camel line, the load-time check warns, and the user has to add every plugin again. New plugin patches are no longer picked up either.Change
camel plugin update [name](new). It runs the CAMEL-26344 selection again (PluginVersionResolver, not duplicated) for the running CLI. It only does this for the plugins whose releasecamel plugin addselected, which are the entries that havecamelVersions:dependency,camelVersionsandcamelVersionsSource, plusselectedForCamelwhen the nearest older release is selected. It drops the cachedresolvedclass path. A release that cannot be downloaded or loaded keeps the old entry, and the command exits with1.--version/--gav, a plugin of the Apache Camel project, and a plugin added asLATEST(legacy) are reported and kept as they are. The legacy one gets thecamel plugin addcommand that selects a release.camel plugin update <name>again once a release built for this Camel version is published. A plugin such as Forage publishes one release per Camel version, some time after the Camel release, and a release built for another Camel minor gains nothing.selectedForCamelis not set, so the load-time warning keeps reminding.camel plugin add <name> --version <version>adds "(camel plugin update then keeps that version)", because an entry added that way is explicit and is no longer updated.plugin add's own output is unchanged.--dry-runreports what would change, without downloading the plugins or changing anything. The releases and POMs of the plugins are still read.PluginHelper.isSelectedRelease(entry)is the single check for an entry whose releasecamel plugin addselected: a release version pluscamelVersions. Bothplugin updateand the link-error advice use it.Run 'camel plugin update <name>' to select the release built for this Camel version (if it is published).The load path is otherwise unchanged: it only warns and makes no network calls.camel plugin update <name>for an entry whose releasecamel plugin addselected. Other entries keep thecamel plugin add <name>advice.camel self-update. It always runs the new launcher'scamel plugin updateafter a successful install: releases, release-line/LTS pins and nightly builds. It uses<versionsRoot>/<version>/bin/camel.sh, orcamel.batthroughcmd.exe /con Windows, withCAMEL_SELF_UPDATE_CHECK=false. Only the new CLI knows the Camel version it is built for.--skip-pluginsturns it off.--version 4.22.3, an LTS or X.Y pin that resolves to 4.22.x, or a maintenance nightly, which is compared by its release), there is nocamel plugin updateto run. It skips the hook, and the--checkpreview, withNote: Camel CLI 4.23.0 has no camel plugin update, so the plugins are kept as they are.--checkfinds a newer version, it runscamel plugin updatein-process as a dry run for that version. The--checkdescription says so.runInstallerwas extracted intorunProcess, which keeps the same timeout, output drain and environment override, and is shared by both processes.User-visible behaviour
The lines are the messages that the tests assert. The two Forage blocks are real output: the launcher built from this branch, Maven Central, and a throwaway
CAMEL_CLI_PLUGIN_CONFIGwith a forage 1.6.2 entry ([4.22.0,4.23.0)). The configuration was unchanged aftercamel plugin update, and running it again gave the same output. The release numbers in theself-updateblocks are illustrative.Tests
PluginUpdateTest(new). It uses the existingFakePluginDownloaderfixture plugin and has no network calls. It tests the update decisions only, because the selection algorithm is already covered byPluginVersionResolverTestandPluginAddTest:selectedForCamelonly (parameterized)--versionis then kept), a stored release beyond the lines read, and no downgrade when the POM cannot be read (parameterized)SelfUpdateIntegrationTest: one parameterized test drives the realinstall.sh. The fixture launcher now answerspluginwith what it ran. The rows cover: the new launcher runsplugin update,--skip-plugins, a failing plugin update does not fail the CLI update, the--checkpreview,--check --skip-plugins, and an install of a CLI older than 4.24, which skips the hook with a note. The plugin configuration is given only through the child environment. The test also isolates the CLI home from the developer's one.PluginHelperTest: the expected text of the load-time hint is updated. In the existing not-linking export test, one of the two plugins is now an auto-selected release, so it asserts thecamel plugin updateadvice for it and thecamel plugin addadvice for the other one.CliHelpGoldenTest:golden/cli-help.txthas the help ofcamel plugin update. Its footer is wrapped within 80 columns, as aesh wraps longer footer lines.camel-jbang-core3,431 plus 49 serial, andcamel-launcher426 (47 of them skipped because they are Windows-only).Upgrade note
The 4.24 upgrade guide has a new entry: "camel-jbang - camel self-update updates the plugins". It is written in short sentences and wrapped at 120 columns. The CAMEL-26344 entry now points to
camel plugin update. The new entry also says that a plugin may publish its release for the new Camel version after the Camel release. Until then, the plugin keeps its release and the CLI reminds the user. The plugin page (camel-jbang-projects.adoc, new "Updating plugins" section, which also covers that window) and the self-update page (camel-jbang-launcher-install.adoc) are updated. The generated command metadata and theplugin updatecommand page are regenerated.Claude Code on behalf of Croway