Skip to content

CAMEL-26350: camel-jbang - camel plugin update selects the plugin releases again, and camel self-update runs it - #30667

Merged
Croway merged 4 commits into
apache:mainfrom
Croway:CAMEL-26350-plugin-update
Nov 23, 2026
Merged

Croway merged 4 commits into
apache:mainfrom
Croway:CAMEL-26350-plugin-update

Conversation

@Croway

@Croway Croway commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

JIRA: CAMEL-26350

Problem

Since CAMEL-26344, camel plugin add <name> stores the exact release of a community plugin built for the CLI (for example io.kaoto.forage:camel-jbang-plugin-forage:1.6.2 with camelVersions=[4.22.0,4.23.0)) instead of LATEST. camel self-update only 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 release camel plugin add selected, which are the entries that have camelVersions:

  • When another release is selected, it downloads that release first and then rewrites the entry: dependency, camelVersions and camelVersionsSource, plus selectedForCamel when the nearest older release is selected. It drops the cached resolved class path. A release that cannot be downloaded or loaded keeps the old entry, and the command exits with 1.
  • A plugin added with --version/--gav, a plugin of the Apache Camel project, and a plugin added as LATEST (legacy) are reported and kept as they are. The legacy one gets the camel plugin add command that selects a release.
  • No release is built for the CLI yet, because the CLI is newer than the Camel versions of all the releases: it keeps the stored release and warns. It says to run 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. selectedForCamel is not set, so the load-time warning keeps reminding.
  • Other no-match cases (the CLI is older than all the releases, or no release tells its Camel versions), or releases that cannot be read (offline): it warns and keeps the entry. The hint to use one of the releases with 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.
  • A release built for the CLI is never replaced by an older one. This guards against the case where the POM of the stored release cannot be read, or the stored release is on a release line beyond the ones that were read.
  • The file is only written when an entry changes, so it stays byte for byte when nothing changes.
  • --dry-run reports 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 release camel plugin add selected: a release version plus camelVersions. Both plugin update and the link-error advice use it.
  • The load-time warning now says 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.
  • When a plugin does not link with the CLI (CAMEL-26964), the advice now points to camel plugin update <name> for an entry whose release camel plugin add selected. Other entries keep the camel plugin add <name> advice.

camel self-update. It always runs the new launcher's camel plugin update after a successful install: releases, release-line/LTS pins and nightly builds. It uses <versionsRoot>/<version>/bin/camel.sh, or camel.bat through cmd.exe /c on Windows, with CAMEL_SELF_UPDATE_CHECK=false. Only the new CLI knows the Camel version it is built for.

  • It is skipped when the plugin configuration has no plugins. That configuration is read from the environment the new CLI runs with.
  • A failure or timeout prints a hint and never changes the exit code. The CLI stays installed.
  • --skip-plugins turns it off.
  • When the CLI it installs is older than 4.24 (--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 no camel plugin update to run. It skips the hook, and the --check preview, with Note: Camel CLI 4.23.0 has no camel plugin update, so the plugins are kept as they are.
  • When --check finds a newer version, it runs camel plugin update in-process as a dry run for that version. The --check description says so.
  • The process handling of runInstaller was extracted into runProcess, which keeps the same timeout, output drain and environment override, and is shared by both processes.

User-visible behaviour

$ camel plugin update
forage 1.6.2 -> 1.7.0 (built for Camel 4.23.0)
kit 0.4.0 is kept: camel plugin add did not select this release (such as one given with --version or --gav)
kubernetes is released with the Camel CLI, and uses its version
mine is kept as LATEST: it was added without the Camel versions it is built for. Run 'camel plugin add mine --groupId com.example --artifactId camel-jbang-plugin-mine' to select the release built for this Camel CLI

$ camel plugin update forage      # real output: Forage has no release for Camel 4.24 yet
WARN: No release of forage is built for Camel CLI 4.24.0-SNAPSHOT yet (the newest, 1.7.0, is built for Camel 4.23.0). Keeping forage 1.6.2: run 'camel plugin update forage' again once a release built for this Camel version is published.

$ camel forage --help             # real output: no Forage release links with 4.24 yet
WARN: forage 1.6.2 is built for Camel [4.22.0,4.23.0) but this CLI is 4.24.0-SNAPSHOT. Run 'camel plugin update forage' to select the release built for this Camel version (if it is published).
ERROR: Plugin forage cannot be loaded (it does not link with Camel 4.24.0-SNAPSHOT and may be built for another version: NoClassDefFoundError org/apache/camel/dsl/jbang/core/common/Printer): run camel plugin update forage to select the release built for this Camel version, or remove it with camel plugin delete forage

$ camel self-update --check
A new version is available (4.24.0 -> 4.25.0)
Dry run for Camel CLI 4.25.0, nothing is changed:
forage 1.7.0 -> 1.8.0 (built for Camel 4.25.0)

$ camel self-update
...
Installed Camel CLI 4.25.0 to ~/.local/share/camel-cli/versions/4.25.0
forage 1.7.0 -> 1.8.0 (built for Camel 4.25.0)

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_CONFIG with a forage 1.6.2 entry ([4.22.0,4.23.0)). The configuration was unchanged after camel plugin update, and running it again gave the same output. The release numbers in the self-update blocks are illustrative.

Tests

  • PluginUpdateTest (new). It uses the existing FakePluginDownloader fixture plugin and has no network calls. It tests the update decisions only, because the selection algorithm is already covered by PluginVersionResolverTest and PluginAddTest:
    • rewrite: moved to a new Camel line, a patch within the line, the nearest older release, and selectedForCamel only (parameterized)
    • kept with the file unchanged byte for byte: already current, no release for the CLI yet (the run-again advice), offline, a CLI older than all the releases (the hint that --version is then kept), a stored release beyond the lines read, and no downgrade when the POM cannot be read (parameterized)
    • explicit, built-in and legacy entries reported and untouched
    • a download failure keeps the old entry and exits with 1
    • a dry run for another CLI version
    • only the named plugin is updated, and the other entry stays byte for byte
    • an unknown name exits with 3
  • SelfUpdateIntegrationTest: one parameterized test drives the real install.sh. The fixture launcher now answers plugin with what it ran. The rows cover: the new launcher runs plugin update, --skip-plugins, a failing plugin update does not fail the CLI update, the --check preview, --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 the camel plugin update advice for it and the camel plugin add advice for the other one.
  • CliHelpGoldenTest: golden/cli-help.txt has the help of camel plugin update. Its footer is wrapped within 80 columns, as aesh wraps longer footer lines.
  • With JDK 21, all tests pass: camel-jbang-core 3,431 plus 49 serial, and camel-launcher 426 (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 the plugin update command page are regenerated.

Claude Code on behalf of Croway

…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.
@Croway
Croway requested review from davsclaus and gnodet November 23, 2026 13:03
…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 gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@gnodet-bot

Copy link
Copy Markdown
Contributor

📝 Doc clarity note (camel-4x-upgrade-guide-4_24.adoc, new paragraph under camel-jbang - camel self-update updates the plugins):

Two sentences exceed the 25-word readability guideline:

Sentence 1 (45 words): "After installing a new version of the Camel CLI, camel self-update now runs camel plugin update with it, which changes ~/.camel-jbang-plugins.json: a community plugin whose release camel plugin add selected moves to the newest release built for the new version, when the plugin has one."

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 camel plugin update again when the plugin is loaded."

Suggested rewrites:

After installing a new Camel CLI, camel self-update runs camel plugin update with it. This updates ~/.camel-jbang-plugins.json: community plugins whose release camel plugin add selected move to the newest release built for the new version, when the plugin has one.

A plugin may publish its release for a new Camel version some time after the Camel release. Until then, camel plugin update keeps the current release and warns — the CLI also reminds to run it again when the plugin is loaded.

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.

@github-actions

Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • docs
  • dsl/camel-jbang/camel-jbang-core
  • dsl/camel-jbang/camel-launcher

🔬 Scalpel shadow comparison — Scalpel: 5 of 733 tested, 6 compile-only — current: 5 all tested

Maveniverse 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)
  • camel-jbang-mcp ← downstream of org.apache.camel:camel-jbang-core
  • camel-jbang-plugin-mcp ← downstream of org.apache.camel:camel-jbang-core
  • camel-jbang-plugin-tui ← downstream of org.apache.camel:camel-jbang-core
  • camel-jbang-plugin-validate ← downstream of org.apache.camel:camel-jbang-core
  • camel-launcher-container ← downstream of org.apache.camel:camel-launcher
Modules with tests skipped (6)
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test

ℹ️ Shadow mode — Scalpel observes but does not affect test execution. Learn more

⚠️ Some tests are disabled on GitHub Actions (@DisabledIfSystemProperty(named = "ci.env.name")) and require manual verification:

  • dsl/camel-jbang/camel-jbang-core: 2 test(s) disabled on GitHub Actions

💡 Manual integration tests recommended:

You modified dsl/camel-jbang/camel-jbang-core, dsl/camel-jbang/camel-launcher. The related integration tests in dsl/camel-jbang/camel-jbang-it are excluded from CI. Consider running them manually:

mvn verify -f dsl/camel-jbang/camel-jbang-it -Djbang-it-test
All tested modules (14 modules, 3m 56s total)

Total reactor time: 3m 56s

Module Duration Status
Camel :: JBang :: Plugin :: TUI 54.4s SUCCESS
Camel :: Launcher 45.9s SUCCESS
Camel :: JBang :: MCP 37.3s SUCCESS
Camel :: JBang :: Plugin :: Validate 22.6s SUCCESS
Camel :: Docs 17.1s SUCCESS
Camel :: JBang :: Plugin :: Kubernetes 15.7s SUCCESS
Camel :: JBang :: Plugin :: Generate 15.4s SUCCESS
Camel :: JBang :: Plugin :: Testing 12.2s SUCCESS
Camel :: JBang :: Plugin :: Edit 6.5s SUCCESS
Camel :: JBang :: Plugin :: MCP 5.3s SUCCESS
Camel :: JBang :: Main 1.4s SUCCESS
Camel :: Launcher :: Container 1.1s SUCCESS
Camel :: JBang :: Integration tests 0.8s SUCCESS
Camel :: JBang :: Core n/a

Top 20 slowest modules:

  • Camel :: JBang :: Plugin :: TUI (54.4s)
  • Camel :: Launcher (45.9s)
  • Camel :: JBang :: MCP (37.3s)
  • Camel :: JBang :: Plugin :: Validate (22.6s)
  • Camel :: Docs (17.1s)
  • Camel :: JBang :: Plugin :: Kubernetes (15.7s)
  • Camel :: JBang :: Plugin :: Generate (15.4s)
  • Camel :: JBang :: Plugin :: Testing (12.2s)
  • Camel :: JBang :: Plugin :: Edit (6.5s)
  • Camel :: JBang :: Plugin :: MCP (5.3s)
  • Camel :: JBang :: Main (1.4s)
  • Camel :: Launcher :: Container (1.1s)
  • Camel :: JBang :: Integration tests (0.8s)

⚙️ View full build and test results

…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 gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 davsclaus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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): updatePlugins also runs when self-update installs a CLI older than 4.24, e.g. --version 4.22.3, --version LTS / --version 4.22 from a 4.24+ CLI, or a maintenance nightly. Those CLIs have no plugin update, so the child fails, and the warning tells the user to run camel plugin update, which that version does not have. How about skipping it (or printing a short note) when VersionHelper.compare(installed, "4.24.0") < 0, and the same in checkPlugins, so --check does not preview changes that will not happen?
  • SelfUpdateCommand.java:86: the --check description 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 suggests camel plugin add X --version <version>, which makes the entry an explicit one that plugin update / self-update then 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 both PluginUpdate.update and PluginHelper.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
@Croway

Croway commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the reviews. All six points are addressed in e3d2846:

  1. self-update into a CLI older than 4.24: updatePlugins and checkPlugins now skip with one note: Note: Camel CLI 4.23.0 has no camel plugin update, so the plugins are kept as they are. A nightly is compared by its release. The install docs are adjusted, and a new self-update test row covers --version 4.23.0.
  2. --check description: it now reads "Only report whether a newer version is available, and what camel plugin update would change with it".
  3. "without downloading": the --dry-run description, the docs and the comments now say "without downloading the plugins or changing anything".
  4. no-match hint: in plugin update only, it now ends with "(camel plugin update then keeps that version)". plugin add's output is unchanged. "Updating plugins" says how to go back to selected releases.
  5. shared helper: PluginHelper.isSelectedRelease(entry) is used by both PluginUpdate and addOrDelete.
  6. upgrade guide: the entry is split into short sentences using gnodet-bot's two rewrites (the dash became "and"), and wrapped at 120 columns.

Claude Code on behalf of Croway

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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
  • --check description: ✅ updated to mention plugin changes
  • --dry-run/--check wording: ✅ "without downloading the plugins or changing anything"
  • No-match hint: ✅ "(camel plugin update then keeps that version)" added
  • Shared isSelectedRelease helper: ✅ PluginHelper.isSelectedRelease(entry) used by both PluginUpdate and addOrDelete

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@Croway
Croway requested a review from davsclaus November 23, 2026 15:22
@davsclaus

Copy link
Copy Markdown
Contributor

LGTM

@Croway
Croway merged commit 2e609e7 into apache:main Nov 23, 2026
14 checks passed
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.

3 participants