You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ma...@apache.org on 2023/07/01 17:22:37 UTC

[camel-karavan] 04/06: Fix issues with #762

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

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

commit bfe16f681b81ba680f1ab74f1b6bd980e7db8cfc
Author: Marat Gubaidullin <ma...@gmail.com>
AuthorDate: Sat Jul 1 13:12:57 2023 -0400

    Fix issues with #762
---
 karavan-cli/CLI.md                                 |   2 +-
 karavan-cli/pom-quarkus.xml                        | 129 +++++++++++++++++++++
 karavan-cli/pom.xml                                |   2 +-
 .../cli/{KaravanCli.java => InstallCommand.java}   |  18 +--
 .../apache/camel/karavan/cli/KaravanCommand.java   |  19 +++
 .../apache/camel/karavan/cli/UpgradeCommand.java   |  20 ++++
 .../src/main/resources/application.properties      |   6 +
 7 files changed, 179 insertions(+), 17 deletions(-)

diff --git a/karavan-cli/CLI.md b/karavan-cli/CLI.md
index 7f572360..d5a637ba 100644
--- a/karavan-cli/CLI.md
+++ b/karavan-cli/CLI.md
@@ -22,7 +22,7 @@
     ```
 5. Install Karavan
     ```
-    java -jar target/karavan-cli-VERSION.jar --git-repository=$GIT_REPOSITORY --git-password=$GIT_TOKEN --git-username=$GIT_USERNAME  --node-port=30777
+    java -jar target/karavan-cli-VERSION.jar install --git-repository=$GIT_REPOSITORY --git-password=$GIT_TOKEN --git-username=$GIT_USERNAME  --node-port=30777
     ```
 5. Get karavan service URL
     ```
diff --git a/karavan-cli/pom-quarkus.xml b/karavan-cli/pom-quarkus.xml
new file mode 100644
index 00000000..9fd786a3
--- /dev/null
+++ b/karavan-cli/pom-quarkus.xml
@@ -0,0 +1,129 @@
+<?xml version="1.0"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.camel.karavan</groupId>
+  <artifactId>karavan-cli</artifactId>
+  <version>3.20.2-SNAPSHOT</version>
+  <properties>
+    <compiler-plugin.version>3.10.1</compiler-plugin.version>
+    <maven.compiler.release>17</maven.compiler.release>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+    <quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
+    <quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
+    <quarkus.platform.version>2.16.7.Final</quarkus.platform.version>
+    <skipITs>true</skipITs>
+    <surefire-plugin.version>3.0.0-M7</surefire-plugin.version>
+  </properties>
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>${quarkus.platform.group-id}</groupId>
+        <artifactId>${quarkus.platform.artifact-id}</artifactId>
+        <version>${quarkus.platform.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+  <dependencies>
+    <dependency>
+      <groupId>io.quarkiverse.tektonclient</groupId>
+      <artifactId>quarkus-tekton-client</artifactId>
+      <version>0.7.0</version>
+    </dependency>
+    <dependency>
+      <groupId>io.quarkus</groupId>
+      <artifactId>quarkus-openshift-client</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>io.quarkus</groupId>
+      <artifactId>quarkus-picocli</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>io.quarkus</groupId>
+      <artifactId>quarkus-kubernetes-client</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>io.quarkus</groupId>
+      <artifactId>quarkus-arc</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>io.quarkus</groupId>
+      <artifactId>quarkus-junit5</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>${quarkus.platform.group-id}</groupId>
+        <artifactId>quarkus-maven-plugin</artifactId>
+        <version>${quarkus.platform.version}</version>
+        <extensions>true</extensions>
+        <executions>
+          <execution>
+            <goals>
+              <goal>build</goal>
+              <goal>generate-code</goal>
+              <goal>generate-code-tests</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>${compiler-plugin.version}</version>
+        <configuration>
+          <compilerArgs>
+            <arg>-parameters</arg>
+          </compilerArgs>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>${surefire-plugin.version}</version>
+        <configuration>
+          <systemPropertyVariables>
+            <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
+            <maven.home>${maven.home}</maven.home>
+          </systemPropertyVariables>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-failsafe-plugin</artifactId>
+        <version>${surefire-plugin.version}</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>integration-test</goal>
+              <goal>verify</goal>
+            </goals>
+            <configuration>
+              <systemPropertyVariables>
+                <native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
+                <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
+                <maven.home>${maven.home}</maven.home>
+              </systemPropertyVariables>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  <profiles>
+    <profile>
+      <id>native</id>
+      <activation>
+        <property>
+          <name>native</name>
+        </property>
+      </activation>
+      <properties>
+        <skipITs>false</skipITs>
+        <quarkus.package.type>native</quarkus.package.type>
+      </properties>
+    </profile>
+  </profiles>
+</project>
diff --git a/karavan-cli/pom.xml b/karavan-cli/pom.xml
index 267b0b4d..4f2dae60 100644
--- a/karavan-cli/pom.xml
+++ b/karavan-cli/pom.xml
@@ -76,7 +76,7 @@
                 <configuration>
                     <transformers>
                         <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
-                            <mainClass>org.apache.camel.karavan.cli.KaravanCli</mainClass>
+                            <mainClass>org.apache.camel.karavan.cli.KaravanCommand</mainClass>
                             <manifestEntries>
                                 <Multi-Release>true</Multi-Release>
                             </manifestEntries>
diff --git a/karavan-cli/src/main/java/org/apache/camel/karavan/cli/KaravanCli.java b/karavan-cli/src/main/java/org/apache/camel/karavan/cli/InstallCommand.java
similarity index 89%
rename from karavan-cli/src/main/java/org/apache/camel/karavan/cli/KaravanCli.java
rename to karavan-cli/src/main/java/org/apache/camel/karavan/cli/InstallCommand.java
index a852c8e9..f6248ea3 100644
--- a/karavan-cli/src/main/java/org/apache/camel/karavan/cli/KaravanCli.java
+++ b/karavan-cli/src/main/java/org/apache/camel/karavan/cli/InstallCommand.java
@@ -7,11 +7,10 @@ import java.nio.file.Path;
 import java.util.HashMap;
 import java.util.concurrent.Callable;
 
-@CommandLine.Command(name = "karavan",
+@CommandLine.Command(name = "install",
         mixinStandardHelpOptions = true,
-        version = "Karavan 3.20.2-SNAPSHOT",
-        description = "Apache Camel Karavan CLI")
-public class KaravanCli implements Callable<Integer> {
+        description = "Install Karavan")
+public class InstallCommand implements Callable<Integer> {
 
     @CommandLine.Option(names = {"-v", "--version"}, required = true, description = "Karavan version", defaultValue = "3.20.2-SNAPSHOT")
     private String version;
@@ -107,15 +106,4 @@ public class KaravanCli implements Callable<Integer> {
         }
         return 0;
     }
-
-    public static void main(String... args) {
-        CommandLine commandLine = new CommandLine(new KaravanCli());
-        commandLine.parseArgs(args);
-        if (commandLine.isUsageHelpRequested()) {
-            commandLine.usage(System.out);
-            System.exit(0);
-        }
-        int exitCode = commandLine.execute(args);
-        System.exit(exitCode);
-    }
 }
diff --git a/karavan-cli/src/main/java/org/apache/camel/karavan/cli/KaravanCommand.java b/karavan-cli/src/main/java/org/apache/camel/karavan/cli/KaravanCommand.java
new file mode 100644
index 00000000..5963ae6f
--- /dev/null
+++ b/karavan-cli/src/main/java/org/apache/camel/karavan/cli/KaravanCommand.java
@@ -0,0 +1,19 @@
+package org.apache.camel.karavan.cli;
+
+import picocli.CommandLine;
+
+@CommandLine.Command(mixinStandardHelpOptions = true, subcommands = {InstallCommand.class, UpgradeCommand.class})
+public class KaravanCommand {
+
+
+    public static void main(String... args) {
+        CommandLine commandLine = new CommandLine(new KaravanCommand());
+        commandLine.parseArgs(args);
+        if (commandLine.isUsageHelpRequested()) {
+            commandLine.usage(System.out);
+            System.exit(0);
+        }
+        int exitCode = commandLine.execute(args);
+        System.exit(exitCode);
+    }
+}
diff --git a/karavan-cli/src/main/java/org/apache/camel/karavan/cli/UpgradeCommand.java b/karavan-cli/src/main/java/org/apache/camel/karavan/cli/UpgradeCommand.java
new file mode 100644
index 00000000..8a05a100
--- /dev/null
+++ b/karavan-cli/src/main/java/org/apache/camel/karavan/cli/UpgradeCommand.java
@@ -0,0 +1,20 @@
+package org.apache.camel.karavan.cli;
+
+import picocli.CommandLine;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.HashMap;
+import java.util.concurrent.Callable;
+
+@CommandLine.Command(name = "upgrade",
+        mixinStandardHelpOptions = true,
+        description = "Upgrade Karavan")
+public class UpgradeCommand implements Callable<Integer> {
+
+    @Override
+    public Integer call() throws Exception {
+        System.out.println("Not implemented yet");
+        return 0;
+    }
+}
diff --git a/karavan-cli/src/main/resources/application.properties b/karavan-cli/src/main/resources/application.properties
new file mode 100644
index 00000000..726e936b
--- /dev/null
+++ b/karavan-cli/src/main/resources/application.properties
@@ -0,0 +1,6 @@
+quarkus.banner.enabled=false
+
+quarkus.package.type=uber-jar
+quarkus.package.add-runner-suffix=false
+
+quarkus.native.resources.includes=**.**
\ No newline at end of file