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/05/10 17:23:48 UTC

[camel-karavan] branch main updated: Save YAML file

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


The following commit(s) were added to refs/heads/main by this push:
     new d47de807 Save YAML file
d47de807 is described below

commit d47de807e8b671e1d717f59e6a2a511d5e2e5b68
Author: Marat Gubaidullin <ma...@gmail.com>
AuthorDate: Wed May 10 13:23:24 2023 -0400

    Save YAML file
---
 .../java/org/apache/camel/karavan/cli/KaravanCli.java    | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

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/KaravanCli.java
index f553dceb..b3e17b05 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/KaravanCli.java
@@ -2,6 +2,8 @@ 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.Map;
 import java.util.concurrent.Callable;
@@ -34,6 +36,12 @@ public class KaravanCli implements Callable<Integer> {
     private String baseImage;
     @CommandLine.Option(names = {"-bbi", "--base-builder-image"}, description = "Base Builder Image", defaultValue = Constants.DEFAULT_BUILD_IMAGE)
     private String baseBuilderImage;
+    @CommandLine.Option(names = {"-f", "--file"}, description = "YAML file name", defaultValue = "karavan.yaml")
+    private String file;
+    @CommandLine.Option(names = {"-y", "--yaml"}, description = "Create YAML file. Do not apply")
+    private boolean yaml;
+    @CommandLine.Option(names = {"-o", "--openshift"}, description = "Create files for OpenShift")
+    private boolean isOpenShift;
 
     @Override
     public Integer call() throws Exception {
@@ -49,10 +57,14 @@ public class KaravanCli implements Callable<Integer> {
                 imageRegistry,
                 baseImage,
                 baseBuilderImage,
-                false,
+                isOpenShift,
                 new HashMap<>()
         );
-        CommandUtils.installKaravan(config);
+        if (yaml) {
+            Files.writeString(Path.of(file), ResourceUtils.generateResources(config));
+        } else {
+            CommandUtils.installKaravan(config);
+        }
         return 0;
     }