This is an automated email from the ASF dual-hosted git repository. luigidemasi pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-kit.git
commit 11c575fe0c294f2e4aaef17cdf64f8409d22cd80 Author: Ankit Garg <[email protected]> AuthorDate: Sat Oct 31 04:23:18 2026 +0530 fix #147: pin the Camel version in the generated run.sh The run-script guide generated `jbang camel@apache/camel run ...` without `--camel-version`, so run.sh used the Camel version the JBang alias defaults to (4.22.0) instead of `project.camelVersion` from `.camel-kit/config.properties` (for example 4.22.1). Pass `CAMEL_VERSION` to the guide from the orchestrator, add `--camel-version={CAMEL_VERSION}` to the template and the mandatory rules, and make the plan task read it and verify the flag is present. Add a consistency test for the three files. Co-authored-by: Claude Sonnet 5.5 <[email protected]> --- .../resources/skills/camel-implement/guides/orchestrator.md | 2 +- .../resources/skills/camel-implement/guides/run-script.md | 10 ++++++++-- .../skills/camel-plan/guides/task-template-greenfield.md | 7 ++++--- .../apache/camel/kit/generator/ResourceConsistencyTest.java | 13 +++++++++++++ 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/kit/camel-kit-core/src/main/resources/skills/camel-implement/guides/orchestrator.md b/kit/camel-kit-core/src/main/resources/skills/camel-implement/guides/orchestrator.md index 325aa0d7..69074138 100644 --- a/kit/camel-kit-core/src/main/resources/skills/camel-implement/guides/orchestrator.md +++ b/kit/camel-kit-core/src/main/resources/skills/camel-implement/guides/orchestrator.md @@ -116,7 +116,7 @@ The properties validation gate (properties-generation.md ยง5.4) is part of this **Main runtime:** - Load `guides/run-script.md` -- Pass: `MODULE_NAME`, `MODULE_DIR`, `ROUTE_FILES` (every module route), `XSL_FILES` (every module XSLT file) +- Pass: `MODULE_NAME`, `MODULE_DIR`, `CAMEL_VERSION`, `ROUTE_FILES` (every module route), `XSL_FILES` (every module XSLT file) **Spring Boot / Quarkus:** - Load `guides/maven-dependencies.md` diff --git a/kit/camel-kit-core/src/main/resources/skills/camel-implement/guides/run-script.md b/kit/camel-kit-core/src/main/resources/skills/camel-implement/guides/run-script.md index 5089f067..33a688d9 100644 --- a/kit/camel-kit-core/src/main/resources/skills/camel-implement/guides/run-script.md +++ b/kit/camel-kit-core/src/main/resources/skills/camel-implement/guides/run-script.md @@ -2,8 +2,9 @@ This guide generates `run.sh` for JBang runtime only. -**Context variables:** `MODULE_NAME`, `MODULE_DIR`, `ROUTE_FILES` (every module `.camel.yaml` file), `XSL_FILES` (every -module XSLT DataMapper file). +**Context variables:** `MODULE_NAME`, `MODULE_DIR`, `CAMEL_VERSION` (`project.camelVersion` from +`.camel-kit/config.properties`), `ROUTE_FILES` (every module `.camel.yaml` file), `XSL_FILES` (every module XSLT +DataMapper file). --- @@ -12,6 +13,7 @@ module XSLT DataMapper file). | Rule | Detail | |------|--------| | JBang alias | Use `jbang camel@apache/camel run` -- **NOT** `org.apache.camel:camel-jbang:VERSION:runner` (non-existent Maven artifact) and **NOT** bare `camel run` (requires global install) | +| Camel version | Pass `--camel-version={CAMEL_VERSION}` so the script runs the version the project was designed against. Without it the alias runs the Camel version its own script defaults to, which can differ from `project.camelVersion` | | Route files | List every file in `ROUTE_FILES` in the single `camel run` command | | XSL files | List every file in `XSL_FILES` in the same command; omit XSL arguments only when the list is empty | | Properties | Pass via `--properties=application.properties` | @@ -40,9 +42,13 @@ echo "Starting {MODULE_NAME} integration..." jbang camel@apache/camel run \ {route-file-1}.camel.yaml {route-file-N}.camel.yaml \ {xslt-file-1}.xsl {xslt-file-N}.xsl \ + --camel-version={CAMEL_VERSION} \ --properties=application.properties ``` +Replace `{CAMEL_VERSION}` with the literal version read from `.camel-kit/config.properties` (for example `4.22.1`), never +with a placeholder or a stripped minor version. + Expand `ROUTE_FILES` and `XSL_FILES` completely and remove the illustrative `-1`/`-N` placeholders. Never reduce the script to the active flow. When `XSL_FILES` is empty, omit that continued line entirely. diff --git a/kit/camel-kit-core/src/main/resources/skills/camel-plan/guides/task-template-greenfield.md b/kit/camel-kit-core/src/main/resources/skills/camel-plan/guides/task-template-greenfield.md index 04cf4815..21ef9f35 100644 --- a/kit/camel-kit-core/src/main/resources/skills/camel-plan/guides/task-template-greenfield.md +++ b/kit/camel-kit-core/src/main/resources/skills/camel-plan/guides/task-template-greenfield.md @@ -221,13 +221,14 @@ their Maven launch commands and must not receive `run.sh`. - [ ] Inventory every module `.camel.yaml` route as `ROUTE_FILES` - [ ] Inventory every module XSLT DataMapper file as `XSL_FILES` (the list may be empty) -- [ ] Generate one `run.sh` whose single Camel command lists every `ROUTE_FILES` and `XSL_FILES` entry +- [ ] Read `CAMEL_VERSION` from `project.camelVersion` in `.camel-kit/config.properties` +- [ ] Generate one `run.sh` whose single Camel command lists every `ROUTE_FILES` and `XSL_FILES` entry and passes `--camel-version=[CAMEL_VERSION]` - [ ] Make the script executable with `chmod +x [MODULE_DIR]run.sh` -- [ ] Verify: `test -x [MODULE_DIR]run.sh` exits 0 and the command contains every inventoried route/XSL file +- [ ] Verify: `test -x [MODULE_DIR]run.sh` exits 0, the command contains every inventoried route/XSL file and `grep -q -- '--camel-version=' [MODULE_DIR]run.sh` succeeds **Review:** - [ ] Spec compliance: the script launches the complete module, not one flow -- [ ] Code quality: JBang alias, properties argument, and strict shell flags match the run-script guide +- [ ] Code quality: JBang alias, Camel version pin, properties argument, and strict shell flags match the run-script guide ``` ### Task Template: Generate Docker Compose (consolidated) diff --git a/kit/camel-kit-core/src/test/java/org/apache/camel/kit/generator/ResourceConsistencyTest.java b/kit/camel-kit-core/src/test/java/org/apache/camel/kit/generator/ResourceConsistencyTest.java index 791a3e5c..9611e709 100644 --- a/kit/camel-kit-core/src/test/java/org/apache/camel/kit/generator/ResourceConsistencyTest.java +++ b/kit/camel-kit-core/src/test/java/org/apache/camel/kit/generator/ResourceConsistencyTest.java @@ -1278,6 +1278,19 @@ class ResourceConsistencyTest { assertTrue(implement.contains("`guides/maven-dependencies.md` | Spring Boot/Quarkus only")); } + @Test + void mainRunScriptPinsTheProjectCamelVersion() throws IOException { + Path root = repositoryRoot().resolve("kit/camel-kit-core/src/main/resources/skills"); + String runScript = Files.readString(root.resolve("camel-implement/guides/run-script.md")); + String orchestrator = Files.readString(root.resolve("camel-implement/guides/orchestrator.md")); + String greenfield = Files.readString(root.resolve("camel-plan/guides/task-template-greenfield.md")); + + assertTrue(runScript.contains("--camel-version={CAMEL_VERSION}")); + assertTrue(runScript.contains("`project.camelVersion`")); + assertTrue(orchestrator.contains("`MODULE_DIR`, `CAMEL_VERSION`, `ROUTE_FILES`")); + assertTrue(greenfield.contains("--camel-version=[CAMEL_VERSION]")); + } + @Test void migrationContractsPreserveRuntimeAndCanonicalTransformationEngine() throws IOException { Path root = repositoryRoot().resolve("kit/camel-kit-core/src/main/resources/skills");
