You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2022/08/24 12:31:45 UTC

[camel-k] branch main updated (1d2e4e566 -> 753da061e)

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

acosentino pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git


    from 1d2e4e566 migrate and improve knative example
     new e8bebae59 chore(build): Use Camel K runtime Maven structural logging module
     new 753da061e chore(build): Account for staging repository when loading Maven overlay artifacts

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:
 build/Dockerfile          |  2 +-
 build/logback.xml         | 62 ------------------------------
 script/Makefile           |  2 +-
 script/bundle_kamelets.sh |  3 +-
 script/maven_overlay.sh   | 96 +++++++++++++++++++++++++++++++++++++++++++----
 5 files changed, 93 insertions(+), 72 deletions(-)
 delete mode 100644 build/logback.xml


[camel-k] 02/02: chore(build): Account for staging repository when loading Maven overlay artifacts

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 753da061ed7c1700bfa9dd981b48bd64d8e76627
Author: Christoph Deppisch <cd...@redhat.com>
AuthorDate: Tue Aug 23 13:17:45 2022 +0200

    chore(build): Account for staging repository when loading Maven overlay artifacts
---
 script/Makefile         |  2 +-
 script/maven_overlay.sh | 91 +++++++++++++++++++++++++++++++++++--------------
 2 files changed, 67 insertions(+), 26 deletions(-)

diff --git a/script/Makefile b/script/Makefile
index f548595ee..8aab58b68 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -379,7 +379,7 @@ check-platform:
 maven-overlay:
 	@echo "####### Preparing maven dependencies bundle..."
 	mkdir -p build/_maven_overlay
-	./script/maven_overlay.sh $(RUNTIME_VERSION) build/_maven_overlay $(CAMEL_K_RUNTIME_DIR)
+	./script/maven_overlay.sh $(RUNTIME_VERSION) build/_maven_overlay $(STAGING_RUNTIME_REPO) $(CAMEL_K_RUNTIME_DIR)
 
 kamel-overlay:
 	@echo "####### Copying kamel CLI to output build directory..."
diff --git a/script/maven_overlay.sh b/script/maven_overlay.sh
index 2804f847d..e02786fa8 100755
--- a/script/maven_overlay.sh
+++ b/script/maven_overlay.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
@@ -19,7 +19,7 @@ location=$(dirname $0)
 rootdir=$(realpath ${location}/../)
 
 if [ "$#" -lt 2 ]; then
-  echo "usage: $0 <output directory> <Camel K runtime version> [<local Camel K runtime project directory>]"
+  echo "usage: $0 <Camel K runtime version> <output directory> [<staging repository>] [<local Camel K runtime project directory>]"
   exit 1
 fi
 
@@ -30,7 +30,45 @@ fi
 
 runtime_version=$1
 output_dir=$2
-local_runtime_dir=${3:-}
+staging_repo=${3:-}
+local_runtime_dir=${4:-}
+
+if [ -n "$staging_repo" ]; then
+    if  [[ $staging_repo == http:* ]] || [[ $staging_repo == https:* ]]; then
+        options="${options} -s ${rootdir}/settings.xml"
+        cat << EOF > ${rootdir}/settings.xml
+<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
+   <profiles>
+     <profile>
+       <id>camel-k-staging</id>
+       <repositories>
+         <repository>
+           <id>camel-k-staging-releases</id>
+           <name>Camel K Staging</name>
+           <url>${staging_repo}</url>
+           <releases>
+             <enabled>true</enabled>
+             <updatePolicy>never</updatePolicy>
+           </releases>
+           <snapshots>
+             <enabled>false</enabled>
+           </snapshots>
+         </repository>
+       </repositories>
+     </profile>
+   </profiles>
+   <activeProfiles>
+     <activeProfile>camel-k-staging</activeProfile>
+   </activeProfiles>
+</settings>
+EOF
+    else
+        local_runtime_dir="${staging_repo}"
+        staging_repo=""
+    fi
+fi
+
 
 if [ -z "$local_runtime_dir" ]; then
     mvn -q \
@@ -39,31 +77,34 @@ if [ -z "$local_runtime_dir" ]; then
       -Dartifact=org.apache.camel.k:camel-k-maven-logging:${runtime_version}:zip \
       -DoutputDirectory=${rootdir}/${output_dir}
 
-      mv ${rootdir}/${output_dir}/camel-k-maven-logging-${runtime_version}.zip ${rootdir}/${output_dir}/camel-k-maven-logging.zip
+    mv ${rootdir}/${output_dir}/camel-k-maven-logging-${runtime_version}.zip ${rootdir}/${output_dir}/camel-k-maven-logging.zip
 else
-      # Take the dependencies from a local development environment
-      camel_k_runtime_source=$3
-      camel_k_runtime_source_version=$(mvn -f $camel_k_runtime_source/pom.xml help:evaluate -Dexpression=project.version -q -DforceStdout)
-
-      if [ "$runtime_version" != "$camel_k_runtime_source_version" ]; then
-          echo "WARNING! You're building Camel K project using $runtime_version but trying to bundle dependencies from local Camel K runtime $camel_k_runtime_source_version"
-      fi
-
-      mvn -q \
-        $options \
-        -am \
-        -f $camel_k_runtime_source/support/camel-k-maven-logging/pom.xml \
-        install
-
-      mvn -q \
-        $options \
-        dependency:copy \
-        -Dartifact=org.apache.camel.k:camel-k-maven-logging:$camel_k_runtime_source_version:zip \
-        -DoutputDirectory=${rootdir}/${output_dir}
-
-      mv ${rootdir}/${output_dir}/camel-k-maven-logging-$camel_k_runtime_source_version.zip ${rootdir}/${output_dir}/camel-k-maven-logging.zip
+    # Take the dependencies from a local development environment
+    camel_k_runtime_source_version=$(mvn -f $local_runtime_dir/pom.xml help:evaluate -Dexpression=project.version -q -DforceStdout)
+
+    if [ "$runtime_version" != "$camel_k_runtime_source_version" ]; then
+        echo "WARNING! You're building Camel K project using $runtime_version but trying to bundle dependencies from local Camel K runtime $camel_k_runtime_source_version"
+    fi
+
+    mvn -q \
+      $options \
+      -am \
+      -f $local_runtime_dir/support/camel-k-maven-logging/pom.xml \
+      install
+
+    mvn -q \
+      $options \
+      dependency:copy \
+      -Dartifact=org.apache.camel.k:camel-k-maven-logging:$camel_k_runtime_source_version:zip \
+      -DoutputDirectory=${rootdir}/${output_dir}
+
+    mv ${rootdir}/${output_dir}/camel-k-maven-logging-$camel_k_runtime_source_version.zip ${rootdir}/${output_dir}/camel-k-maven-logging.zip
 fi
 
 unzip -q -o ${rootdir}/${output_dir}/camel-k-maven-logging.zip -d ${rootdir}/${output_dir}
 
+if [ -n "$staging_repo" ]; then
+    rm ${rootdir}/settings.xml
+fi
+
 rm ${rootdir}/${output_dir}/camel-k-maven-logging.zip


[camel-k] 01/02: chore(build): Use Camel K runtime Maven structural logging module

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit e8bebae595a9b1fd33f7475605a80d64d3845ba2
Author: Christoph Deppisch <cd...@redhat.com>
AuthorDate: Wed Jun 15 09:10:26 2022 +0200

    chore(build): Use Camel K runtime Maven structural logging module
    
    - Load and extract structural logging artifacts from Camel K runtime module
    - Use logback configuration provided by this runtime module
    - Add logging artifacts during Dockerfile image build
---
 build/Dockerfile          |  2 +-
 build/logback.xml         | 62 -----------------------------------------------
 script/Makefile           |  2 +-
 script/bundle_kamelets.sh |  3 ++-
 script/maven_overlay.sh   | 53 +++++++++++++++++++++++++++++++++++-----
 5 files changed, 51 insertions(+), 71 deletions(-)

diff --git a/build/Dockerfile b/build/Dockerfile
index b8d28551d..a70b843c2 100644
--- a/build/Dockerfile
+++ b/build/Dockerfile
@@ -33,7 +33,7 @@ RUN mkdir -p ${MAVEN_HOME} \
 ADD build/_maven_output /tmp/artifacts/m2
 ADD build/_kamelets /kamelets
 COPY build/_maven_overlay/ /usr/share/maven/lib/
-ADD build/logback.xml /usr/share/maven/conf/
+ADD build/_maven_overlay/logback.xml /usr/share/maven/conf/
 
 ENV MAVEN_OPTS="${MAVEN_OPTS} -Dlogback.configurationFile=/usr/share/maven/conf/logback.xml"
 
diff --git a/build/logback.xml b/build/logback.xml
deleted file mode 100644
index 04e3c9228..000000000
--- a/build/logback.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-<!--
-    Licensed to the Apache Software Foundation (ASF) under one or more
-    contributor license agreements.  See the NOTICE file distributed with
-    this work for additional information regarding copyright ownership.
-    The ASF licenses this file to You under the Apache License, Version 2.0
-    (the "License"); you may not use this file except in compliance with
-    the License.  You may obtain a copy of the License at
-         http://www.apache.org/licenses/LICENSE-2.0
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
--->
-<configuration>
-    <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
-        <!--
-        This configuration tries to output the Maven build log in a way that is as close as possible the native k8s
-        log output format.
-        -->
-        <encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
-            <providers>
-                <logLevel>
-                    <fieldName>level</fieldName>
-                </logLevel>
-                <timestamp>
-                    <fieldName>ts</fieldName>
-                    <timeZone>UTC</timeZone>
-                </timestamp>
-                <loggerName>
-                    <fieldName>logger</fieldName>
-                </loggerName>
-                <message>
-                    <fieldName>msg</fieldName>
-                </message>
-                <callerData>
-                    <classFieldName>class</classFieldName>
-                </callerData>
-                <threadName>
-                    <fieldName>thread</fieldName>
-                </threadName>
-                <mdc/>
-                <arguments>
-                    <includeNonStructuredArguments>false</includeNonStructuredArguments>
-                </arguments>
-                <logstashMarkers/>
-                <stackTrace>
-                    <fieldName>stack</fieldName>
-                    <throwableConverter class="net.logstash.logback.stacktrace.ShortenedThrowableConverter">
-                        <maxLength>4096</maxLength>
-                        <rootCauseFirst>false</rootCauseFirst>
-                    </throwableConverter>
-                </stackTrace>
-            </providers>
-        </encoder>
-    </appender>
-
-    <root level="INFO">
-        <appender-ref ref="CONSOLE"/>
-    </root>
-
-</configuration>
\ No newline at end of file
diff --git a/script/Makefile b/script/Makefile
index 0d6cc2668..f548595ee 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -379,7 +379,7 @@ check-platform:
 maven-overlay:
 	@echo "####### Preparing maven dependencies bundle..."
 	mkdir -p build/_maven_overlay
-	./script/maven_overlay.sh build/_maven_overlay
+	./script/maven_overlay.sh $(RUNTIME_VERSION) build/_maven_overlay $(CAMEL_K_RUNTIME_DIR)
 
 kamel-overlay:
 	@echo "####### Copying kamel CLI to output build directory..."
diff --git a/script/bundle_kamelets.sh b/script/bundle_kamelets.sh
index 057beff9f..66e7e1a81 100755
--- a/script/bundle_kamelets.sh
+++ b/script/bundle_kamelets.sh
@@ -16,13 +16,14 @@
 # limitations under the License.
 
 location=$(dirname $0)
+rootdir=$location/../
 
 set -e
 
 repo=$1
 branch=$2
 
-cd $location/../
+cd $rootdir
 target=./build/_kamelets
 
 # Always recreate the dir
diff --git a/script/maven_overlay.sh b/script/maven_overlay.sh
index e2fc6229b..2804f847d 100755
--- a/script/maven_overlay.sh
+++ b/script/maven_overlay.sh
@@ -15,14 +15,55 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+location=$(dirname $0)
+rootdir=$(realpath ${location}/../)
+
+if [ "$#" -lt 2 ]; then
+  echo "usage: $0 <output directory> <Camel K runtime version> [<local Camel K runtime project directory>]"
+  exit 1
+fi
+
 options=""
 if [ "$CI" = "true" ]; then
   options="--batch-mode"
 fi
 
-mvn -q $options dependency:get -Dartifact=ch.qos.logback:logback-core:1.2.3 -Ddest=$1
-mvn -q $options dependency:get -Dartifact=ch.qos.logback:logback-classic:1.2.3 -Ddest=$1
-mvn -q $options dependency:get -Dartifact=net.logstash.logback:logstash-logback-encoder:4.11 -Ddest=$1
-mvn -q $options dependency:get -Dartifact=com.fasterxml.jackson.core:jackson-annotations:2.9.10 -Ddest=$1
-mvn -q $options dependency:get -Dartifact=com.fasterxml.jackson.core:jackson-core:2.9.10 -Ddest=$1
-mvn -q $options dependency:get -Dartifact=com.fasterxml.jackson.core:jackson-databind:2.9.10.8 -Ddest=$1
+runtime_version=$1
+output_dir=$2
+local_runtime_dir=${3:-}
+
+if [ -z "$local_runtime_dir" ]; then
+    mvn -q \
+      $options \
+      dependency:copy \
+      -Dartifact=org.apache.camel.k:camel-k-maven-logging:${runtime_version}:zip \
+      -DoutputDirectory=${rootdir}/${output_dir}
+
+      mv ${rootdir}/${output_dir}/camel-k-maven-logging-${runtime_version}.zip ${rootdir}/${output_dir}/camel-k-maven-logging.zip
+else
+      # Take the dependencies from a local development environment
+      camel_k_runtime_source=$3
+      camel_k_runtime_source_version=$(mvn -f $camel_k_runtime_source/pom.xml help:evaluate -Dexpression=project.version -q -DforceStdout)
+
+      if [ "$runtime_version" != "$camel_k_runtime_source_version" ]; then
+          echo "WARNING! You're building Camel K project using $runtime_version but trying to bundle dependencies from local Camel K runtime $camel_k_runtime_source_version"
+      fi
+
+      mvn -q \
+        $options \
+        -am \
+        -f $camel_k_runtime_source/support/camel-k-maven-logging/pom.xml \
+        install
+
+      mvn -q \
+        $options \
+        dependency:copy \
+        -Dartifact=org.apache.camel.k:camel-k-maven-logging:$camel_k_runtime_source_version:zip \
+        -DoutputDirectory=${rootdir}/${output_dir}
+
+      mv ${rootdir}/${output_dir}/camel-k-maven-logging-$camel_k_runtime_source_version.zip ${rootdir}/${output_dir}/camel-k-maven-logging.zip
+fi
+
+unzip -q -o ${rootdir}/${output_dir}/camel-k-maven-logging.zip -d ${rootdir}/${output_dir}
+
+rm ${rootdir}/${output_dir}/camel-k-maven-logging.zip