You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2022/06/07 10:34:51 UTC

[camel-k] branch main updated: chore: ci build rule and license fix

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

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


The following commit(s) were added to refs/heads/main by this push:
     new 87d9d7a20 chore: ci build rule and license fix
87d9d7a20 is described below

commit 87d9d7a20de55eb290fa194d3d15229a3dec9843
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Fri Jun 3 09:41:51 2022 +0200

    chore: ci build rule and license fix
---
 script/Makefile                                    |  4 +++
 script/bundle_kamelets.sh                          |  5 +++
 script/check_licenses.sh                           |  4 +--
 script/set_go_modules_version.sh                   |  2 +-
 ...dle_kamelets.sh => vendor-license-directory.sh} | 42 +++++++---------------
 5 files changed, 24 insertions(+), 33 deletions(-)

diff --git a/script/Makefile b/script/Makefile
index 3fca06aa5..ee9ca2a32 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -194,6 +194,8 @@ generate-strimzi:
 
 build: test build-resources build-kamel build-compile-integration-tests build-submodules
 
+ci-build: clean codegen set-module-version set-version check-licenses dir-licenses build-kamel cross-compile
+
 do-build:
 ifeq ($(DO_TEST_PREBUILD),true)
 TEST_PREBUILD = build
@@ -308,6 +310,8 @@ lint:
 lint-fix:
 	GOGC=$(LINT_GOGC) golangci-lint run --out-format tab --deadline $(LINT_DEADLINE) --fix
 
+dir-licenses:
+	./script/vendor-license-directory.sh
 
 check-licenses:
 	./script/check_licenses.sh
diff --git a/script/bundle_kamelets.sh b/script/bundle_kamelets.sh
index 990da9299..057beff9f 100755
--- a/script/bundle_kamelets.sh
+++ b/script/bundle_kamelets.sh
@@ -47,3 +47,8 @@ git clone -b $branch --single-branch --depth 1 $repo ./tmp_kamelet_catalog
 cp ./tmp_kamelet_catalog/kamelets/*.kamelet.yaml $target
 
 rm -rf ./tmp_kamelet_catalog
+
+#
+# Check that all the kamelets have licences
+#
+./script/add_license.sh $target ./script/headers/yaml.txt
diff --git a/script/check_licenses.sh b/script/check_licenses.sh
index 85416caea..6ec23001c 100755
--- a/script/check_licenses.sh
+++ b/script/check_licenses.sh
@@ -18,7 +18,7 @@
 location=$(dirname $0)
 rootdir=$location/../
 
-blacklist=("zz_generated" "zz_desc_generated" "./docs/" "./.idea" "./build/" "./resources/traits.yaml")
+denylist=("zz_generated" "zz_desc_generated" "vendor" "./.mvn/wrapper" "./docs/" "./.idea" "./build/" "./deploy/traits.yaml" "./pom.xml")
 
 cd $rootdir
 go build ./cmd/util/license-check/
@@ -31,7 +31,7 @@ check_licenses() {
     failed=0
     find . -type f -name "$files" -print0 | while IFS= read -r -d '' file; do
         check=true
-        for b in ${blacklist[*]}; do
+        for b in ${denylist[*]}; do
         	if [[ "$file" == *"$b"* ]]; then
         	  #echo "skip $file"
         	  check=false
diff --git a/script/set_go_modules_version.sh b/script/set_go_modules_version.sh
index 091f8533a..a0a2b9497 100755
--- a/script/set_go_modules_version.sh
+++ b/script/set_go_modules_version.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
diff --git a/script/bundle_kamelets.sh b/script/vendor-license-directory.sh
similarity index 58%
copy from script/bundle_kamelets.sh
copy to script/vendor-license-directory.sh
index 990da9299..6b667e445 100755
--- a/script/bundle_kamelets.sh
+++ b/script/vendor-license-directory.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
@@ -15,35 +15,17 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-location=$(dirname $0)
+# Creates a licenses directory and copies vendor licenses into it.
 
-set -e
-
-repo=$1
-branch=$2
-
-cd $location/../
-target=./build/_kamelets
-
-# Always recreate the dir
-rm -rf $target
-mkdir $target
-
-if [ "$repo" = "" ]; then
-	echo "no kamelet catalog defined: skipping"
-	exit 0
-fi
-
-if [ "$branch" = "" ]; then
-  branch="main"
+if [ -d licenses ]
+then
+    rm -rf licenses
 fi
 
-echo "Cloning repository $repo on branch $branch to bundle kamelets..."
-
-
-rm -rf ./tmp_kamelet_catalog
-git clone -b $branch --single-branch --depth 1 $repo ./tmp_kamelet_catalog
-
-cp ./tmp_kamelet_catalog/kamelets/*.kamelet.yaml $target
-
-rm -rf ./tmp_kamelet_catalog
+mkdir licenses
+for lic in `find . \( -name "LICENSE*" -o -name "NOTICE*" \) | sed 's|^./||'`
+do
+    dir=licenses/`dirname $lic`
+    mkdir -p $dir
+    cp $lic $dir
+done