This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch quick-fix/spring-ai-image-ci-env-name
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 5be9f508a52ee55a21f1b453945080f95e8da1b3
Author: Claus Ibsen <[email protected]>
AuthorDate: Sun Sep 6 14:08:48 2026 +0200

    chore: propagate ci.env.name to forked test JVMs to fix spring-ai-image CI 
failure
    
    Maven does not automatically forward user properties to forked 
surefire/failsafe
    JVMs, so @DisabledIfSystemProperty(named = "ci.env.name") conditions were 
never
    evaluated in CI and the tests ran instead of being skipped.
    
    Add a ci-env-name profile in parent/pom.xml that activates when ci.env.name 
is
    defined (e.g. via MVND_OPTS in GitHub Actions) and passes it as a 
systemProperty
    to both surefire and failsafe forked JVMs. This fixes the pattern used in 
~99
    test files across the project.
    
    Also fix SpringAiImageOllamaIT to pull x/flux2-klein:4b (the image model 
under
    test) rather than the default granite4:3b chat model so the test works 
correctly
    when it does run locally with the model installed.
    
    Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
    Signed-off-by: Claus Ibsen <[email protected]>
---
 .../springai/image/SpringAiImageOllamaIT.java      | 14 ++++++++-
 parent/pom.xml                                     | 34 ++++++++++++++++++++++
 2 files changed, 47 insertions(+), 1 deletion(-)

diff --git 
a/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-image/src/test/java/org/apache/camel/component/springai/image/SpringAiImageOllamaIT.java
 
b/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-image/src/test/java/org/apache/camel/component/springai/image/SpringAiImageOllamaIT.java
index 55ed8c9d7a13..b3a6d9094c2d 100644
--- 
a/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-image/src/test/java/org/apache/camel/component/springai/image/SpringAiImageOllamaIT.java
+++ 
b/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-image/src/test/java/org/apache/camel/component/springai/image/SpringAiImageOllamaIT.java
@@ -27,6 +27,7 @@ import com.openai.core.ClientOptions;
 import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.test.infra.ollama.services.OllamaService;
+import org.apache.camel.test.infra.ollama.services.OllamaServiceConfiguration;
 import org.apache.camel.test.infra.ollama.services.OllamaServiceFactory;
 import org.apache.camel.test.junit6.CamelTestSupport;
 import org.junit.jupiter.api.Test;
@@ -67,7 +68,18 @@ public class SpringAiImageOllamaIT extends CamelTestSupport {
     Path tempDir;
 
     @RegisterExtension
-    static OllamaService OLLAMA = 
OllamaServiceFactory.createSingletonService();
+    static OllamaService OLLAMA = 
OllamaServiceFactory.createSingletonServiceWithConfiguration(
+            new OllamaServiceConfiguration() {
+                @Override
+                public String modelName() {
+                    return IMAGE_MODEL_NAME;
+                }
+
+                @Override
+                public String apiKey() {
+                    return "unused";
+                }
+            });
 
     private ImageModel imageModel;
 
diff --git a/parent/pom.xml b/parent/pom.xml
index c29ddebd4787..f986651075f7 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -4545,6 +4545,40 @@
                 </plugins>
             </build>
         </profile>
+        <profile>
+            <!-- Propagate ci.env.name to forked surefire/failsafe JVMs so that
+                 @DisabledIfSystemProperty(named = "ci.env.name") conditions 
work correctly.
+                 Maven does not automatically forward user properties to 
forked test JVMs; this
+                 profile ensures the property is available when it is set 
(e.g. in MVND_OPTS). -->
+            <id>ci-env-name</id>
+            <activation>
+                <property>
+                    <name>ci.env.name</name>
+                </property>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-surefire-plugin</artifactId>
+                        <configuration combine.children="merge">
+                            <systemPropertyVariables>
+                                <ci.env.name>${ci.env.name}</ci.env.name>
+                            </systemPropertyVariables>
+                        </configuration>
+                    </plugin>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-failsafe-plugin</artifactId>
+                        <configuration combine.children="merge">
+                            <systemPropertyVariables>
+                                <ci.env.name>${ci.env.name}</ci.env.name>
+                            </systemPropertyVariables>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
         <profile>
             <id>nullcheck</id>
             <dependencies>

Reply via email to