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

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 541af9340a7 camel-test-infra-cli: Adds custom Dockerimage file param 
(#17828)
541af9340a7 is described below

commit 541af9340a75fc1bdaa1a6b8a5e8f7fcffd18b96
Author: Marco Carletti <[email protected]>
AuthorDate: Tue Apr 22 14:52:26 2025 +0200

    camel-test-infra-cli: Adds custom Dockerimage file param (#17828)
---
 dsl/camel-jbang/camel-jbang-it/pom.xml                   |  2 ++
 test-infra/camel-test-infra-cli/README.adoc              |  1 +
 .../camel/test/infra/cli/common/CliProperties.java       |  2 ++
 .../camel/test/infra/cli/services/CliBuiltContainer.java | 16 ++++++++++++++--
 .../infra/cli/services/CliLocalContainerService.java     |  3 ++-
 5 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/dsl/camel-jbang/camel-jbang-it/pom.xml 
b/dsl/camel-jbang/camel-jbang-it/pom.xml
index ee7673b8928..8b3f8da2b67 100644
--- a/dsl/camel-jbang/camel-jbang-it/pom.xml
+++ b/dsl/camel-jbang/camel-jbang-it/pom.xml
@@ -228,6 +228,7 @@
                 <cli.jbang.version>${project.version}</cli.jbang.version>
                 <cli.jbang.repo>apache/camel</cli.jbang.repo>
                 <cli.jbang.branch>main</cli.jbang.branch>
+                <cli.jbang.docker.file/>
                 
<shared.maven.local.repo>${settings.localRepository}</shared.maven.local.repo>
                 <x11.display>:0</x11.display>
             </properties>
@@ -273,6 +274,7 @@
                                 
<cli.service.mvn.local>${shared.maven.local.repo}</cli.service.mvn.local>
                                 
<cli.service.repo>${cli.jbang.repo}</cli.service.repo>
                                 
<cli.service.branch>${cli.jbang.branch}</cli.service.branch>
+                                
<cli.service.docker.file>${cli.jbang.docker.file}</cli.service.docker.file>
                                 
<jbang.it.assert.wait.timeout>300</jbang.it.assert.wait.timeout>
                                 <DISPLAY>${x11.display}</DISPLAY>
                             </systemPropertyVariables>
diff --git a/test-infra/camel-test-infra-cli/README.adoc 
b/test-infra/camel-test-infra-cli/README.adoc
index 2beb788a56e..30e2e894313 100644
--- a/test-infra/camel-test-infra-cli/README.adoc
+++ b/test-infra/camel-test-infra-cli/README.adoc
@@ -21,3 +21,4 @@ System variables are defined in 
link:{config-class}[CliProperties]
  - `cli.service.mvn.local` : path to the host folder mounted as container 
local maven repository
  - `cli.service.extra.hosts` : comma separated host=ip pairs to add in the 
hosts file
  - `cli.service.trusted.paths` : commas separated paths, relative to the host, 
of the files containing PEM trusted certificates
+ - `cli.service.docker.file` : path to a custom Dockerfile, by default the one 
in the classpath at _org/apache/camel/test/infra/cli/services/Dockerfile_ will 
be used
diff --git 
a/test-infra/camel-test-infra-cli/src/test/java/org/apache/camel/test/infra/cli/common/CliProperties.java
 
b/test-infra/camel-test-infra-cli/src/test/java/org/apache/camel/test/infra/cli/common/CliProperties.java
index 0924447d125..7ad8e78064a 100644
--- 
a/test-infra/camel-test-infra-cli/src/test/java/org/apache/camel/test/infra/cli/common/CliProperties.java
+++ 
b/test-infra/camel-test-infra-cli/src/test/java/org/apache/camel/test/infra/cli/common/CliProperties.java
@@ -19,6 +19,8 @@ package org.apache.camel.test.infra.cli.common;
 
 public final class CliProperties {
 
+    public static final String DOCKERFILE = "cli.service.docker.file";
+
     public static final String REPO = "cli.service.repo";
 
     public static final String BRANCH = "cli.service.branch";
diff --git 
a/test-infra/camel-test-infra-cli/src/test/java/org/apache/camel/test/infra/cli/services/CliBuiltContainer.java
 
b/test-infra/camel-test-infra-cli/src/test/java/org/apache/camel/test/infra/cli/services/CliBuiltContainer.java
index 29a72a1ceae..962798db693 100644
--- 
a/test-infra/camel-test-infra-cli/src/test/java/org/apache/camel/test/infra/cli/services/CliBuiltContainer.java
+++ 
b/test-infra/camel-test-infra-cli/src/test/java/org/apache/camel/test/infra/cli/services/CliBuiltContainer.java
@@ -74,8 +74,10 @@ public class CliBuiltContainer extends 
GenericContainer<CliBuiltContainer> {
                 "localhost/camel-cli:" + params.getCamelRef() + "-" + 
params.getCamelJBangVersion()
                                       + (params.getKeepContainerRunning() ? 
"-R" : ""),
                 false)
-                .withFileFromClasspath("Dockerfile",
-                        "org/apache/camel/test/infra/cli/services/Dockerfile")
+                .withFileFromPath("Dockerfile", 
StringUtils.isNotBlank(params.getDockerFile())
+                        ? Path.of(params.getDockerFile())
+                        : 
Path.of(MountableFile.forClasspathResource("org/apache/camel/test/infra/cli/services/Dockerfile")
+                                .getResolvedPath()))
                 .withFileFromClasspath("entrypoint.sh",
                         
"org/apache/camel/test/infra/cli/services/entrypoint.sh")
                 .withFileFromClasspath("99-ssh-jbang.conf",
@@ -130,6 +132,7 @@ public class CliBuiltContainer extends 
GenericContainer<CliBuiltContainer> {
         private Map<String, String> extraHosts;
         private List<String> trustedCertPaths;
         private String localMavenRepo;
+        private String dockerFile;
 
         public String getCamelRepo() {
             return camelRepo;
@@ -211,5 +214,14 @@ public class CliBuiltContainer extends 
GenericContainer<CliBuiltContainer> {
             this.localMavenRepo = localMavenRepo;
             return this;
         }
+
+        public String getDockerFile() {
+            return dockerFile;
+        }
+
+        public CliBuiltContainerParams setDockerFile(String dockerFile) {
+            this.dockerFile = dockerFile;
+            return this;
+        }
     }
 }
diff --git 
a/test-infra/camel-test-infra-cli/src/test/java/org/apache/camel/test/infra/cli/services/CliLocalContainerService.java
 
b/test-infra/camel-test-infra-cli/src/test/java/org/apache/camel/test/infra/cli/services/CliLocalContainerService.java
index 1b964ccf488..06f171a6048 100644
--- 
a/test-infra/camel-test-infra-cli/src/test/java/org/apache/camel/test/infra/cli/services/CliLocalContainerService.java
+++ 
b/test-infra/camel-test-infra-cli/src/test/java/org/apache/camel/test/infra/cli/services/CliLocalContainerService.java
@@ -52,7 +52,8 @@ public class CliLocalContainerService implements CliService, 
ContainerService<Cl
                 .setSshPassword(System.getProperty(CliProperties.SSH_PASSWORD, 
"jbang"))
                 .setExtraHosts(getHostsMap())
                 .setTrustedCertPaths(getCertPaths())
-                
.setLocalMavenRepo(System.getProperty(CliProperties.MVN_LOCAL_REPO)),
+                
.setLocalMavenRepo(System.getProperty(CliProperties.MVN_LOCAL_REPO))
+                .setDockerFile(System.getProperty(CliProperties.DOCKERFILE)),
              System.getProperty(CliProperties.FORCE_RUN_VERSION, ""), 
System.getProperty(CliProperties.MVN_REPOS));
     }
 

Reply via email to