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

mgubaidullin 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 4c3323d6 build.sh fix
4c3323d6 is described below

commit 4c3323d6245559e600eb8357d65642d8d68b636a
Author: Marat Gubaidullin <[email protected]>
AuthorDate: Tue Aug 25 11:38:06 2026 -0400

    build.sh fix
---
 .../main/resources/configuration/docker/build.sh   | 40 +++++++++------
 .../resources/configuration/kubernetes/build.sh    | 58 +++++++++++++++-------
 2 files changed, 64 insertions(+), 34 deletions(-)

diff --git a/karavan-app/src/main/resources/configuration/docker/build.sh 
b/karavan-app/src/main/resources/configuration/docker/build.sh
index c3b9ef25..1134fd1e 100644
--- a/karavan-app/src/main/resources/configuration/docker/build.sh
+++ b/karavan-app/src/main/resources/configuration/docker/build.sh
@@ -1,20 +1,30 @@
 #!/usr/bin/env bash
+set -e
 
-git config --global credential.helper 'cache --timeout=3600'
-git_credential_fill() {
-    echo url=$GIT_REPOSITORY
-    echo username=$GIT_USERNAME
-    echo password=$GIT_PASSWORD
-}
-git_credential_fill | git credential approve
-git clone --depth 1 --branch $GIT_BRANCH $GIT_REPOSITORY $CODE_DIR
+log_step "📥 Cloning repository"
+git_auth_username_password
+git clone --filter=blob:none --branch ${GIT_BRANCH} ${GIT_REPOSITORY} 
${CODE_DIR}
 
-cd $CODE_DIR/$PROJECT_ID
+log_step "⚙️ Configuring Environment"
+JIB_MAVEN_VERSION=3.5.2
+JIB_ARGS=(
+  "-Djib.allowInsecureRegistries=true"
+  "-Djib.from.image=registry.access.redhat.com/hi/openjdk:21.0.11"
+  "-Djib.container.creationTime=USE_CURRENT_TIMESTAMP"
+  
"-Djib.container.labels=org.apache.camel.karavan/type=packaged,org.apache.camel.karavan/projectId=$PROJECT_ID"
+  "-Djib.to.image=$IMAGE_REGISTRY/$IMAGE_GROUP/$PROJECT_ID:$TAG"
+  "-Djib.to.auth.username=$IMAGE_REGISTRY_USERNAME"
+  "-Djib.to.auth.password=$IMAGE_REGISTRY_PASSWORD"
+)
 
-jbang -Dcamel.jbang.version=$CAMEL_VERSION camel@apache/camel export 
--local-kamelet-dir=$KAMELETS_DIR
+log_step "📂️ Prepare files"
+cd "$CODE_DIR"/"$PROJECT_ID"
 
-mvn package jib:build \
-  -Djib.allowInsecureRegistries=true \
-  -Djib.to.image=$IMAGE_REGISTRY/$IMAGE_GROUP/$PROJECT_ID:$TAG \
-  -Djib.to.auth.username=$IMAGE_REGISTRY_USERNAME \
-  -Djib.to.auth.password=$IMAGE_REGISTRY_PASSWORD
+log_step "📦 Exporting project into Maven"
+# TODO: --ignore-loading-error until 
https://issues.apache.org/jira/browse/CAMEL-24410
+java -cp "$KARAVAN_LIB/*" KaravanDevMode export * 
--local-kamelet-dir=$KAMELETS_DIR --dir=.export --ignore-loading-error
+
+log_step "🛠️ Build "
+mvn package 
"com.google.cloud.tools:jib-maven-plugin:${JIB_MAVEN_VERSION}:build" -f .export 
"${JIB_ARGS[@]}" --no-transfer-progress
+
+log_step "✅ Process Complete"
\ No newline at end of file
diff --git a/karavan-app/src/main/resources/configuration/kubernetes/build.sh 
b/karavan-app/src/main/resources/configuration/kubernetes/build.sh
index 70162609..c8cfa847 100644
--- a/karavan-app/src/main/resources/configuration/kubernetes/build.sh
+++ b/karavan-app/src/main/resources/configuration/kubernetes/build.sh
@@ -1,25 +1,45 @@
 #!/usr/bin/env bash
+set -e
 
-export NAMESPACE=$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace)
+log_step "📥 Cloning repository"
+git_auth_username_password
+git clone --filter=blob:none --branch ${GIT_BRANCH} ${GIT_REPOSITORY} 
${CODE_DIR}
 
-git config --global credential.helper 'cache --timeout=3600'
-git_credential_fill() {
-    echo url=$GIT_REPOSITORY
-    echo username=$GIT_USERNAME
-    echo password=$GIT_PASSWORD
-}
-git_credential_fill | git credential approve
-git clone --depth 1 --branch $GIT_BRANCH $GIT_REPOSITORY $CODE_DIR
+log_step "⚙️ Configuring Environment"
+JIB_MAVEN_VERSION=3.5.2
+JIB_ARGS=(
+  "-Djib.allowInsecureRegistries=true"
+  "-Djib.from.image=registry.access.redhat.com/hi/openjdk:21.0.11"
+  "-Djib.container.creationTime=USE_CURRENT_TIMESTAMP"
+  
"-Djib.container.labels=org.apache.camel.karavan/type=packaged,org.apache.camel.karavan/projectId=$PROJECT_ID"
+  "-Djib.to.image=$IMAGE_REGISTRY/$IMAGE_GROUP/$PROJECT_ID:$TAG"
+  "-Djib.to.auth.username=$IMAGE_REGISTRY_USERNAME"
+  "-Djib.to.auth.password=$IMAGE_REGISTRY_PASSWORD"
+)
+# JKube (Kubernetes / OpenShift) configuration
+JKUBE_GOAL="k8s:resource k8s:apply"
+JKUBE_ARGS=(
+  "-Djkube.namespace=$NAMESPACE"
+  "-Djkube.enricher.jkube-project-label.group=karavan"
+  "-Djkube.enricher.jkube-project-label.provider=karavan"
+  "-Djkube.enricher.jkube-serviceaccount.skipCreate=true"
+  "-Djkube.enricher.jkube-well-known-labels.partOf=$PROJECT_ID"
+  "-Djkube.skip.build=true"
+  "-Djkube.imagePullPolicy=Always"
+  "-Djkube.enricher.jkube-controller.type=Deployment"
+  "-Djkube.enricher.jkube-service.port=80:8080,443:8080"
+  "-Djkube.enricher.jkube-service.multiPort=true"
+  "-Djkube.recreate=true"
+)
 
-cd $CODE_DIR/$PROJECT_ID
+log_step "📂️ Prepare files"
+cd "$CODE_DIR"/"$PROJECT_ID"
 
-jbang -Dcamel.jbang.version=$CAMEL_VERSION camel@apache/camel export 
--local-kamelet-dir=$KAMELETS_DIR
+log_step "📦 Exporting project into Maven"
+# TODO: --ignore-loading-error until 
https://issues.apache.org/jira/browse/CAMEL-24410
+java -cp "$KARAVAN_LIB/*" KaravanDevMode export * 
--local-kamelet-dir=$KAMELETS_DIR --dir=.export --ignore-loading-error
 
-mvn package jib:build k8s:resource k8s:apply \
-  -Djkube.namespace=${NAMESPACE} \
-  -Djib.allowInsecureRegistries=true \
-  -Djib.to.image=${IMAGE_REGISTRY}/${IMAGE_GROUP}/${PROJECT_ID}:${TAG} \
-  -Djib.to.auth.username=${IMAGE_REGISTRY_USERNAME} \
-  -Djib.to.auth.password=${IMAGE_REGISTRY_PASSWORD}
-  #  -Djib.from.platforms=linux/arm64 \
-  #  -Djib.platform.architecture=arm64 \
\ No newline at end of file
+log_step "🛠️ Build and Deploy"
+mvn package 
"com.google.cloud.tools:jib-maven-plugin:${JIB_MAVEN_VERSION}:build" 
$JKUBE_GOAL -f .export "${JIB_ARGS[@]}" --no-transfer-progress
+
+log_step "✅ Process Complete"
\ No newline at end of file

Reply via email to