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 2022/12/15 15:53:25 UTC
[camel-karavan] branch main updated (b7b1fde -> 813b64b)
This is an automated email from the ASF dual-hosted git repository.
marat pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel-karavan.git
from b7b1fde Operator stuff for #561
new fc6af9c Operator maven deploy for springboot for #561
new 813b64b Refactor commands
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../spring-boot-builder-script-kubernetes.sh | 3 ++-
.../spring-boot-builder-script-openshift.sh | 3 ++-
karavan-vscode/src/exec.ts | 26 +++++++++++++++++++++-
karavan-vscode/src/extension.ts | 2 +-
karavan-vscode/src/jbang.ts | 24 +-------------------
5 files changed, 31 insertions(+), 27 deletions(-)
[camel-karavan] 01/02: Operator maven deploy for springboot for #561
Posted by ma...@apache.org.
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 fc6af9cdac0ddd49ce28d78880b153d5c1bc9006
Author: Marat Gubaidullin <ma...@gmail.com>
AuthorDate: Thu Dec 15 10:52:57 2022 -0500
Operator maven deploy for springboot for #561
---
.../src/main/resources/spring-boot-builder-script-kubernetes.sh | 3 ++-
.../src/main/resources/spring-boot-builder-script-openshift.sh | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/karavan-operator/src/main/resources/spring-boot-builder-script-kubernetes.sh b/karavan-operator/src/main/resources/spring-boot-builder-script-kubernetes.sh
index 955c147..aedac75 100644
--- a/karavan-operator/src/main/resources/spring-boot-builder-script-kubernetes.sh
+++ b/karavan-operator/src/main/resources/spring-boot-builder-script-kubernetes.sh
@@ -32,6 +32,7 @@ export DATE=$(date '+%Y%m%d%H%M%S')
export TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
export NAMESPACE=$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace)
-/opt/mvnd/bin/mvnd package \
+/opt/mvnd/bin/mvnd package k8s:build k8s:resource k8s:apply \
+ -Pkubernetes \
-Djkube.namespace=${NAMESPACE} \
-Djkube.generator.name=image-registry.openshift-image-registry.svc:5000/${NAMESPACE}/$NAME:${DATE} \
\ No newline at end of file
diff --git a/karavan-operator/src/main/resources/spring-boot-builder-script-openshift.sh b/karavan-operator/src/main/resources/spring-boot-builder-script-openshift.sh
index ce8de70..30a1256 100644
--- a/karavan-operator/src/main/resources/spring-boot-builder-script-openshift.sh
+++ b/karavan-operator/src/main/resources/spring-boot-builder-script-openshift.sh
@@ -32,6 +32,7 @@ export DATE=$(date '+%Y%m%d%H%M%S')
export TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
export NAMESPACE=$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace)
-/opt/mvnd/bin/mvnd package \
+/opt/mvnd/bin/mvnd package oc:build oc:resource oc:apply \
+ -Popenshift \
-Djkube.namespace=${NAMESPACE} \
-Djkube.generator.name=image-registry.openshift-image-registry.svc:5000/${NAMESPACE}/$NAME:${DATE} \
[camel-karavan] 02/02: Refactor commands
Posted by ma...@apache.org.
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 813b64bc61e73f8499724fc005090959d040d289
Author: Marat Gubaidullin <ma...@gmail.com>
AuthorDate: Thu Dec 15 10:53:17 2022 -0500
Refactor commands
---
karavan-vscode/src/exec.ts | 26 +++++++++++++++++++++++++-
karavan-vscode/src/extension.ts | 2 +-
karavan-vscode/src/jbang.ts | 24 +-----------------------
3 files changed, 27 insertions(+), 25 deletions(-)
diff --git a/karavan-vscode/src/exec.ts b/karavan-vscode/src/exec.ts
index ef1fce4..1511e5c 100644
--- a/karavan-vscode/src/exec.ts
+++ b/karavan-vscode/src/exec.ts
@@ -17,7 +17,7 @@
import * as utils from "./utils";
import * as jbang from "./jbang";
import * as shell from 'shelljs';
-import { window, Terminal, ThemeIcon } from "vscode";
+import { workspace, window, Terminal, ThemeIcon } from "vscode";
export interface Result {
result: boolean
@@ -52,4 +52,28 @@ export async function runWithRuntime(fullPath: string, run?: boolean) {
command = command.concat(" && mvn clean ").concat(mvn).concat(" -f ").concat(fullPath);
}
execTerminalCommand("runtime-run", command);
+}
+
+export function camelDeploy(directory: string) {
+ Promise.all([
+ utils.getRuntime(),
+ utils.getTarget(),
+ utils.getExportFolder(),
+ execCommand("oc project -q"), // get namespace
+ ]).then(val => {
+ const runtime = val[0] || '';
+ const target = val[1] || '';
+ const exportFolder = val[2] || '';
+ let env: any = { "DATE": Date.now().toString() };
+ if (target === 'openshift' && val[3].result) {
+ env.NAMESPACE = val[3].value.trim();
+ } else if (target === 'openshift' && val[3].result === undefined) {
+ window.showErrorMessage("Namespace not set \n" + val[3].error);
+ }
+ const deployCommand: string = workspace.getConfiguration().get("Karavan.".concat(runtime.replaceAll("-", "")).concat(utils.capitalize(target)).concat("Deploy")) || '';
+ const command = jbang.createExportCommand(directory).concat(" && ").concat(deployCommand).concat(" -f ").concat(exportFolder);
+ execTerminalCommand("deploy", command, env);
+ }).catch((reason: any) => {
+ window.showErrorMessage("Error: \n" + reason.message);
+ });
}
\ No newline at end of file
diff --git a/karavan-vscode/src/extension.ts b/karavan-vscode/src/extension.ts
index 4184276..3e2b52f 100644
--- a/karavan-vscode/src/extension.ts
+++ b/karavan-vscode/src/extension.ts
@@ -106,7 +106,7 @@ export function activate(context: ExtensionContext) {
// Deploy project
const deployCommand = commands.registerCommand("karavan.deploy", (...args: any[]) => {
- jbang.camelDeploy(rootPath + path.sep + ".export");
+ exec.camelDeploy(rootPath + path.sep + ".export");
});
context.subscriptions.push(deployCommand);
diff --git a/karavan-vscode/src/jbang.ts b/karavan-vscode/src/jbang.ts
index e0ece00..c438d52 100644
--- a/karavan-vscode/src/jbang.ts
+++ b/karavan-vscode/src/jbang.ts
@@ -68,29 +68,7 @@ export function createExportCommand(fullPath: string) {
return prepareCommand(cmd);
}
-export function camelDeploy(directory: string) {
- Promise.all([
- utils.getRuntime(),
- utils.getTarget(),
- utils.getExportFolder(),
- exec.execCommand("oc project -q"), // get namespace
- ]).then(val => {
- const runtime = val[0] || '';
- const target = val[1] || '';
- const exportFolder = val[2] || '';
- let env: any = { "DATE": Date.now().toString() };
- if (target === 'openshift' && val[3].result) {
- env.NAMESPACE = val[3].value.trim();
- } else if (target === 'openshift' && val[3].result === undefined) {
- window.showErrorMessage("Namespace not set \n" + val[3].error);
- }
- const deployCommand: string = workspace.getConfiguration().get("Karavan.".concat(runtime.replaceAll("-", "")).concat(utils.capitalize(target)).concat("Deploy")) || '';
- const command = createExportCommand(directory).concat(" && ").concat(deployCommand).concat(" -f ").concat(exportFolder);
- exec.execTerminalCommand("deploy", command, env);
- }).catch((reason: any) => {
- window.showErrorMessage("Error: \n" + reason.message);
- });
-}
+
function executeJbangCommand(rootPath: string, command: string, callback: (code: number, stdout: any, stderr: any) => any) {
console.log("excute command", command);