You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "oscerd (via GitHub)" <gi...@apache.org> on 2026/09/16 15:36:43 UTC

[PR] CAMEL-24776: camel-jbang - auto-download secret properties function deps on run, not only export [camel]

oscerd opened a new pull request, #26520:
URL: https://github.com/apache/camel/pull/26520

   ## Problem
   
   `camel-jbang run` does not auto-download the JAR that backs a secret properties function. A route using `{{secret:...}}` (or `{{configmap:...}}`) **without** an explicit `--dep=camel-kubernetes` resolves the placeholder to the wrong literal instead of the secret value — e.g. `{{secret:probe/user}}` resolves to `probe/user`. It works only when `camel-kubernetes` is added explicitly, causing misleading downstream auth failures.
   
   Reported in CAMEL-24776 (thanks to Serdar Gökay for the precise reproduction and root-cause pointer).
   
   ## Root cause
   
   In `DependencyDownloaderPropertiesFunctionResolver`, the dependency download (`secret`/`configmap` → `camel-kubernetes`, plus `base64`/`aws`/`azure`/`gcp`/`hashicorp`) was invoked only under `if (export)`. On a normal run (`export=false, transform=false`) nothing was downloaded, so `super.resolvePropertiesFunction` could not find the function, and `DefaultPropertiesParser` then interpreted `{{secret:probe/user}}` as key `secret` with default value `probe/user`.
   
   This is a regression from **CAMEL-23073** (commit `f1d57f8`), which moved the previously **unconditional** download logic behind the `export` flag while introducing the transform stubs.
   
   ## Fix
   
   Invert the branch so the dependency download runs for **both run and export**, while preserving the transform stubbing (CAMEL-23073) and the export wrapping:
   
   - `transform` → stub the function (unchanged)
   - otherwise (run **or** export) → download the backing dependency
   - export still wraps the resolved function in `ExportPropertiesFunction`
   
   The two flags are never both true (run constructs `(false, transform)`, export constructs `(export, false)`), so the reorder is behavior-preserving for the transform and export modes.
   
   ## Affected versions / backport
   
   Regression present on `main` and `camel-4.22.x`. **`camel-4.18.x` is NOT affected** — it still carries the pre-CAMEL-23073 unconditional download. Backport target: `camel-4.22.x` only.
   
   ## Test
   
   Added `DependencyDownloaderPropertiesFunctionResolverTest` (no network): a recording `DependencyDownloader` double asserts that `secret`/`configmap` trigger a `camel-kubernetes` download on **run** and **export**, and that **transform** stubs without downloading.
   
   _Claude Code on behalf of oscerd_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-24776: camel-jbang - auto-download secret properties function deps on run, not only export [camel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #26520:
URL: https://github.com/apache/camel/pull/26520#issuecomment-5702401578

   <!-- ci-tested-modules -->
   :test_tube: **CI tested the following changed modules:**
   
   - `dsl/camel-kamelet-main`
   
   ---
   
   <details><summary>:microscope: Scalpel shadow comparison — Scalpel: 7 tested, 9 compile-only — current: 6 all tested</summary>
   
   [Maveniverse Scalpel](https://github.com/maveniverse/scalpel) detected **16 affected modules** (current approach: 6).
   
   <details><summary>:warning: Modules only in Scalpel (10)</summary>
   
   - `camel-jbang-core`
   - `camel-jbang-it`
   - `camel-jbang-main`
   - `camel-jbang-plugin-edit`
   - `camel-jbang-plugin-generate`
   - `camel-jbang-plugin-kubernetes`
   - `camel-jbang-plugin-test`
   - `camel-kamelet-main`
   - `camel-launcher`
   - `coverage`
   
   </details>
   
   **Skip-tests mode would test 7 modules** (1 direct + 6 downstream), **skip tests for 9** (generated code, meta-modules)
   
   <details><summary>Modules Scalpel would test (7)</summary>
   
   - `camel-jbang-mcp`
   - `camel-jbang-plugin-mcp`
   - `camel-jbang-plugin-route-parser`
   - `camel-jbang-plugin-tui`
   - `camel-jbang-plugin-validate`
   - `camel-kamelet-main`
   - `camel-launcher-container`
   
   </details>
   
   <details><summary>Modules with tests skipped (9)</summary>
   
   - `camel-jbang-core`
   - `camel-jbang-it`
   - `camel-jbang-main`
   - `camel-jbang-plugin-edit`
   - `camel-jbang-plugin-generate`
   - `camel-jbang-plugin-kubernetes`
   - `camel-jbang-plugin-test`
   - `camel-launcher`
   - `coverage`
   
   </details>
   
   > :information_source: Shadow mode — Scalpel observes but does not affect test execution. [Learn more](https://github.com/maveniverse/scalpel)
   
   </details>
   
   <details><summary>All tested modules (16 modules, 3m 30s total)</summary>
   
   **Total reactor time:** 3m 30s
   
   | Module | Duration | Status |
   | --- | --- | --- |
   | Camel :: Launcher | 50.8s | SUCCESS |
   | Camel :: JBang :: Plugin :: TUI | 50.5s | SUCCESS |
   | Camel :: JBang :: MCP | 41.1s | SUCCESS |
   | Camel :: JBang :: Plugin :: Kubernetes | 22.8s | SUCCESS |
   | Camel :: Kamelet Main | 11.9s | SUCCESS |
   | Camel :: JBang :: Plugin :: Testing | 10.8s | SUCCESS |
   | Camel :: JBang :: Plugin :: Validate | 7.8s | SUCCESS |
   | Camel :: Coverage | 5.0s | SUCCESS |
   | Camel :: JBang :: Plugin :: Edit | 2.0s | SUCCESS |
   | Camel :: JBang :: Plugin :: MCP | 1.8s | SUCCESS |
   | Camel :: JBang :: Plugin :: Generate | 1.7s | SUCCESS |
   | Camel :: JBang :: Integration tests | 1.3s | SUCCESS |
   | Camel :: JBang :: Main | 1.0s | SUCCESS |
   | Camel :: JBang :: Plugin :: Route Parser | 1.0s | SUCCESS |
   | Camel :: Launcher :: Container | 0.9s | SUCCESS |
   | Camel :: JBang :: Core | n/a |  |
   
   **Top 20 slowest modules:**
   - `Camel :: Launcher` (50.8s)
   - `Camel :: JBang :: Plugin :: TUI` (50.5s)
   - `Camel :: JBang :: MCP` (41.1s)
   - `Camel :: JBang :: Plugin :: Kubernetes` (22.8s)
   - `Camel :: Kamelet Main` (11.9s)
   - `Camel :: JBang :: Plugin :: Testing` (10.8s)
   - `Camel :: JBang :: Plugin :: Validate` (7.8s)
   - `Camel :: Coverage` (5.0s)
   - `Camel :: JBang :: Plugin :: Edit` (2.0s)
   - `Camel :: JBang :: Plugin :: MCP` (1.8s)
   - `Camel :: JBang :: Plugin :: Generate` (1.7s)
   - `Camel :: JBang :: Integration tests` (1.3s)
   - `Camel :: JBang :: Main` (1.0s)
   - `Camel :: JBang :: Plugin :: Route Parser` (1.0s)
   - `Camel :: Launcher :: Container` (0.9s)
   
   </details>
   
   ---
   :gear: [View full build and test results](https://github.com/apache/camel/actions/runs/35130628205)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-24776: camel-jbang - auto-download secret properties function deps on run, not only export [camel]

Posted by "gnodet-bot (via GitHub)" <gi...@apache.org>.
gnodet-bot commented on PR #26520:
URL: https://github.com/apache/camel/pull/26520#issuecomment-5700246891

   <!-- camel-backport-bot -->
   
   ### 🔄 Backport Bot
   
   This bugfix targets `main` and may need porting to:
   - `camel-4.22.x`
   
   Labels `port/<branch>` have been added. Remove a label to opt out of porting to that branch.
   
   Port PRs will be created automatically when this PR is merged. Comment `/port` to create them now.
   
   ℹ️ If you push additional commits after `/port`, use `/port` again to update the port PRs.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-24776: camel-jbang - auto-download secret properties function deps on run, not only export [camel]

Posted by "gnodet-bot (via GitHub)" <gi...@apache.org>.
gnodet-bot commented on code in PR #26520:
URL: https://github.com/apache/camel/pull/26520#discussion_r4027904212


##########
dsl/camel-kamelet-main/src/test/java/org/apache/camel/main/download/DependencyDownloaderPropertiesFunctionResolverTest.java:
##########
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.main.download;
+
+import java.lang.reflect.Proxy;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.camel.impl.engine.SimpleCamelContext;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * Regression test for CAMEL-24776: a normal run (not only export) must auto-download the JAR that backs a secret
+ * properties function - e.g. camel-kubernetes for {@code {{secret:...}}} and {@code {{configmap:...}}} - so the
+ * function can be resolved. Otherwise the placeholder is silently parsed as a key with a default value and resolves to
+ * the wrong literal.
+ */
+public class DependencyDownloaderPropertiesFunctionResolverTest {
+
+    private static final String KUBERNETES = "org.apache.camel:camel-kubernetes";
+
+    @Test
+    void runDownloadsKubernetesForSecretFunction() {
+        assertTrue(resolveAndRecordDownloads(false, false, "secret").contains(KUBERNETES),
+                "run must auto-download camel-kubernetes for the secret function");
+    }
+
+    @Test
+    void runDownloadsKubernetesForConfigmapFunction() {
+        assertTrue(resolveAndRecordDownloads(false, false, "configmap").contains(KUBERNETES),
+                "run must auto-download camel-kubernetes for the configmap function");
+    }
+
+    @Test
+    void exportStillDownloadsKubernetesForSecretFunction() {
+        assertTrue(resolveAndRecordDownloads(true, false, "secret").contains(KUBERNETES),
+                "export must keep auto-downloading camel-kubernetes for the secret function");
+    }
+
+    @Test
+    void transformStubsWithoutDownloading() {
+        assertEquals(List.of(), resolveAndRecordDownloads(false, true, "secret"),

Review Comment:
   The test suite only covers the `secret` and `configmap` → `camel-kubernetes` path. The other four mappings in `downloadPropertiesFunctionDependency` — `base64` → `camel-base64`, `aws` → `camel-aws-secrets-manager`, `azure` → `camel-azure-key-vault`, `gcp` → `camel-google-secret-manager`, `hashicorp` → `camel-hashicorp-vault` — have no regression test here. If any of those mappings regress (e.g., function name typo, removed `if` branch), this test suite won't catch it.
   
   Consider adding at least one more test for a non-Kubernetes mapping, for example:
   ```java
   @Test
   void runDownloadsCamelBase64ForBase64Function() {
       assertTrue(resolveAndRecordDownloads(false, false, "base64").contains("org.apache.camel:camel-base64"),
               "run must auto-download camel-base64 for the base64 function");
   }
   
   @Test
   void runDownloadsAwsSecretsManagerForAwsFunction() {
       assertTrue(resolveAndRecordDownloads(false, false, "aws").contains("org.apache.camel:camel-aws-secrets-manager"),
               "run must auto-download camel-aws-secrets-manager for the aws function");
   }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-24776: camel-jbang - auto-download secret properties function deps on run, not only export [camel]

Posted by "oscerd (via GitHub)" <gi...@apache.org>.
oscerd merged PR #26520:
URL: https://github.com/apache/camel/pull/26520


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-24776: camel-jbang - auto-download secret properties function deps on run, not only export [camel]

Posted by "gnodet-bot (via GitHub)" <gi...@apache.org>.
gnodet-bot commented on PR #26520:
URL: https://github.com/apache/camel/pull/26520#issuecomment-5703892712

   <!-- camel-backport-bot -->
   
   ### 🔄 Backport Bot
   
   **Conflicts (🤖 agent dispatched to resolve):**
   - ⚠️ `camel-4.22.x` — Command failed: gh pr create --repo apache/camel --base camel-4.22.x --head gnodet-bot:backport/26520-to-camel-4.22.x --title [backport camel-4.22.x] CAMEL-24776: camel-jbang - auto-download secret properties function deps on run, not only export --body <!-- camel-backport-bot -->
   
   ## Backport of #26520
   
   Cherry-pick of #26520 onto `camel-4.22.x`.
   
   **Original PR:** #26520 - CAMEL-24776: camel-jbang - auto-download secret properties function deps on run, not only export
   **Original author:** @oscerd
   **Target branch:** `camel-4.22.x`
    --label backport,dsl --assignee oscerd
   pull request update failed: GraphQL: gnodet-bot does not have permission to update the pull request PR_kwDOAAMl7c8AAAABD06Rvg. (updatePullRequest)
   
   
   ℹ️ If you push additional commits after `/port`, use `/port` again to update the port PRs.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-24776: camel-jbang - auto-download secret properties function deps on run, not only export [camel]

Posted by "oscerd (via GitHub)" <gi...@apache.org>.
oscerd commented on code in PR #26520:
URL: https://github.com/apache/camel/pull/26520#discussion_r4029071098


##########
dsl/camel-kamelet-main/src/test/java/org/apache/camel/main/download/DependencyDownloaderPropertiesFunctionResolverTest.java:
##########
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.main.download;
+
+import java.lang.reflect.Proxy;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.camel.impl.engine.SimpleCamelContext;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * Regression test for CAMEL-24776: a normal run (not only export) must auto-download the JAR that backs a secret
+ * properties function - e.g. camel-kubernetes for {@code {{secret:...}}} and {@code {{configmap:...}}} - so the
+ * function can be resolved. Otherwise the placeholder is silently parsed as a key with a default value and resolves to
+ * the wrong literal.
+ */
+public class DependencyDownloaderPropertiesFunctionResolverTest {
+
+    private static final String KUBERNETES = "org.apache.camel:camel-kubernetes";
+
+    @Test
+    void runDownloadsKubernetesForSecretFunction() {
+        assertTrue(resolveAndRecordDownloads(false, false, "secret").contains(KUBERNETES),
+                "run must auto-download camel-kubernetes for the secret function");
+    }
+
+    @Test
+    void runDownloadsKubernetesForConfigmapFunction() {
+        assertTrue(resolveAndRecordDownloads(false, false, "configmap").contains(KUBERNETES),
+                "run must auto-download camel-kubernetes for the configmap function");
+    }
+
+    @Test
+    void exportStillDownloadsKubernetesForSecretFunction() {
+        assertTrue(resolveAndRecordDownloads(true, false, "secret").contains(KUBERNETES),
+                "export must keep auto-downloading camel-kubernetes for the secret function");
+    }
+
+    @Test
+    void transformStubsWithoutDownloading() {
+        assertEquals(List.of(), resolveAndRecordDownloads(false, true, "secret"),

Review Comment:
   Good catch — extended the regression test to cover the remaining mappings on run as well: `base64`→`camel-base64`, `aws`→`camel-aws-secrets-manager`, `azure`→`camel-azure-key-vault`, `gcp`→`camel-google-secret-manager`, `hashicorp`→`camel-hashicorp-vault`, alongside the existing `secret`/`configmap`→`camel-kubernetes` cases (9 tests total). A removed branch or a wrong artifactId in any mapping is now caught. Done in f38bcb5.
   
   _Claude Code on behalf of oscerd_



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-24776: camel-jbang - auto-download secret properties function deps on run, not only export [camel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #26520:
URL: https://github.com/apache/camel/pull/26520#issuecomment-5700214661

   :star2: Thank you for your contribution to the Apache Camel project! :star2:
     :robot: CI automation will test this PR automatically.
   
     :camel: 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](https://camel.apache.org/community/team/#committers) have access to the summary.
     
     :warning: Be careful when sharing logs. Review their contents before sharing them publicly.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-24776: camel-jbang - auto-download secret properties function deps on run, not only export [camel]

Posted by "gnodet-bot (via GitHub)" <gi...@apache.org>.
gnodet-bot commented on PR #26520:
URL: https://github.com/apache/camel/pull/26520#issuecomment-5703953795

   <!-- camel-backport-bot -->
   
   ### 🔄 Backport Bot
   
   **Port PRs updated:**
   - 🔄 `camel-4.22.x` → #26527 (force-pushed)
   
   ℹ️ If you push additional commits after `/port`, use `/port` again to update the port PRs.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org